Merge
authorprr
Mon, 10 Apr 2017 08:31:37 -0700
changeset 44661 3d76dfc6d0f4
parent 44659 1b34d7d66840 (current diff)
parent 44551 353956d2e327 (diff)
child 44662 9ef2b58bd3c2
Merge
jdk/src/java.base/share/classes/java/lang/reflect/Layer.java
jdk/src/java.base/share/classes/java/lang/reflect/LayerInstantiationException.java
jdk/src/java.base/share/classes/java/lang/reflect/Module.java
jdk/src/java.base/share/classes/java/lang/reflect/WeakPairMap.java
jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java
jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java
jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java
jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java
jdk/test/java/lang/reflect/Layer/BasicLayerTest.java
jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java
jdk/test/java/lang/reflect/Layer/LayerControllerTest.java
jdk/test/java/lang/reflect/Layer/layertest/Test.java
jdk/test/java/lang/reflect/Layer/src/m1/module-info.java
jdk/test/java/lang/reflect/Layer/src/m1/p/Main.java
jdk/test/java/lang/reflect/Layer/src/m1/p/Service.java
jdk/test/java/lang/reflect/Layer/src/m2/module-info.java
jdk/test/java/lang/reflect/Layer/src/m2/q/Hello.java
jdk/test/java/lang/reflect/Layer/src/m3/module-info.java
jdk/test/java/lang/reflect/Layer/src/m3/w/Hello.java
jdk/test/java/lang/reflect/Layer/src/m4/impl/ServiceImpl.java
jdk/test/java/lang/reflect/Layer/src/m4/module-info.java
jdk/test/java/lang/reflect/Module/AddExportsTest.java
jdk/test/java/lang/reflect/Module/AnnotationsTest.java
jdk/test/java/lang/reflect/Module/BasicModuleTest.java
jdk/test/java/lang/reflect/Module/WithSecurityManager.java
jdk/test/java/lang/reflect/Module/access/AccessTest.java
jdk/test/java/lang/reflect/Module/access/src/target/module-info.java
jdk/test/java/lang/reflect/Module/access/src/target/p1/Helper.java
jdk/test/java/lang/reflect/Module/access/src/target/p1/Public.java
jdk/test/java/lang/reflect/Module/access/src/target/p2/NonPublic.java
jdk/test/java/lang/reflect/Module/access/src/target/q1/Public.java
jdk/test/java/lang/reflect/Module/access/src/target/q2/NonPublic.java
jdk/test/java/lang/reflect/Module/access/src/test/module-info.java
jdk/test/java/lang/reflect/Module/access/src/test/test/Main.java
jdk/test/java/lang/reflect/Module/addXXX/Driver.java
jdk/test/java/lang/reflect/Module/addXXX/m1/module-info.java
jdk/test/java/lang/reflect/Module/addXXX/m1/p1/C.java
jdk/test/java/lang/reflect/Module/addXXX/m2/module-info.java
jdk/test/java/lang/reflect/Module/addXXX/m2/p2/C.java
jdk/test/java/lang/reflect/Module/addXXX/m2/p2/internal/C.java
jdk/test/java/lang/reflect/Module/addXXX/m3/module-info.java
jdk/test/java/lang/reflect/Module/addXXX/m3/p3/C.java
jdk/test/java/lang/reflect/Module/addXXX/m4/module-info.java
jdk/test/java/lang/reflect/Module/addXXX/m4/p4/C.java
jdk/test/java/lang/reflect/Module/addXXX/test/module-info.java
jdk/test/java/lang/reflect/Module/addXXX/test/test/C.java
jdk/test/java/lang/reflect/Module/addXXX/test/test/Main.java
jdk/test/java/lang/reflect/Module/addXXX/test/test/Service.java
jdk/test/java/lang/reflect/Module/allow.policy
jdk/test/java/lang/reflect/Module/annotation/Basic.java
jdk/test/java/lang/reflect/Module/annotation/src/m/module-info.java
jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Bar.java
jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Baz.java
jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Foo.java
jdk/test/java/lang/reflect/WeakPairMap/Driver.java
jdk/test/java/lang/reflect/WeakPairMap/java.base/java/lang/reflect/WeakPairMapTest.java
--- a/jdk/.hgtags	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/.hgtags	Mon Apr 10 08:31:37 2017 -0700
@@ -405,3 +405,5 @@
 cac788454598b95d8b0153c021a7fae3cd7e6fda jdk-9+160
 09b92d3067a38ee07bc14efa336b14790c93f7e7 jdk-9+161
 f6bf027e88e9a4dd19f721001a7af00157af42c4 jdk-9+162
+50171f8c47961710cbf87aead6f03fa431d8d240 jdk-9+163
+6dea581453d7c0e767e3169cfec8b423a381e71d jdk-9+164
--- a/jdk/make/GenerateModuleSummary.gmk	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/make/GenerateModuleSummary.gmk	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -31,7 +31,7 @@
 include ModuleTools.gmk
 
 GENGRAPHS_DIR := $(IMAGES_OUTPUTDIR)/gengraphs
-SPEC_DOTFILES_DIR := $(IMAGES_OUTPUTDIR)/spec-dotfiles
+SPEC_DOTFILES_DIR := $(GENGRAPHS_DIR)/spec-dotfiles
 TOOLS_MODULE_SRCDIR := $(JDK_TOPDIR)/make/src/classes/build/tools/jigsaw
 
 $(GENGRAPHS_DIR)/jdk.dot: $(BUILD_JIGSAW_TOOLS)
--- a/jdk/make/ModuleTools.gmk	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/make/ModuleTools.gmk	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -23,8 +23,9 @@
 # questions.
 #
 
-include $(SPEC)
-include MakeBase.gmk
+ifndef _MODULE_TOOLS_GMK
+_MODULE_TOOLS_GMK := 1
+
 include JavaCompilation.gmk
 
 TOOLS_CLASSES_DIR := $(BUILDTOOLS_OUTPUTDIR)/tools_jigsaw_classes
@@ -32,7 +33,7 @@
 # To avoid reevaluating the compilation setup for the tools each time this file
 # is included, the actual compilation is handled by CompileModuleTools.gmk. The
 # following trick is used to be able to declare a dependency on the built tools.
-BUILD_TOOLS_JDK := $(call SetupJavaCompilationCompileTarget, \
+BUILD_JIGSAW_TOOLS := $(call SetupJavaCompilationCompileTarget, \
     BUILD_JIGSAW_TOOLS, $(TOOLS_CLASSES_DIR))
 
 TOOL_GENGRAPHS := $(BUILD_JAVA) -esa -ea -cp $(TOOLS_CLASSES_DIR) \
@@ -47,3 +48,5 @@
     -cp $(TOOLS_CLASSES_DIR) \
     --add-exports java.base/jdk.internal.module=ALL-UNNAMED \
     build.tools.jigsaw.AddPackagesAttribute
+
+endif # _MODULE_TOOLS_GMK
--- a/jdk/make/data/tzdata/VERSION	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/make/data/tzdata/VERSION	Mon Apr 10 08:31:37 2017 -0700
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2017a
+tzdata2017b
--- a/jdk/make/data/tzdata/africa	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/make/data/tzdata/africa	Mon Apr 10 08:31:37 2017 -0700
@@ -443,18 +443,25 @@
 # See Africa/Johannesburg.
 
 # Liberia
-# From Paul Eggert (2006-03-22):
-# In 1972 Liberia was the last country to switch
-# from a UTC offset that was not a multiple of 15 or 20 minutes.
-# Howse reports that it was in honor of their president's birthday.
-# Shank & Pottenger report the date as May 1, whereas Howse reports Jan;
-# go with Shanks & Pottenger.
-# For Liberia before 1972, Shanks & Pottenger report -0:44, whereas Howse and
-# Whitman each report -0:44:30; go with the more precise figure.
+#
+# From Paul Eggert (2017-03-02):
+#
+# The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30.
+#
+# In 1972 Liberia was the last country to switch from a UTC offset
+# that was not a multiple of 15 or 20 minutes.  The 1972 change was on
+# 1972-01-07, according to an entry dated 1972-01-04 on p 330 of:
+# Presidential Papers: First year of the administration of
+# President William R. Tolbert, Jr., July 23, 1971-July 31, 1972.
+# Monrovia: Executive Mansion.
+#
+# Use the abbreviation "MMT" before 1972, as the more-accurate numeric
+# abbreviation "-004430" would be one byte over the POSIX limit.
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Monrovia	-0:43:08 -	LMT	1882
 			-0:43:08 -	MMT	1919 Mar # Monrovia Mean Time
-			-0:44:30 -	-004430	1972 May
+			-0:44:30 -	MMT	1972 Jan 7 # approximately MMT
 			 0:00	-	GMT
 
 ###############################################################################
--- a/jdk/make/data/tzdata/iso3166.tab	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/make/data/tzdata/iso3166.tab	Mon Apr 10 08:31:37 2017 -0700
@@ -32,8 +32,8 @@
 # All text uses UTF-8 encoding.  The columns of the table are as follows:
 #
 # 1.  ISO 3166-1 alpha-2 country code, current as of
-#     ISO 3166-1 Newsletter VI-16 (2013-07-11).  See: Updates on ISO 3166
-#   http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm
+#     ISO 3166-1 N905 (2016-11-15).  See: Updates on ISO 3166-1
+#     http://isotc.iso.org/livelink/livelink/Open/16944257
 # 2.  The usual English name for the coded region,
 #     chosen so that alphabetic sorting of subsets produces helpful lists.
 #     This is not the same as the English name in the ISO 3166 tables.
--- a/jdk/make/data/tzdata/northamerica	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/make/data/tzdata/northamerica	Mon Apr 10 08:31:37 2017 -0700
@@ -3162,6 +3162,12 @@
 # http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
 # http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/
 
+# From Steffen Thorsen (2017-03-12):
+# We have received 4 mails from different people telling that Haiti
+# has started DST again today, and this source seems to confirm that,
+# I have not been able to find a more authoritative source:
+# https://www.haitilibre.com/en/news-20319-haiti-notices-time-change-in-haiti.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Haiti	1983	only	-	May	8	0:00	1:00	D
 Rule	Haiti	1984	1987	-	Apr	lastSun	0:00	1:00	D
@@ -3174,6 +3180,8 @@
 Rule	Haiti	2005	2006	-	Oct	lastSun	0:00	0	S
 Rule	Haiti	2012	2015	-	Mar	Sun>=8	2:00	1:00	D
 Rule	Haiti	2012	2015	-	Nov	Sun>=1	2:00	0	S
+Rule	Haiti	2017	max	-	Mar	Sun>=8	2:00	1:00	D
+Rule	Haiti	2017	max	-	Nov	Sun>=1	2:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Port-au-Prince -4:49:20 -	LMT	1890
 			-4:49	-	PPMT	1917 Jan 24 12:00 # P-a-P MT
--- a/jdk/make/mapfiles/libjava/mapfile-vers	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/make/mapfiles/libjava/mapfile-vers	Mon Apr 10 08:31:37 2017 -0700
@@ -273,12 +273,12 @@
                 Java_jdk_internal_misc_VM_getRuntimeArguments;
                 Java_jdk_internal_misc_VM_initialize;
 
-                Java_java_lang_reflect_Module_defineModule0;
-                Java_java_lang_reflect_Module_addReads0;
-                Java_java_lang_reflect_Module_addExports0;
-                Java_java_lang_reflect_Module_addExportsToAll0;
-                Java_java_lang_reflect_Module_addExportsToAllUnnamed0;
-                Java_java_lang_reflect_Module_addPackage0;
+                Java_java_lang_Module_defineModule0;
+                Java_java_lang_Module_addReads0;
+                Java_java_lang_Module_addExports0;
+                Java_java_lang_Module_addExportsToAll0;
+                Java_java_lang_Module_addExportsToAllUnnamed0;
+                Java_java_lang_Module_addPackage0;
 
 		Java_jdk_internal_loader_BootLoader_getSystemPackageLocation;
 		Java_jdk_internal_loader_BootLoader_getSystemPackageNames;
--- a/jdk/make/src/classes/build/tools/jigsaw/GenGraphs.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/make/src/classes/build/tools/jigsaw/GenGraphs.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
 package build.tools.jigsaw;
 
 import com.sun.tools.jdeps.ModuleDotGraph;
-import com.sun.tools.jdeps.ModuleDotGraph.DotGraphBuilder;
 
 import java.io.IOException;
 import java.lang.module.Configuration;
@@ -36,10 +35,15 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * Generate the DOT file for a module graph for each module in the JDK
@@ -50,13 +54,19 @@
     public static void main(String[] args) throws Exception {
         Path dir = null;
         boolean spec = false;
+        Properties props = null;
         for (int i=0; i < args.length; i++) {
             String arg = args[i];
             if (arg.equals("--spec")) {
                 spec = true;
+            } else if (arg.equals("--dot-attributes")) {
+                if (i++ == args.length) {
+                    throw new IllegalArgumentException("Missing argument: --dot-attributes option");
+                }
+                props = new Properties();
+                props.load(Files.newInputStream(Paths.get(args[i])));
             } else if (arg.equals("--output")) {
-                i++;
-                dir = i < args.length ? Paths.get(args[i]) : null;
+                dir = ++i < args.length ? Paths.get(args[i]) : null;
             } else if (arg.startsWith("-")) {
                 throw new IllegalArgumentException("Invalid option: " + arg);
             }
@@ -67,11 +77,14 @@
             System.exit(1);
         }
 
-        // setup and configure the dot graph attributes
-        initDotGraphAttributes();
         Files.createDirectories(dir);
-
-        GenGraphs genGraphs = new GenGraphs(dir, spec);
+        ModuleGraphAttributes attributes;
+        if (props != null) {
+            attributes = new ModuleGraphAttributes(props);
+        } else {
+            attributes = new ModuleGraphAttributes();
+        }
+        GenGraphs genGraphs = new GenGraphs(dir, spec, attributes);
 
         // print dot file for each module
         Map<String, Configuration> configurations = new HashMap<>();
@@ -99,49 +112,149 @@
         genGraphs.genDotFiles(configurations);
     }
 
-    static void initDotGraphAttributes() {
-        int h = 1000;
-        DotGraphBuilder.weight("java.se", "java.sql.rowset", h * 10);
-        DotGraphBuilder.weight("java.sql.rowset", "java.sql", h * 10);
-        DotGraphBuilder.weight("java.sql", "java.xml", h * 10);
-        DotGraphBuilder.weight("java.xml", "java.base", h * 10);
+    /**
+     * Custom dot file attributes.
+     */
+    static class ModuleGraphAttributes implements ModuleDotGraph.Attributes {
+        static Map<String, String> DEFAULT_ATTRIBUTES = Map.of(
+            "ranksep", "0.6",
+            "fontsize", "12",
+            "fontcolor", BLACK,
+            "fontname", "DejaVuSans",
+            "arrowsize", "1",
+            "arrowwidth", "2",
+            "arrowcolor", DARK_GRAY,
+            // custom
+            "requiresMandatedColor", LIGHT_GRAY,
+            "javaSubgraphColor", ORANGE,
+            "jdkSubgraphColor", BLUE
+        );
+
+        final Map<String, Integer> weights = new HashMap<>();
+        final List<Set<String>> ranks = new ArrayList<>();
+        final Map<String, String> attrs;
+        ModuleGraphAttributes(Map<String, String> attrs) {
+            int h = 1000;
+            weight("java.se", "java.sql.rowset", h * 10);
+            weight("java.sql.rowset", "java.sql", h * 10);
+            weight("java.sql", "java.xml", h * 10);
+            weight("java.xml", "java.base", h * 10);
+
+            ranks.add(Set.of("java.logging", "java.scripting", "java.xml"));
+            ranks.add(Set.of("java.sql"));
+            ranks.add(Set.of("java.compiler", "java.instrument"));
+            ranks.add(Set.of("java.desktop", "java.management"));
+            ranks.add(Set.of("java.corba", "java.xml.ws"));
+            ranks.add(Set.of("java.xml.bind", "java.xml.ws.annotation"));
+
+            this.attrs = attrs;
+        }
+
+        ModuleGraphAttributes() {
+            this(DEFAULT_ATTRIBUTES);
+        }
+        ModuleGraphAttributes(Properties props) {
+            this(toAttributes(props));
+        }
+
+        @Override
+        public double rankSep() {
+            return Double.valueOf(attrs.get("ranksep"));
+        }
+
+        @Override
+        public int fontSize() {
+            return Integer.valueOf(attrs.get("fontsize"));
+        }
+
+        @Override
+        public String fontName() {
+            return attrs.get("fontname");
+        }
 
-        DotGraphBuilder.sameRankNodes(Set.of("java.logging", "java.scripting", "java.xml"));
-        DotGraphBuilder.sameRankNodes(Set.of("java.sql"));
-        DotGraphBuilder.sameRankNodes(Set.of("java.compiler", "java.instrument"));
-        DotGraphBuilder.sameRankNodes(Set.of("java.desktop", "java.management"));
-        DotGraphBuilder.sameRankNodes(Set.of("java.corba", "java.xml.ws"));
-        DotGraphBuilder.sameRankNodes(Set.of("java.xml.bind", "java.xml.ws.annotation"));
-        DotGraphBuilder.setRankSep(0.7);
-        DotGraphBuilder.setFontSize(12);
-        DotGraphBuilder.setArrowSize(1);
-        DotGraphBuilder.setArrowWidth(2);
+        @Override
+        public String fontColor() {
+            return attrs.get("fontcolor");
+        }
+
+        @Override
+        public int arrowSize() {
+            return Integer.valueOf(attrs.get("arrowsize"));
+        }
+
+        @Override
+        public int arrowWidth() {
+            return Integer.valueOf(attrs.get("arrowwidth"));
+        }
+
+        @Override
+        public String arrowColor() {
+            return attrs.get("arrowcolor");
+        }
+
+        @Override
+        public List<Set<String>> ranks() {
+            return ranks;
+        }
+
+        @Override
+        public String requiresMandatedColor() {
+            return attrs.get("requiresMandatedColor");
+        }
+
+        @Override
+        public String javaSubgraphColor() {
+            return attrs.get("javaSubgraphColor");
+        }
+
+        @Override
+        public String jdkSubgraphColor() {
+            return attrs.get("jdkSubgraphColor");
+        }
+
+        @Override
+        public int weightOf(String s, String t) {
+            int w = weights.getOrDefault(s + ":" + t, 1);
+            if (w != 1)
+                return w;
+            if (s.startsWith("java.") && t.startsWith("java."))
+                return 10;
+            return 1;
+        }
+
+        public void weight(String s, String t, int w) {
+            weights.put(s + ":" + t, w);
+        }
+
+        static Map<String, String> toAttributes(Properties props) {
+            return DEFAULT_ATTRIBUTES.keySet().stream()
+                .collect(Collectors.toMap(Function.identity(),
+                    k -> props.getProperty(k, DEFAULT_ATTRIBUTES.get(k))));
+        }
     }
 
     private final Path dir;
     private final boolean spec;
-    GenGraphs(Path dir, boolean spec) {
+    private final ModuleGraphAttributes attributes;
+    GenGraphs(Path dir, boolean spec, ModuleGraphAttributes attributes) {
         this.dir = dir;
         this.spec = spec;
+        this.attributes = attributes;
     }
 
     void genDotFiles(Map<String, Configuration> configurations) throws IOException {
         ModuleDotGraph dotGraph = new ModuleDotGraph(configurations, spec);
-        dotGraph.genDotFiles(dir);
+        dotGraph.genDotFiles(dir, attributes);
     }
 
+    /**
+     * Returns true for any name if generating graph for non-spec;
+     * otherwise, returns true except "jdk" and name with "jdk.internal." prefix
+     */
     boolean accept(String name, ModuleDescriptor descriptor) {
-        if (!spec) return true;
-
-        if (name.equals("jdk"))
-            return false;
-
-        if (name.equals("java.se") || name.equals("java.se.ee"))
+        if (!spec)
             return true;
 
-        // only the module that has exported API
-        return descriptor.exports().stream()
-                         .filter(e -> !e.isQualified())
-                         .findAny().isPresent();
+        return !name.equals("jdk") && !name.startsWith("jdk.internal.");
     }
-}
\ No newline at end of file
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/jigsaw/javadoc-graphs.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+arrowcolor=#999999
+requiresMandatedColor=#999999
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/taglet/ModuleGraph.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,96 @@
+/*
+ * 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 build.tools.taglet;
+
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+import javax.lang.model.element.Element;
+import com.sun.source.doctree.DocTree;
+import jdk.javadoc.doclet.Taglet;
+import static jdk.javadoc.doclet.Taglet.Location.*;
+
+/**
+ * A block tag to optionally insert a reference to a module graph.
+ */
+public class ModuleGraph implements Taglet {
+    private static final boolean enableModuleGraph =
+        Boolean.getBoolean("enableModuleGraph");
+
+    /** Returns the set of locations in which a taglet may be used. */
+    @Override
+    public Set<Location> getAllowedLocations() {
+        return EnumSet.of(MODULE);
+    }
+
+    @Override
+    public boolean isInlineTag() {
+        return false;
+    }
+
+    @Override
+    public String getName() {
+        return "moduleGraph";
+    }
+
+    @Override
+    public String toString(List<? extends DocTree> tags, Element element) {
+        if (!enableModuleGraph) {
+            return "";
+        }
+
+        String moduleName = element.getSimpleName().toString();
+        String imageFile = moduleName + "-graph.png";
+        int thumbnailHeight = -1;
+        String hoverImage = "";
+        if (!moduleName.equals("java.base")) {
+            thumbnailHeight = 100; // also appears in the stylesheet
+            hoverImage = "<span>"
+                + getImage(moduleName, imageFile, -1, true)
+                + "</span>";
+        }
+        return "<dt>"
+            + "<span class=\"simpleTagLabel\">Module Graph:</span>\n"
+            + "</dt>"
+            + "<dd>"
+            + "<a class=moduleGraph href=\"" + imageFile + "\">"
+            + getImage(moduleName, imageFile, thumbnailHeight, false)
+            + hoverImage
+            + "</a>"
+            + "</dd>";
+    }
+
+    private static final String VERTICAL_ALIGN = "vertical-align:top";
+    private static final String BORDER = "border: solid lightgray 1px;";
+
+    private String getImage(String moduleName, String file, int height, boolean useBorder) {
+        return String.format("<img style=\"%s\" alt=\"Module graph for %s\" src=\"%s\"%s>",
+                             useBorder ? BORDER + " " + VERTICAL_ALIGN : VERTICAL_ALIGN,
+                             moduleName,
+                             file,
+                             (height <= 0 ? "" : " height=\"" + height + "\""));
+    }
+}
--- a/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java	Mon Apr 10 08:31:37 2017 -0700
@@ -50,10 +50,11 @@
     }
 
     /**
-     * Choose a default interface. This method returns an interface that is
-     * both "up" and supports multicast. This method choses an interface in
+     * Choose a default interface. This method returns the first interface that
+     * is both "up" and supports multicast. This method chooses an interface in
      * order of preference:
      * 1. neither loopback nor point to point
+     *    ( prefer interfaces with dual IP support )
      * 2. point to point
      * 3. loopback
      *
@@ -66,32 +67,56 @@
         try {
            nifs = NetworkInterface.getNetworkInterfaces();
         } catch (IOException ignore) {
-            // unable to enumate network interfaces
+            // unable to enumerate network interfaces
             return null;
         }
 
+        NetworkInterface preferred = null;
         NetworkInterface ppp = null;
         NetworkInterface loopback = null;
 
         while (nifs.hasMoreElements()) {
             NetworkInterface ni = nifs.nextElement();
             try {
-                if (ni.isUp() && ni.supportsMulticast()) {
-                    boolean isLoopback = ni.isLoopback();
-                    boolean isPPP = ni.isPointToPoint();
-                    if (!isLoopback && !isPPP) {
-                        // found an interface that is not the loopback or a
-                        // point-to-point interface
+                if (!ni.isUp() || !ni.supportsMulticast())
+                    continue;
+
+                boolean ip4 = false, ip6 = false;
+                Enumeration<InetAddress> addrs = ni.getInetAddresses();
+                while (addrs.hasMoreElements()) {
+                    InetAddress addr = addrs.nextElement();
+                    if (!addr.isAnyLocalAddress()) {
+                        if (addr instanceof Inet4Address) {
+                            ip4 = true;
+                        } else if (addr instanceof Inet6Address) {
+                            ip6 = true;
+                        }
+                    }
+                }
+
+                boolean isLoopback = ni.isLoopback();
+                boolean isPPP = ni.isPointToPoint();
+                if (!isLoopback && !isPPP) {
+                    // found an interface that is not the loopback or a
+                    // point-to-point interface
+                    if (preferred == null) {
+                        preferred = ni;
+                    } else if (ip4 && ip6){
                         return ni;
                     }
-                    if (ppp == null && isPPP)
-                        ppp = ni;
-                    if (loopback == null && isLoopback)
-                        loopback = ni;
                 }
+                if (ppp == null && isPPP)
+                    ppp = ni;
+                if (loopback == null && isLoopback)
+                    loopback = ni;
+
             } catch (IOException skip) { }
         }
 
-        return (ppp != null) ? ppp : loopback;
+        if (preferred != null) {
+            return preferred;
+        } else {
+            return (ppp != null) ? ppp : loopback;
+        }
     }
 }
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESKey.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESKey.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -149,6 +149,7 @@
      * Ensures that the bytes of this key are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.key != null) {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -150,6 +150,7 @@
      * Ensures that the bytes of this key are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.key != null) {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -145,6 +145,7 @@
      * Ensures that the password bytes of this key are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.key != null) {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -267,6 +267,7 @@
      * Ensures that the password bytes of this key are
      * erased when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.passwd != null) {
--- a/jdk/src/java.base/share/classes/java/io/BufferedReader.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/io/BufferedReader.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -297,14 +297,15 @@
 
     /**
      * Reads a line of text.  A line is considered to be terminated by any one
-     * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
-     * followed immediately by a linefeed.
+     * of a line feed ('\n'), a carriage return ('\r'), a carriage return
+     * followed immediately by a line feed, or by reaching the end-of-file
+     * (EOF).
      *
      * @param      ignoreLF  If true, the next '\n' will be skipped
      *
      * @return     A String containing the contents of the line, not including
      *             any line-termination characters, or null if the end of the
-     *             stream has been reached
+     *             stream has been reached without reading any characters
      *
      * @see        java.io.LineNumberReader#readLine()
      *
@@ -375,12 +376,13 @@
 
     /**
      * Reads a line of text.  A line is considered to be terminated by any one
-     * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
-     * followed immediately by a linefeed.
+     * of a line feed ('\n'), a carriage return ('\r'), a carriage return
+     * followed immediately by a line feed, or by reaching the end-of-file
+     * (EOF).
      *
      * @return     A String containing the contents of the line, not including
      *             any line-termination characters, or null if the end of the
-     *             stream has been reached
+     *             stream has been reached without reading any characters
      *
      * @exception  IOException  If an I/O error occurs
      *
--- a/jdk/src/java.base/share/classes/java/io/FileInputStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/io/FileInputStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -413,9 +413,19 @@
      * Ensures that the <code>close</code> method of this file input stream is
      * called when there are no more references to it.
      *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
+     *
      * @exception  IOException  if an I/O error occurs.
      * @see        java.io.FileInputStream#close()
      */
+    @Deprecated(since="9")
     protected void finalize() throws IOException {
         if ((fd != null) &&  (fd != FileDescriptor.in)) {
             /* if fd is shared, the references in FileDescriptor
--- a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -427,9 +427,18 @@
      * <code>close</code> method of this file output stream is
      * called when there are no more references to this stream.
      *
+     * @deprecated The {@code finalize} method has been deprecated.
+     * Subclasses that override {@code finalize} in order to perform cleanup
+     * should be modified to use alternative cleanup mechanisms and
+     * to remove the overriding {@code finalize} method.
+     * When overriding the {@code finalize} method, its implementation must explicitly
+     * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     * See the specification for {@link Object#finalize()} for further
+     * information about migration options.
      * @exception  IOException  if an I/O error occurs.
      * @see        java.io.FileInputStream#close()
      */
+    @Deprecated(since="9")
     protected void finalize() throws IOException {
         if (fd != null) {
             if (fd == FileDescriptor.out || fd == FileDescriptor.err) {
--- a/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java	Mon Apr 10 08:31:37 2017 -0700
@@ -322,7 +322,7 @@
          * Other patterns match or reject class or package name
          * as returned from {@link Class#getName() Class.getName()} and
          * if an optional module name is present
-         * {@link java.lang.reflect.Module#getName() class.getModule().getName()}.
+         * {@link Module#getName() class.getModule().getName()}.
          * Note that for arrays the element type is used in the pattern,
          * not the array type.
          * <ul>
--- a/jdk/src/java.base/share/classes/java/lang/Class.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java	Mon Apr 10 08:31:37 2017 -0700
@@ -43,7 +43,6 @@
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.lang.reflect.Proxy;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
@@ -2561,21 +2560,16 @@
     public InputStream getResourceAsStream(String name) {
         name = resolveName(name);
 
-        Module module = getModule();
-        if (module.isNamed()) {
-            if (Resources.canEncapsulate(name)) {
-                Module caller = Reflection.getCallerClass().getModule();
-                if (caller != module) {
-                    Set<String> packages = module.getDescriptor().packages();
-                    String pn = Resources.toPackageName(name);
-                    if (packages.contains(pn) && !module.isOpen(pn, caller)) {
-                        // resource is in package not open to caller
-                        return null;
-                    }
-                }
+        Module thisModule = getModule();
+        if (thisModule.isNamed()) {
+            // check if resource can be located by caller
+            if (Resources.canEncapsulate(name)
+                && !isOpenToCaller(name, Reflection.getCallerClass())) {
+                return null;
             }
 
-            String mn = module.getName();
+            // resource not encapsulated or in package open to caller
+            String mn = thisModule.getName();
             ClassLoader cl = getClassLoader0();
             try {
 
@@ -2663,20 +2657,16 @@
     public URL getResource(String name) {
         name = resolveName(name);
 
-        Module module = getModule();
-        if (module.isNamed()) {
-            if (Resources.canEncapsulate(name)) {
-                Module caller = Reflection.getCallerClass().getModule();
-                if (caller != module) {
-                    Set<String> packages = module.getDescriptor().packages();
-                    String pn = Resources.toPackageName(name);
-                    if (packages.contains(pn) && !module.isOpen(pn, caller)) {
-                        // resource is in package not open to caller
-                        return null;
-                    }
-                }
+        Module thisModule = getModule();
+        if (thisModule.isNamed()) {
+            // check if resource can be located by caller
+            if (Resources.canEncapsulate(name)
+                && !isOpenToCaller(name, Reflection.getCallerClass())) {
+                return null;
             }
-            String mn = getModule().getName();
+
+            // resource not encapsulated or in package open to caller
+            String mn = thisModule.getName();
             ClassLoader cl = getClassLoader0();
             try {
                 if (cl == null) {
@@ -2698,10 +2688,36 @@
         }
     }
 
+    /**
+     * Returns true if a resource with the given name can be located by the
+     * given caller. All resources in a module can be located by code in
+     * the module. For other callers, then the package needs to be open to
+     * the caller.
+     */
+    private boolean isOpenToCaller(String name, Class<?> caller) {
+        // assert getModule().isNamed();
+        Module thisModule = getModule();
+        Module callerModule = (caller != null) ? caller.getModule() : null;
+        if (callerModule != thisModule) {
+            String pn = Resources.toPackageName(name);
+            if (thisModule.getDescriptor().packages().contains(pn)) {
+                if (callerModule == null && !thisModule.isOpen(pn)) {
+                    // no caller, package not open
+                    return false;
+                }
+                if (!thisModule.isOpen(pn, callerModule)) {
+                    // package not open to caller
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+
     /** protection domain returned when the internal domain is null */
     private static java.security.ProtectionDomain allPermDomain;
 
-
     /**
      * Returns the {@code ProtectionDomain} of this class.  If there is a
      * security manager installed, this method first calls the security
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,7 +31,6 @@
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
-import java.lang.reflect.Module;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.AccessControlContext;
@@ -352,9 +351,7 @@
     private ClassLoader(Void unused, String name, ClassLoader parent) {
         this.name = name;
         this.parent = parent;
-        this.unnamedModule
-            = SharedSecrets.getJavaLangReflectModuleAccess()
-                           .defineUnnamedModule(this);
+        this.unnamedModule = new Module(this);
         if (ParallelLoaders.isRegistered(this.getClass())) {
             parallelLockMap = new ConcurrentHashMap<>();
             package2certs = new ConcurrentHashMap<>();
@@ -2348,6 +2345,7 @@
             this.isBuiltin = isBuiltin;
         }
 
+        @SuppressWarnings("deprecation")
         protected void finalize() {
             synchronized (loadedLibraryNames) {
                 if (fromClass.getClassLoader() != null && loaded) {
--- a/jdk/src/java.base/share/classes/java/lang/Comparable.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Comparable.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -124,7 +124,7 @@
      * {@code sgn(}<i>expression</i>{@code )} designates the mathematical
      * <i>signum</i> function, which is defined to return one of {@code -1},
      * {@code 0}, or {@code 1} according to whether the value of
-     * <i>expression</i> is negative, zero or positive.
+     * <i>expression</i> is negative, zero, or positive, respectively.
      *
      * @param   o the object to be compared.
      * @return  a negative integer, zero, or a positive integer as this object
--- a/jdk/src/java.base/share/classes/java/lang/Enum.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Enum.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, 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
@@ -243,6 +243,7 @@
     /**
      * enum classes cannot have finalize methods.
      */
+    @SuppressWarnings("deprecation")
     protected final void finalize() { }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/LayerInstantiationException.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,79 @@
+/*
+ * 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.  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;
+
+/**
+ * Thrown when creating a {@linkplain ModuleLayer module layer} fails.
+ *
+ * @see ModuleLayer
+ * @since 9
+ * @spec JPMS
+ */
+public class LayerInstantiationException extends RuntimeException {
+    private static final long serialVersionUID = -906239691613568347L;
+
+    /**
+     * Constructs a {@code LayerInstantiationException} with no detail message.
+     */
+    public LayerInstantiationException() {
+    }
+
+    /**
+     * Constructs a {@code LayerInstantiationException} with the given detail
+     * message.
+     *
+     * @param msg
+     *        The detail message; can be {@code null}
+     */
+    public LayerInstantiationException(String msg) {
+        super(msg);
+    }
+
+    /**
+     * Constructs a {@code LayerInstantiationException} with the given cause.
+     *
+     * @param cause
+     *        The cause; can be {@code null}
+     */
+    public LayerInstantiationException(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Constructs a {@code FindException} with the given detail message
+     * and cause.
+     *
+     * @param msg
+     *        The detail message; can be {@code null}
+     * @param cause
+     *        The cause; can be {@code null}
+     */
+    public LayerInstantiationException(String msg, Throwable cause) {
+        super(msg, cause);
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/Module.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,1586 @@
+/*
+ * 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
+ * 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.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleReference;
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleDescriptor.Exports;
+import java.lang.module.ModuleDescriptor.Opens;
+import java.lang.module.ModuleDescriptor.Version;
+import java.lang.module.ResolvedModule;
+import java.lang.reflect.AnnotatedElement;
+import java.net.URI;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import jdk.internal.loader.BuiltinClassLoader;
+import jdk.internal.loader.BootLoader;
+import jdk.internal.misc.JavaLangAccess;
+import jdk.internal.misc.SharedSecrets;
+import jdk.internal.module.ServicesCatalog;
+import jdk.internal.module.Resources;
+import jdk.internal.org.objectweb.asm.AnnotationVisitor;
+import jdk.internal.org.objectweb.asm.Attribute;
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
+import sun.security.util.SecurityConstants;
+
+/**
+ * Represents a run-time module, either {@link #isNamed() named} or unnamed.
+ *
+ * <p> Named modules have a {@link #getName() name} and are constructed by the
+ * Java Virtual Machine when a graph of modules is defined to the Java virtual
+ * machine to create a {@linkplain ModuleLayer module layer}. </p>
+ *
+ * <p> An unnamed module does not have a name. There is an unnamed module for
+ * each {@link ClassLoader ClassLoader}, obtained by invoking its {@link
+ * ClassLoader#getUnnamedModule() getUnnamedModule} method. All types that are
+ * not in a named module are members of their defining class loader's unnamed
+ * module. </p>
+ *
+ * <p> The package names that are parameters or returned by methods defined in
+ * this class are the fully-qualified names of the packages as defined in
+ * section 6.5.3 of <cite>The Java&trade; Language Specification</cite>, for
+ * example, {@code "java.lang"}. </p>
+ *
+ * <p> Unless otherwise specified, passing a {@code null} argument to a method
+ * in this class causes a {@link NullPointerException NullPointerException} to
+ * be thrown. </p>
+ *
+ * @since 9
+ * @spec JPMS
+ * @see Class#getModule()
+ */
+
+public final class Module implements AnnotatedElement {
+
+    // the layer that contains this module, can be null
+    private final ModuleLayer layer;
+
+    // module name and loader, these fields are read by VM
+    private final String name;
+    private final ClassLoader loader;
+
+    // the module descriptor
+    private final ModuleDescriptor descriptor;
+
+
+    /**
+     * Creates a new named Module. The resulting Module will be defined to the
+     * VM but will not read any other modules, will not have any exports setup
+     * and will not be registered in the service catalog.
+     */
+    Module(ModuleLayer layer,
+           ClassLoader loader,
+           ModuleDescriptor descriptor,
+           URI uri)
+    {
+        this.layer = layer;
+        this.name = descriptor.name();
+        this.loader = loader;
+        this.descriptor = descriptor;
+
+        // define module to VM
+
+        boolean isOpen = descriptor.isOpen();
+        Version version = descriptor.version().orElse(null);
+        String vs = Objects.toString(version, null);
+        String loc = Objects.toString(uri, null);
+        String[] packages = descriptor.packages().toArray(new String[0]);
+        defineModule0(this, isOpen, vs, loc, packages);
+    }
+
+
+    /**
+     * Create the unnamed Module for the given ClassLoader.
+     *
+     * @see ClassLoader#getUnnamedModule
+     */
+    Module(ClassLoader loader) {
+        this.layer = null;
+        this.name = null;
+        this.loader = loader;
+        this.descriptor = null;
+    }
+
+
+    /**
+     * Creates a named module but without defining the module to the VM.
+     *
+     * @apiNote This constructor is for VM white-box testing.
+     */
+    Module(ClassLoader loader, ModuleDescriptor descriptor) {
+        this.layer = null;
+        this.name = descriptor.name();
+        this.loader = loader;
+        this.descriptor = descriptor;
+    }
+
+
+
+    /**
+     * Returns {@code true} if this module is a named module.
+     *
+     * @return {@code true} if this is a named module
+     *
+     * @see ClassLoader#getUnnamedModule()
+     */
+    public boolean isNamed() {
+        return name != null;
+    }
+
+    /**
+     * Returns the module name or {@code null} if this module is an unnamed
+     * module.
+     *
+     * @return The module name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the {@code ClassLoader} for this module.
+     *
+     * <p> If there is a security manager then its {@code checkPermission}
+     * method if first called with a {@code RuntimePermission("getClassLoader")}
+     * permission to check that the caller is allowed to get access to the
+     * class loader. </p>
+     *
+     * @return The class loader for this module
+     *
+     * @throws SecurityException
+     *         If denied by the security manager
+     */
+    public ClassLoader getClassLoader() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
+        }
+        return loader;
+    }
+
+    /**
+     * Returns the module descriptor for this module or {@code null} if this
+     * module is an unnamed module.
+     *
+     * @return The module descriptor for this module
+     */
+    public ModuleDescriptor getDescriptor() {
+        return descriptor;
+    }
+
+    /**
+     * Returns the layer that contains this module or {@code null} if this
+     * module is not in a layer.
+     *
+     * A module layer contains named modules and therefore this method always
+     * returns {@code null} when invoked on an unnamed module.
+     *
+     * <p> <a href="reflect/Proxy.html#dynamicmodule">Dynamic modules</a> are
+     * named modules that are generated at runtime. A dynamic module may or may
+     * not be in a module layer. </p>
+     *
+     * @return The module layer that contains this module
+     *
+     * @see java.lang.reflect.Proxy
+     */
+    public ModuleLayer getLayer() {
+        if (isNamed()) {
+            ModuleLayer layer = this.layer;
+            if (layer != null)
+                return layer;
+
+            // special-case java.base as it is created before the boot layer
+            if (loader == null && name.equals("java.base")) {
+                return ModuleLayer.boot();
+            }
+        }
+        return null;
+    }
+
+
+    // --
+
+    // special Module to mean "all unnamed modules"
+    private static final Module ALL_UNNAMED_MODULE = new Module(null);
+
+    // special Module to mean "everyone"
+    private static final Module EVERYONE_MODULE = new Module(null);
+
+    // set contains EVERYONE_MODULE, used when a package is opened or
+    // exported unconditionally
+    private static final Set<Module> EVERYONE_SET = Set.of(EVERYONE_MODULE);
+
+
+    // -- readability --
+
+    // the modules that this module reads
+    private volatile Set<Module> reads;
+
+    // additional module (2nd key) that some module (1st key) reflectively reads
+    private static final WeakPairMap<Module, Module, Boolean> reflectivelyReads
+        = new WeakPairMap<>();
+
+
+    /**
+     * Indicates if this module reads the given module. This method returns
+     * {@code true} if invoked to test if this module reads itself. It also
+     * returns {@code true} if invoked on an unnamed module (as unnamed
+     * modules read all modules).
+     *
+     * @param  other
+     *         The other module
+     *
+     * @return {@code true} if this module reads {@code other}
+     *
+     * @see #addReads(Module)
+     */
+    public boolean canRead(Module other) {
+        Objects.requireNonNull(other);
+
+        // an unnamed module reads all modules
+        if (!this.isNamed())
+            return true;
+
+        // all modules read themselves
+        if (other == this)
+            return true;
+
+        // check if this module reads other
+        if (other.isNamed()) {
+            Set<Module> reads = this.reads; // volatile read
+            if (reads != null && reads.contains(other))
+                return true;
+        }
+
+        // check if this module reads the other module reflectively
+        if (reflectivelyReads.containsKeyPair(this, other))
+            return true;
+
+        // if other is an unnamed module then check if this module reads
+        // all unnamed modules
+        if (!other.isNamed()
+            && reflectivelyReads.containsKeyPair(this, ALL_UNNAMED_MODULE))
+            return true;
+
+        return false;
+    }
+
+    /**
+     * If the caller's module is this module then update this module to read
+     * the given module.
+     *
+     * This method is a no-op if {@code other} is this module (all modules read
+     * themselves), this module is an unnamed module (as unnamed modules read
+     * all modules), or this module already reads {@code other}.
+     *
+     * @implNote <em>Read edges</em> added by this method are <em>weak</em> and
+     * do not prevent {@code other} from being GC'ed when this module is
+     * strongly reachable.
+     *
+     * @param  other
+     *         The other module
+     *
+     * @return this module
+     *
+     * @throws IllegalCallerException
+     *         If this is a named module and the caller's module is not this
+     *         module
+     *
+     * @see #canRead
+     */
+    @CallerSensitive
+    public Module addReads(Module other) {
+        Objects.requireNonNull(other);
+        if (this.isNamed()) {
+            Module caller = getCallerModule(Reflection.getCallerClass());
+            if (caller != this) {
+                throw new IllegalCallerException(caller + " != " + this);
+            }
+            implAddReads(other, true);
+        }
+        return this;
+    }
+
+    /**
+     * Updates this module to read another module.
+     *
+     * @apiNote Used by the --add-reads command line option.
+     */
+    void implAddReads(Module other) {
+        implAddReads(other, true);
+    }
+
+    /**
+     * Updates this module to read all unnamed modules.
+     *
+     * @apiNote Used by the --add-reads command line option.
+     */
+    void implAddReadsAllUnnamed() {
+        implAddReads(Module.ALL_UNNAMED_MODULE, true);
+    }
+
+    /**
+     * Updates this module to read another module without notifying the VM.
+     *
+     * @apiNote This method is for VM white-box testing.
+     */
+    void implAddReadsNoSync(Module other) {
+        implAddReads(other, false);
+    }
+
+    /**
+     * Makes the given {@code Module} readable to this module.
+     *
+     * If {@code syncVM} is {@code true} then the VM is notified.
+     */
+    private void implAddReads(Module other, boolean syncVM) {
+        Objects.requireNonNull(other);
+        if (!canRead(other)) {
+            // update VM first, just in case it fails
+            if (syncVM) {
+                if (other == ALL_UNNAMED_MODULE) {
+                    addReads0(this, null);
+                } else {
+                    addReads0(this, other);
+                }
+            }
+
+            // add reflective read
+            reflectivelyReads.putIfAbsent(this, other, Boolean.TRUE);
+        }
+    }
+
+
+    // -- exported and open packages --
+
+    // the packages are open to other modules, can be null
+    // if the value contains EVERYONE_MODULE then the package is open to all
+    private volatile Map<String, Set<Module>> openPackages;
+
+    // the packages that are exported, can be null
+    // if the value contains EVERYONE_MODULE then the package is exported to all
+    private volatile Map<String, Set<Module>> exportedPackages;
+
+    // additional exports or opens added at run-time
+    // this module (1st key), other module (2nd key)
+    // (package name, open?) (value)
+    private static final WeakPairMap<Module, Module, Map<String, Boolean>>
+        reflectivelyExports = new WeakPairMap<>();
+
+
+    /**
+     * Returns {@code true} if this module exports the given package to at
+     * least the given module.
+     *
+     * <p> This method returns {@code true} if invoked to test if a package in
+     * this module is exported to itself. It always returns {@code true} when
+     * invoked on an unnamed module. A package that is {@link #isOpen open} to
+     * the given module is considered exported to that module at run-time and
+     * so this method returns {@code true} if the package is open to the given
+     * module. </p>
+     *
+     * <p> This method does not check if the given module reads this module. </p>
+     *
+     * @param  pn
+     *         The package name
+     * @param  other
+     *         The other module
+     *
+     * @return {@code true} if this module exports the package to at least the
+     *         given module
+     *
+     * @see ModuleDescriptor#exports()
+     * @see #addExports(String,Module)
+     */
+    public boolean isExported(String pn, Module other) {
+        Objects.requireNonNull(pn);
+        Objects.requireNonNull(other);
+        return implIsExportedOrOpen(pn, other, /*open*/false);
+    }
+
+    /**
+     * Returns {@code true} if this module has <em>opened</em> a package to at
+     * least the given module.
+     *
+     * <p> This method returns {@code true} if invoked to test if a package in
+     * this module is open to itself. It returns {@code true} when invoked on an
+     * {@link ModuleDescriptor#isOpen open} module with a package in the module.
+     * It always returns {@code true} when invoked on an unnamed module. </p>
+     *
+     * <p> This method does not check if the given module reads this module. </p>
+     *
+     * @param  pn
+     *         The package name
+     * @param  other
+     *         The other module
+     *
+     * @return {@code true} if this module has <em>opened</em> the package
+     *         to at least the given module
+     *
+     * @see ModuleDescriptor#opens()
+     * @see #addOpens(String,Module)
+     * @see AccessibleObject#setAccessible(boolean)
+     * @see java.lang.invoke.MethodHandles#privateLookupIn
+     */
+    public boolean isOpen(String pn, Module other) {
+        Objects.requireNonNull(pn);
+        Objects.requireNonNull(other);
+        return implIsExportedOrOpen(pn, other, /*open*/true);
+    }
+
+    /**
+     * Returns {@code true} if this module exports the given package
+     * unconditionally.
+     *
+     * <p> This method always returns {@code true} when invoked on an unnamed
+     * module. A package that is {@link #isOpen(String) opened} unconditionally
+     * is considered exported unconditionally at run-time and so this method
+     * returns {@code true} if the package is opened unconditionally. </p>
+     *
+     * <p> This method does not check if the given module reads this module. </p>
+     *
+     * @param  pn
+     *         The package name
+     *
+     * @return {@code true} if this module exports the package unconditionally
+     *
+     * @see ModuleDescriptor#exports()
+     */
+    public boolean isExported(String pn) {
+        Objects.requireNonNull(pn);
+        return implIsExportedOrOpen(pn, EVERYONE_MODULE, /*open*/false);
+    }
+
+    /**
+     * Returns {@code true} if this module has <em>opened</em> a package
+     * unconditionally.
+     *
+     * <p> This method always returns {@code true} when invoked on an unnamed
+     * module. Additionally, it always returns {@code true} when invoked on an
+     * {@link ModuleDescriptor#isOpen open} module with a package in the
+     * module. </p>
+     *
+     * <p> This method does not check if the given module reads this module. </p>
+     *
+     * @param  pn
+     *         The package name
+     *
+     * @return {@code true} if this module has <em>opened</em> the package
+     *         unconditionally
+     *
+     * @see ModuleDescriptor#opens()
+     */
+    public boolean isOpen(String pn) {
+        Objects.requireNonNull(pn);
+        return implIsExportedOrOpen(pn, EVERYONE_MODULE, /*open*/true);
+    }
+
+
+    /**
+     * Returns {@code true} if this module exports or opens the given package
+     * to the given module. If the other module is {@code EVERYONE_MODULE} then
+     * this method tests if the package is exported or opened unconditionally.
+     */
+    private boolean implIsExportedOrOpen(String pn, Module other, boolean open) {
+        // all packages in unnamed modules are open
+        if (!isNamed())
+            return true;
+
+        // all packages are exported/open to self
+        if (other == this && containsPackage(pn))
+            return true;
+
+        // all packages in open and automatic modules are open
+        if (descriptor.isOpen() || descriptor.isAutomatic())
+            return containsPackage(pn);
+
+        // exported/opened via module declaration/descriptor
+        if (isStaticallyExportedOrOpen(pn, other, open))
+            return true;
+
+        // exported via addExports/addOpens
+        if (isReflectivelyExportedOrOpen(pn, other, open))
+            return true;
+
+        // not exported or open to other
+        return false;
+    }
+
+    /**
+     * Returns {@code true} if this module exports or opens a package to
+     * the given module via its module declaration.
+     */
+    private boolean isStaticallyExportedOrOpen(String pn, Module other, boolean open) {
+        // package is open to everyone or <other>
+        Map<String, Set<Module>> openPackages = this.openPackages;
+        if (openPackages != null) {
+            Set<Module> targets = openPackages.get(pn);
+            if (targets != null) {
+                if (targets.contains(EVERYONE_MODULE))
+                    return true;
+                if (other != EVERYONE_MODULE && targets.contains(other))
+                    return true;
+            }
+        }
+
+        if (!open) {
+            // package is exported to everyone or <other>
+            Map<String, Set<Module>> exportedPackages = this.exportedPackages;
+            if (exportedPackages != null) {
+                Set<Module> targets = exportedPackages.get(pn);
+                if (targets != null) {
+                    if (targets.contains(EVERYONE_MODULE))
+                        return true;
+                    if (other != EVERYONE_MODULE && targets.contains(other))
+                        return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+
+    /**
+     * Returns {@code true} if this module reflectively exports or opens given
+     * package package to the given module.
+     */
+    private boolean isReflectivelyExportedOrOpen(String pn, Module other, boolean open) {
+        // exported or open to all modules
+        Map<String, Boolean> exports = reflectivelyExports.get(this, EVERYONE_MODULE);
+        if (exports != null) {
+            Boolean b = exports.get(pn);
+            if (b != null) {
+                boolean isOpen = b.booleanValue();
+                if (!open || isOpen) return true;
+            }
+        }
+
+        if (other != EVERYONE_MODULE) {
+
+            // exported or open to other
+            exports = reflectivelyExports.get(this, other);
+            if (exports != null) {
+                Boolean b = exports.get(pn);
+                if (b != null) {
+                    boolean isOpen = b.booleanValue();
+                    if (!open || isOpen) return true;
+                }
+            }
+
+            // other is an unnamed module && exported or open to all unnamed
+            if (!other.isNamed()) {
+                exports = reflectivelyExports.get(this, ALL_UNNAMED_MODULE);
+                if (exports != null) {
+                    Boolean b = exports.get(pn);
+                    if (b != null) {
+                        boolean isOpen = b.booleanValue();
+                        if (!open || isOpen) return true;
+                    }
+                }
+            }
+
+        }
+
+        return false;
+    }
+
+
+    /**
+     * If the caller's module is this module then update this module to export
+     * the given package to the given module.
+     *
+     * <p> This method has no effect if the package is already exported (or
+     * <em>open</em>) to the given module. </p>
+     *
+     * @apiNote As specified in section 5.4.3 of the <cite>The Java&trade;
+     * Virtual Machine Specification </cite>, if an attempt to resolve a
+     * symbolic reference fails because of a linkage error, then subsequent
+     * attempts to resolve the reference always fail with the same error that
+     * was thrown as a result of the initial resolution attempt.
+     *
+     * @param  pn
+     *         The package name
+     * @param  other
+     *         The module
+     *
+     * @return this module
+     *
+     * @throws IllegalArgumentException
+     *         If {@code pn} is {@code null}, or this is a named module and the
+     *         package {@code pn} is not a package in this module
+     * @throws IllegalCallerException
+     *         If this is a named module and the caller's module is not this
+     *         module
+     *
+     * @jvms 5.4.3 Resolution
+     * @see #isExported(String,Module)
+     */
+    @CallerSensitive
+    public Module addExports(String pn, Module other) {
+        if (pn == null)
+            throw new IllegalArgumentException("package is null");
+        Objects.requireNonNull(other);
+
+        if (isNamed()) {
+            Module caller = getCallerModule(Reflection.getCallerClass());
+            if (caller != this) {
+                throw new IllegalCallerException(caller + " != " + this);
+            }
+            implAddExportsOrOpens(pn, other, /*open*/false, /*syncVM*/true);
+        }
+
+        return this;
+    }
+
+    /**
+     * If this module has <em>opened</em> a package to at least the caller
+     * module then update this module to open the package to the given module.
+     * Opening a package with this method allows all types in the package,
+     * and all their members, not just public types and their public members,
+     * to be reflected on by the given module when using APIs that support
+     * private access or a way to bypass or suppress default Java language
+     * access control checks.
+     *
+     * <p> This method has no effect if the package is already <em>open</em>
+     * to the given module. </p>
+     *
+     * @param  pn
+     *         The package name
+     * @param  other
+     *         The module
+     *
+     * @return this module
+     *
+     * @throws IllegalArgumentException
+     *         If {@code pn} is {@code null}, or this is a named module and the
+     *         package {@code pn} is not a package in this module
+     * @throws IllegalCallerException
+     *         If this is a named module and this module has not opened the
+     *         package to at least the caller's module
+     *
+     * @see #isOpen(String,Module)
+     * @see AccessibleObject#setAccessible(boolean)
+     * @see java.lang.invoke.MethodHandles#privateLookupIn
+     */
+    @CallerSensitive
+    public Module addOpens(String pn, Module other) {
+        if (pn == null)
+            throw new IllegalArgumentException("package is null");
+        Objects.requireNonNull(other);
+
+        if (isNamed()) {
+            Module caller = getCallerModule(Reflection.getCallerClass());
+            if (caller != this && (caller == null || !isOpen(pn, caller)))
+                throw new IllegalCallerException(pn + " is not open to " + caller);
+            implAddExportsOrOpens(pn, other, /*open*/true, /*syncVM*/true);
+        }
+
+        return this;
+    }
+
+
+    /**
+     * Updates this module to export a package unconditionally.
+     *
+     * @apiNote This method is for JDK tests only.
+     */
+    void implAddExports(String pn) {
+        implAddExportsOrOpens(pn, Module.EVERYONE_MODULE, false, true);
+    }
+
+    /**
+     * Updates this module to export a package to another module.
+     *
+     * @apiNote Used by Instrumentation::redefineModule and --add-exports
+     */
+    void implAddExports(String pn, Module other) {
+        implAddExportsOrOpens(pn, other, false, true);
+    }
+
+    /**
+     * Updates this module to export a package to all unnamed modules.
+     *
+     * @apiNote Used by the --add-exports command line option.
+     */
+    void implAddExportsToAllUnnamed(String pn) {
+        implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, false, true);
+    }
+
+    /**
+     * Updates this export to export a package unconditionally without
+     * notifying the VM.
+     *
+     * @apiNote This method is for VM white-box testing.
+     */
+    void implAddExportsNoSync(String pn) {
+        implAddExportsOrOpens(pn.replace('/', '.'), Module.EVERYONE_MODULE, false, false);
+    }
+
+    /**
+     * Updates a module to export a package to another module without
+     * notifying the VM.
+     *
+     * @apiNote This method is for VM white-box testing.
+     */
+    void implAddExportsNoSync(String pn, Module other) {
+        implAddExportsOrOpens(pn.replace('/', '.'), other, false, false);
+    }
+
+    /**
+     * Updates this module to open a package unconditionally.
+     *
+     * @apiNote This method is for JDK tests only.
+     */
+    void implAddOpens(String pn) {
+        implAddExportsOrOpens(pn, Module.EVERYONE_MODULE, true, true);
+    }
+
+    /**
+     * Updates this module to open a package to another module.
+     *
+     * @apiNote Used by Instrumentation::redefineModule and --add-opens
+     */
+    void implAddOpens(String pn, Module other) {
+        implAddExportsOrOpens(pn, other, true, true);
+    }
+
+    /**
+     * Updates this module to export a package to all unnamed modules.
+     *
+     * @apiNote Used by the --add-opens command line option.
+     */
+    void implAddOpensToAllUnnamed(String pn) {
+        implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, true, true);
+    }
+
+
+    /**
+     * Updates a module to export or open a module to another module.
+     *
+     * If {@code syncVM} is {@code true} then the VM is notified.
+     */
+    private void implAddExportsOrOpens(String pn,
+                                       Module other,
+                                       boolean open,
+                                       boolean syncVM) {
+        Objects.requireNonNull(other);
+        Objects.requireNonNull(pn);
+
+        // all packages are open in unnamed, open, and automatic modules
+        if (!isNamed() || descriptor.isOpen() || descriptor.isAutomatic())
+            return;
+
+        // nothing to do if already exported/open to other
+        if (implIsExportedOrOpen(pn, other, open))
+            return;
+
+        // can only export a package in the module
+        if (!containsPackage(pn)) {
+            throw new IllegalArgumentException("package " + pn
+                                               + " not in contents");
+        }
+
+        // update VM first, just in case it fails
+        if (syncVM) {
+            if (other == EVERYONE_MODULE) {
+                addExportsToAll0(this, pn);
+            } else if (other == ALL_UNNAMED_MODULE) {
+                addExportsToAllUnnamed0(this, pn);
+            } else {
+                addExports0(this, pn, other);
+            }
+        }
+
+        // add package name to reflectivelyExports if absent
+        Map<String, Boolean> map = reflectivelyExports
+            .computeIfAbsent(this, other,
+                             (m1, m2) -> new ConcurrentHashMap<>());
+
+        if (open) {
+            map.put(pn, Boolean.TRUE);  // may need to promote from FALSE to TRUE
+        } else {
+            map.putIfAbsent(pn, Boolean.FALSE);
+        }
+    }
+
+
+    // -- services --
+
+    // additional service type (2nd key) that some module (1st key) uses
+    private static final WeakPairMap<Module, Class<?>, Boolean> reflectivelyUses
+        = new WeakPairMap<>();
+
+    /**
+     * If the caller's module is this module then update this module to add a
+     * service dependence on the given service type. This method is intended
+     * for use by frameworks that invoke {@link java.util.ServiceLoader
+     * ServiceLoader} on behalf of other modules or where the framework is
+     * passed a reference to the service type by other code. This method is
+     * a no-op when invoked on an unnamed module or an automatic module.
+     *
+     * <p> This method does not cause {@link Configuration#resolveAndBind
+     * resolveAndBind} to be re-run. </p>
+     *
+     * @param  service
+     *         The service type
+     *
+     * @return this module
+     *
+     * @throws IllegalCallerException
+     *         If this is a named module and the caller's module is not this
+     *         module
+     *
+     * @see #canUse(Class)
+     * @see ModuleDescriptor#uses()
+     */
+    @CallerSensitive
+    public Module addUses(Class<?> service) {
+        Objects.requireNonNull(service);
+
+        if (isNamed() && !descriptor.isAutomatic()) {
+            Module caller = getCallerModule(Reflection.getCallerClass());
+            if (caller != this) {
+                throw new IllegalCallerException(caller + " != " + this);
+            }
+            implAddUses(service);
+        }
+
+        return this;
+    }
+
+    /**
+     * Update this module to add a service dependence on the given service
+     * type.
+     */
+    void implAddUses(Class<?> service) {
+        if (!canUse(service)) {
+            reflectivelyUses.putIfAbsent(this, service, Boolean.TRUE);
+        }
+    }
+
+
+    /**
+     * Indicates if this module has a service dependence on the given service
+     * type. This method always returns {@code true} when invoked on an unnamed
+     * module or an automatic module.
+     *
+     * @param  service
+     *         The service type
+     *
+     * @return {@code true} if this module uses service type {@code st}
+     *
+     * @see #addUses(Class)
+     */
+    public boolean canUse(Class<?> service) {
+        Objects.requireNonNull(service);
+
+        if (!isNamed())
+            return true;
+
+        if (descriptor.isAutomatic())
+            return true;
+
+        // uses was declared
+        if (descriptor.uses().contains(service.getName()))
+            return true;
+
+        // uses added via addUses
+        return reflectivelyUses.containsKeyPair(this, service);
+    }
+
+
+
+    // -- packages --
+
+    // Additional packages that are added to the module at run-time.
+    private volatile Map<String, Boolean> extraPackages;
+
+    private boolean containsPackage(String pn) {
+        if (descriptor.packages().contains(pn))
+            return true;
+        Map<String, Boolean> extraPackages = this.extraPackages;
+        if (extraPackages != null && extraPackages.containsKey(pn))
+            return true;
+        return false;
+    }
+
+
+    /**
+     * Returns the set of package names for the packages in this module.
+     *
+     * <p> For named modules, the returned set contains an element for each
+     * package in the module. </p>
+     *
+     * <p> For unnamed modules, this method is the equivalent to invoking the
+     * {@link ClassLoader#getDefinedPackages() getDefinedPackages} method of
+     * this module's class loader and returning the set of package names. </p>
+     *
+     * @return the set of the package names of the packages in this module
+     */
+    public Set<String> getPackages() {
+        if (isNamed()) {
+
+            Set<String> packages = descriptor.packages();
+            Map<String, Boolean> extraPackages = this.extraPackages;
+            if (extraPackages == null) {
+                return packages;
+            } else {
+                return Stream.concat(packages.stream(),
+                                     extraPackages.keySet().stream())
+                        .collect(Collectors.toSet());
+            }
+
+        } else {
+            // unnamed module
+            Stream<Package> packages;
+            if (loader == null) {
+                packages = BootLoader.packages();
+            } else {
+                packages = SharedSecrets.getJavaLangAccess().packages(loader);
+            }
+            return packages.map(Package::getName).collect(Collectors.toSet());
+        }
+    }
+
+    /**
+     * Add a package to this module without notifying the VM.
+     *
+     * @apiNote This method is VM white-box testing.
+     */
+    void implAddPackageNoSync(String pn) {
+        implAddPackage(pn.replace('/', '.'), false);
+    }
+
+    /**
+     * Add a package to this module.
+     *
+     * If {@code syncVM} is {@code true} then the VM is notified. This method is
+     * a no-op if this is an unnamed module or the module already contains the
+     * package.
+     *
+     * @throws IllegalArgumentException if the package name is not legal
+     * @throws IllegalStateException if the package is defined to another module
+     */
+    private void implAddPackage(String pn, boolean syncVM) {
+        // no-op if unnamed module
+        if (!isNamed())
+            return;
+
+        // no-op if module contains the package
+        if (containsPackage(pn))
+            return;
+
+        // check package name is legal for named modules
+        if (pn.isEmpty())
+            throw new IllegalArgumentException("Cannot add <unnamed> package");
+        for (int i=0; i<pn.length(); i++) {
+            char c = pn.charAt(i);
+            if (c == '/' || c == ';' || c == '[') {
+                throw new IllegalArgumentException("Illegal character: " + c);
+            }
+        }
+
+        // create extraPackages if needed
+        Map<String, Boolean> extraPackages = this.extraPackages;
+        if (extraPackages == null) {
+            synchronized (this) {
+                extraPackages = this.extraPackages;
+                if (extraPackages == null)
+                    this.extraPackages = extraPackages = new ConcurrentHashMap<>();
+            }
+        }
+
+        // update VM first in case it fails. This is a no-op if another thread
+        // beats us to add the package first
+        if (syncVM) {
+            // throws IllegalStateException if defined to another module
+            addPackage0(this, pn);
+            if (descriptor.isOpen() || descriptor.isAutomatic()) {
+                addExportsToAll0(this, pn);
+            }
+        }
+        extraPackages.putIfAbsent(pn, Boolean.TRUE);
+    }
+
+
+    // -- creating Module objects --
+
+    /**
+     * Defines all module in a configuration to the runtime.
+     *
+     * @return a map of module name to runtime {@code Module}
+     *
+     * @throws IllegalArgumentException
+     *         If defining any of the modules to the VM fails
+     */
+    static Map<String, Module> defineModules(Configuration cf,
+                                             Function<String, ClassLoader> clf,
+                                             ModuleLayer layer)
+    {
+        Map<String, Module> nameToModule = new HashMap<>();
+        Map<String, ClassLoader> moduleToLoader = new HashMap<>();
+
+        boolean isBootLayer = (ModuleLayer.boot() == null);
+        Set<ClassLoader> loaders = new HashSet<>();
+
+        // map each module to a class loader
+        for (ResolvedModule resolvedModule : cf.modules()) {
+            String name = resolvedModule.name();
+            ClassLoader loader = clf.apply(name);
+            if (loader != null) {
+                moduleToLoader.put(name, loader);
+                loaders.add(loader);
+            } else if (!isBootLayer) {
+                throw new IllegalArgumentException("loader can't be 'null'");
+            }
+        }
+
+        // define each module in the configuration to the VM
+        for (ResolvedModule resolvedModule : cf.modules()) {
+            ModuleReference mref = resolvedModule.reference();
+            ModuleDescriptor descriptor = mref.descriptor();
+            String name = descriptor.name();
+            URI uri = mref.location().orElse(null);
+            ClassLoader loader = moduleToLoader.get(resolvedModule.name());
+            Module m;
+            if (loader == null && isBootLayer && name.equals("java.base")) {
+                // java.base is already defined to the VM
+                m = Object.class.getModule();
+            } else {
+                m = new Module(layer, loader, descriptor, uri);
+            }
+            nameToModule.put(name, m);
+            moduleToLoader.put(name, loader);
+        }
+
+        // setup readability and exports
+        for (ResolvedModule resolvedModule : cf.modules()) {
+            ModuleReference mref = resolvedModule.reference();
+            ModuleDescriptor descriptor = mref.descriptor();
+
+            String mn = descriptor.name();
+            Module m = nameToModule.get(mn);
+            assert m != null;
+
+            // reads
+            Set<Module> reads = new HashSet<>();
+
+            // name -> source Module when in parent layer
+            Map<String, Module> nameToSource = Collections.emptyMap();
+
+            for (ResolvedModule other : resolvedModule.reads()) {
+                Module m2 = null;
+                if (other.configuration() == cf) {
+                    // this configuration
+                    m2 = nameToModule.get(other.name());
+                    assert m2 != null;
+                } else {
+                    // parent layer
+                    for (ModuleLayer parent: layer.parents()) {
+                        m2 = findModule(parent, other);
+                        if (m2 != null)
+                            break;
+                    }
+                    assert m2 != null;
+                    if (nameToSource.isEmpty())
+                        nameToSource = new HashMap<>();
+                    nameToSource.put(other.name(), m2);
+                }
+                reads.add(m2);
+
+                // update VM view
+                addReads0(m, m2);
+            }
+            m.reads = reads;
+
+            // automatic modules read all unnamed modules
+            if (descriptor.isAutomatic()) {
+                m.implAddReads(ALL_UNNAMED_MODULE, true);
+            }
+
+            // exports and opens
+            initExportsAndOpens(m, nameToSource, nameToModule, layer.parents());
+        }
+
+        // register the modules in the boot layer
+        if (isBootLayer) {
+            for (ResolvedModule resolvedModule : cf.modules()) {
+                ModuleReference mref = resolvedModule.reference();
+                ModuleDescriptor descriptor = mref.descriptor();
+                if (!descriptor.provides().isEmpty()) {
+                    String name = descriptor.name();
+                    Module m = nameToModule.get(name);
+                    ClassLoader loader = moduleToLoader.get(name);
+                    ServicesCatalog catalog;
+                    if (loader == null) {
+                        catalog = BootLoader.getServicesCatalog();
+                    } else {
+                        catalog = ServicesCatalog.getServicesCatalog(loader);
+                    }
+                    catalog.register(m);
+                }
+            }
+        }
+
+        // record that there is a layer with modules defined to the class loader
+        for (ClassLoader loader : loaders) {
+            layer.bindToLoader(loader);
+        }
+
+        return nameToModule;
+    }
+
+
+    /**
+     * Find the runtime Module corresponding to the given ResolvedModule
+     * in the given parent layer (or its parents).
+     */
+    private static Module findModule(ModuleLayer parent,
+                                     ResolvedModule resolvedModule) {
+        Configuration cf = resolvedModule.configuration();
+        String dn = resolvedModule.name();
+        return parent.layers()
+                .filter(l -> l.configuration() == cf)
+                .findAny()
+                .map(layer -> {
+                    Optional<Module> om = layer.findModule(dn);
+                    assert om.isPresent() : dn + " not found in layer";
+                    Module m = om.get();
+                    assert m.getLayer() == layer : m + " not in expected layer";
+                    return m;
+                })
+                .orElse(null);
+    }
+
+
+    /**
+     * Initialize the maps of exported and open packages for module m.
+     */
+    private static void initExportsAndOpens(Module m,
+                                            Map<String, Module> nameToSource,
+                                            Map<String, Module> nameToModule,
+                                            List<ModuleLayer> parents) {
+        // The VM doesn't special case open or automatic modules so need to
+        // export all packages
+        ModuleDescriptor descriptor = m.getDescriptor();
+        if (descriptor.isOpen() || descriptor.isAutomatic()) {
+            assert descriptor.opens().isEmpty();
+            for (String source : descriptor.packages()) {
+                addExportsToAll0(m, source);
+            }
+            return;
+        }
+
+        Map<String, Set<Module>> openPackages = new HashMap<>();
+        Map<String, Set<Module>> exportedPackages = new HashMap<>();
+
+        // process the open packages first
+        for (Opens opens : descriptor.opens()) {
+            String source = opens.source();
+
+            if (opens.isQualified()) {
+                // qualified opens
+                Set<Module> targets = new HashSet<>();
+                for (String target : opens.targets()) {
+                    Module m2 = findModule(target, nameToSource, nameToModule, parents);
+                    if (m2 != null) {
+                        addExports0(m, source, m2);
+                        targets.add(m2);
+                    }
+                }
+                if (!targets.isEmpty()) {
+                    openPackages.put(source, targets);
+                }
+            } else {
+                // unqualified opens
+                addExportsToAll0(m, source);
+                openPackages.put(source, EVERYONE_SET);
+            }
+        }
+
+        // next the exports, skipping exports when the package is open
+        for (Exports exports : descriptor.exports()) {
+            String source = exports.source();
+
+            // skip export if package is already open to everyone
+            Set<Module> openToTargets = openPackages.get(source);
+            if (openToTargets != null && openToTargets.contains(EVERYONE_MODULE))
+                continue;
+
+            if (exports.isQualified()) {
+                // qualified exports
+                Set<Module> targets = new HashSet<>();
+                for (String target : exports.targets()) {
+                    Module m2 = findModule(target, nameToSource, nameToModule, parents);
+                    if (m2 != null) {
+                        // skip qualified export if already open to m2
+                        if (openToTargets == null || !openToTargets.contains(m2)) {
+                            addExports0(m, source, m2);
+                            targets.add(m2);
+                        }
+                    }
+                }
+                if (!targets.isEmpty()) {
+                    exportedPackages.put(source, targets);
+                }
+
+            } else {
+                // unqualified exports
+                addExportsToAll0(m, source);
+                exportedPackages.put(source, EVERYONE_SET);
+            }
+        }
+
+        if (!openPackages.isEmpty())
+            m.openPackages = openPackages;
+        if (!exportedPackages.isEmpty())
+            m.exportedPackages = exportedPackages;
+    }
+
+    /**
+     * Find the runtime Module with the given name. The module name is the
+     * name of a target module in a qualified exports or opens directive.
+     *
+     * @param target The target module to find
+     * @param nameToSource The modules in parent layers that are read
+     * @param nameToModule The modules in the layer under construction
+     * @param parents The parent layers
+     */
+    private static Module findModule(String target,
+                                     Map<String, Module> nameToSource,
+                                     Map<String, Module> nameToModule,
+                                     List<ModuleLayer> parents) {
+        Module m = nameToSource.get(target);
+        if (m == null) {
+            m = nameToModule.get(target);
+            if (m == null) {
+                for (ModuleLayer parent : parents) {
+                    m = parent.findModule(target).orElse(null);
+                    if (m != null) break;
+                }
+            }
+        }
+        return m;
+    }
+
+
+    // -- annotations --
+
+    /**
+     * {@inheritDoc}
+     * This method returns {@code null} when invoked on an unnamed module.
+     */
+    @Override
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        return moduleInfoClass().getDeclaredAnnotation(annotationClass);
+    }
+
+    /**
+     * {@inheritDoc}
+     * This method returns an empty array when invoked on an unnamed module.
+     */
+    @Override
+    public Annotation[] getAnnotations() {
+        return moduleInfoClass().getAnnotations();
+    }
+
+    /**
+     * {@inheritDoc}
+     * This method returns an empty array when invoked on an unnamed module.
+     */
+    @Override
+    public Annotation[] getDeclaredAnnotations() {
+        return moduleInfoClass().getDeclaredAnnotations();
+    }
+
+    // cached class file with annotations
+    private volatile Class<?> moduleInfoClass;
+
+    private Class<?> moduleInfoClass() {
+        Class<?> clazz = this.moduleInfoClass;
+        if (clazz != null)
+            return clazz;
+
+        synchronized (this) {
+            clazz = this.moduleInfoClass;
+            if (clazz == null) {
+                if (isNamed()) {
+                    PrivilegedAction<Class<?>> pa = this::loadModuleInfoClass;
+                    clazz = AccessController.doPrivileged(pa);
+                }
+                if (clazz == null) {
+                    class DummyModuleInfo { }
+                    clazz = DummyModuleInfo.class;
+                }
+                this.moduleInfoClass = clazz;
+            }
+            return clazz;
+        }
+    }
+
+    private Class<?> loadModuleInfoClass() {
+        Class<?> clazz = null;
+        try (InputStream in = getResourceAsStream("module-info.class")) {
+            if (in != null)
+                clazz = loadModuleInfoClass(in);
+        } catch (Exception ignore) { }
+        return clazz;
+    }
+
+    /**
+     * Loads module-info.class as a package-private interface in a class loader
+     * that is a child of this module's class loader.
+     */
+    private Class<?> loadModuleInfoClass(InputStream in) throws IOException {
+        final String MODULE_INFO = "module-info";
+
+        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS
+                                         + ClassWriter.COMPUTE_FRAMES);
+
+        ClassVisitor cv = new ClassVisitor(Opcodes.ASM5, cw) {
+            @Override
+            public void visit(int version,
+                              int access,
+                              String name,
+                              String signature,
+                              String superName,
+                              String[] interfaces) {
+                cw.visit(version,
+                        Opcodes.ACC_INTERFACE
+                            + Opcodes.ACC_ABSTRACT
+                            + Opcodes.ACC_SYNTHETIC,
+                        MODULE_INFO,
+                        null,
+                        "java/lang/Object",
+                        null);
+            }
+            @Override
+            public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+                // keep annotations
+                return super.visitAnnotation(desc, visible);
+            }
+            @Override
+            public void visitAttribute(Attribute attr) {
+                // drop non-annotation attributes
+            }
+        };
+
+        ClassReader cr = new ClassReader(in);
+        cr.accept(cv, 0);
+        byte[] bytes = cw.toByteArray();
+
+        ClassLoader cl = new ClassLoader(loader) {
+            @Override
+            protected Class<?> findClass(String cn)throws ClassNotFoundException {
+                if (cn.equals(MODULE_INFO)) {
+                    return super.defineClass(cn, bytes, 0, bytes.length);
+                } else {
+                    throw new ClassNotFoundException(cn);
+                }
+            }
+        };
+
+        try {
+            return cl.loadClass(MODULE_INFO);
+        } catch (ClassNotFoundException e) {
+            throw new InternalError(e);
+        }
+    }
+
+
+    // -- misc --
+
+
+    /**
+     * Returns an input stream for reading a resource in this module.
+     * The {@code name} parameter is a {@code '/'}-separated path name that
+     * identifies the resource. As with {@link Class#getResourceAsStream
+     * Class.getResourceAsStream}, this method delegates to the module's class
+     * loader {@link ClassLoader#findResource(String,String)
+     * findResource(String,String)} method, invoking it with the module name
+     * (or {@code null} when the module is unnamed) and the name of the
+     * resource. If the resource name has a leading slash then it is dropped
+     * before delegation.
+     *
+     * <p> A resource in a named module may be <em>encapsulated</em> so that
+     * it cannot be located by code in other modules. Whether a resource can be
+     * located or not is determined as follows: </p>
+     *
+     * <ul>
+     *     <li> If the resource name ends with  "{@code .class}" then it is not
+     *     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>
+     * </ul>
+     *
+     * <p> In the above, the <em>package name</em> for a resource is derived
+     * from the subsequence of characters that precedes the last {@code '/'} in
+     * the name and then replacing each {@code '/'} character in the subsequence
+     * with {@code '.'}. A leading slash is ignored when deriving the package
+     * name. As an example, the package name derived for a resource named
+     * "{@code a/b/c/foo.properties}" is "{@code a.b.c}". A resource name
+     * with the name "{@code META-INF/MANIFEST.MF}" is never encapsulated
+     * because "{@code META-INF}" is not a legal package name. </p>
+     *
+     * <p> This method returns {@code null} if the resource is not in this
+     * module, the resource is encapsulated and cannot be located by the caller,
+     * or access to the resource is denied by the security manager. </p>
+     *
+     * @param  name
+     *         The resource name
+     *
+     * @return An input stream for reading the resource or {@code null}
+     *
+     * @throws IOException
+     *         If an I/O error occurs
+     *
+     * @see Class#getResourceAsStream(String)
+     */
+    @CallerSensitive
+    public InputStream getResourceAsStream(String name) throws IOException {
+        if (name.startsWith("/")) {
+            name = name.substring(1);
+        }
+
+        if (isNamed() && Resources.canEncapsulate(name)) {
+            Module caller = getCallerModule(Reflection.getCallerClass());
+            if (caller != this && caller != Object.class.getModule()) {
+                String pn = Resources.toPackageName(name);
+                if (getPackages().contains(pn)) {
+                    if (caller == null && !isOpen(pn)) {
+                        // no caller, package not open
+                        return null;
+                    }
+                    if (!isOpen(pn, caller)) {
+                        // package not open to caller
+                        return null;
+                    }
+                }
+            }
+        }
+
+        String mn = this.name;
+
+        // special-case built-in class loaders to avoid URL connection
+        if (loader == null) {
+            return BootLoader.findResourceAsStream(mn, name);
+        } else if (loader instanceof BuiltinClassLoader) {
+            return ((BuiltinClassLoader) loader).findResourceAsStream(mn, name);
+        }
+
+        // locate resource in module
+        JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
+        URL url = jla.findResource(loader, mn, name);
+        if (url != null) {
+            try {
+                return url.openStream();
+            } catch (SecurityException e) { }
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns the string representation of this module. For a named module,
+     * the representation is the string {@code "module"}, followed by a space,
+     * and then the module name. For an unnamed module, the representation is
+     * the string {@code "unnamed module"}, followed by a space, and then an
+     * implementation specific string that identifies the unnamed module.
+     *
+     * @return The string representation of this module
+     */
+    @Override
+    public String toString() {
+        if (isNamed()) {
+            return "module " + name;
+        } else {
+            String id = Integer.toHexString(System.identityHashCode(this));
+            return "unnamed module @" + id;
+        }
+    }
+
+    /**
+     * Returns the module that a given caller class is a member of. Returns
+     * {@code null} if the caller is {@code null}.
+     */
+    private Module getCallerModule(Class<?> caller) {
+        return (caller != null) ? caller.getModule() : null;
+    }
+
+
+    // -- native methods --
+
+    // JVM_DefineModule
+    private static native void defineModule0(Module module,
+                                             boolean isOpen,
+                                             String version,
+                                             String location,
+                                             String[] pns);
+
+    // JVM_AddReadsModule
+    private static native void addReads0(Module from, Module to);
+
+    // JVM_AddModuleExports
+    private static native void addExports0(Module from, String pn, Module to);
+
+    // JVM_AddModuleExportsToAll
+    private static native void addExportsToAll0(Module from, String pn);
+
+    // JVM_AddModuleExportsToAllUnnamed
+    private static native void addExportsToAllUnnamed0(Module from, String pn);
+
+    // JVM_AddModulePackage
+    private static native void addPackage0(Module m, String pn);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,944 @@
+/*
+ * 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
+ * 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.module.Configuration;
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.ResolvedModule;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import jdk.internal.loader.ClassLoaderValue;
+import jdk.internal.loader.Loader;
+import jdk.internal.loader.LoaderPool;
+import jdk.internal.module.ServicesCatalog;
+import sun.security.util.SecurityConstants;
+
+
+/**
+ * A layer of modules in the Java virtual machine.
+ *
+ * <p> A layer is created from a graph of modules in a {@link Configuration}
+ * and a function that maps each module to a {@link ClassLoader}.
+ * Creating a layer informs the Java virtual machine about the classes that
+ * may be loaded from the modules so that the Java virtual machine knows which
+ * module that each class is a member of. </p>
+ *
+ * <p> Creating a layer creates a {@link Module} object for each {@link
+ * ResolvedModule} in the configuration. For each resolved module that is
+ * {@link ResolvedModule#reads() read}, the {@code Module} {@link
+ * Module#canRead reads} the corresponding run-time {@code Module}, which may
+ * be in the same layer or a {@link #parents() parent} layer. </p>
+ *
+ * <p> The {@link #defineModulesWithOneLoader defineModulesWithOneLoader} and
+ * {@link #defineModulesWithManyLoaders defineModulesWithManyLoaders} methods
+ * provide convenient ways to create a module layer where all modules are
+ * mapped to a single class loader or where each module is mapped to its own
+ * class loader. The {@link #defineModules defineModules} method is for more
+ * advanced cases where modules are mapped to custom class loaders by means of
+ * a function specified to the method. Each of these methods has an instance
+ * and static variant. The instance methods create a layer with the receiver
+ * as the parent layer. The static methods are for more advanced cases where
+ * there can be more than one parent layer or where a {@link
+ * ModuleLayer.Controller Controller} is needed to control modules in the layer
+ * </p>
+ *
+ * <p> A Java virtual machine has at least one non-empty layer, the {@link
+ * #boot() boot} layer, that is created when the Java virtual machine is
+ * started. The boot layer contains module {@code java.base} and is the only
+ * layer in the Java virtual machine with a module named "{@code java.base}".
+ * The modules in the boot layer are mapped to the bootstrap class loader and
+ * other class loaders that are <a href="../ClassLoader.html#builtinLoaders">
+ * built-in</a> into the Java virtual machine. The boot layer will often be
+ * the {@link #parents() parent} when creating additional layers. </p>
+ *
+ * <p> Each {@code Module} in a layer is created so that it {@link
+ * Module#isExported(String) exports} and {@link Module#isOpen(String) opens}
+ * the packages described by its {@link ModuleDescriptor}. Qualified exports
+ * (where a package is exported to a set of target modules rather than all
+ * modules) are reified when creating the layer as follows: </p>
+ * <ul>
+ *     <li> If module {@code X} exports a package to {@code Y}, and if the
+ *     runtime {@code Module} {@code X} reads {@code Module} {@code Y}, then
+ *     the package is exported to {@code Module} {@code Y} (which may be in
+ *     the same layer as {@code X} or a parent layer). </li>
+ *
+ *     <li> If module {@code X} exports a package to {@code Y}, and if the
+ *     runtime {@code Module} {@code X} does not read {@code Y} then target
+ *     {@code Y} is located as if by invoking {@link #findModule(String)
+ *     findModule} to find the module in the layer or its parent layers. If
+ *     {@code Y} is found then the package is exported to the instance of
+ *     {@code Y} that was found. If {@code Y} is not found then the qualified
+ *     export is ignored. </li>
+ * </ul>
+ *
+ * <p> Qualified opens are handled in same way as qualified exports. </p>
+ *
+ * <p> As when creating a {@code Configuration},
+ * {@link ModuleDescriptor#isAutomatic() automatic} modules receive special
+ * treatment when creating a layer. An automatic module is created in the
+ * Java virtual machine as a {@code Module} that reads every unnamed {@code
+ * Module} in the Java virtual machine. </p>
+ *
+ * <p> Unless otherwise specified, passing a {@code null} argument to a method
+ * in this class causes a {@link NullPointerException NullPointerException} to
+ * be thrown. </p>
+ *
+ * <h3> Example usage: </h3>
+ *
+ * <p> This example creates a configuration by resolving a module named
+ * "{@code myapp}" with the configuration for the boot layer as the parent. It
+ * then creates a new layer with the modules in this configuration. All modules
+ * are defined to the same class loader. </p>
+ *
+ * <pre>{@code
+ *     ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3);
+ *
+ *     ModuleLayer parent = ModuleLayer.boot();
+ *
+ *     Configuration cf = parent.configuration().resolve(finder, ModuleFinder.of(), Set.of("myapp"));
+ *
+ *     ClassLoader scl = ClassLoader.getSystemClassLoader();
+ *
+ *     ModuleLayer layer = parent.defineModulesWithOneLoader(cf, scl);
+ *
+ *     Class<?> c = layer.findLoader("myapp").loadClass("app.Main");
+ * }</pre>
+ *
+ * @since 9
+ * @spec JPMS
+ * @see Module#getLayer()
+ */
+
+public final class ModuleLayer {
+
+    // the empty layer
+    private static final ModuleLayer EMPTY_LAYER
+        = new ModuleLayer(Configuration.empty(), List.of(), null);
+
+    // the configuration from which this ;ayer was created
+    private final Configuration cf;
+
+    // parent layers, empty in the case of the empty layer
+    private final List<ModuleLayer> parents;
+
+    // maps module name to jlr.Module
+    private final Map<String, Module> nameToModule;
+
+    /**
+     * Creates a new module layer from the modules in the given configuration.
+     */
+    private ModuleLayer(Configuration cf,
+                        List<ModuleLayer> parents,
+                        Function<String, ClassLoader> clf)
+    {
+        this.cf = cf;
+        this.parents = parents; // no need to do defensive copy
+
+        Map<String, Module> map;
+        if (parents.isEmpty()) {
+            map = Collections.emptyMap();
+        } else {
+            map = Module.defineModules(cf, clf, this);
+        }
+        this.nameToModule = map; // no need to do defensive copy
+    }
+
+    /**
+     * Controls a module layer. The static methods defined by {@link ModuleLayer}
+     * to create module layers return a {@code Controller} that can be used to
+     * control modules in the layer.
+     *
+     * <p> Unless otherwise specified, passing a {@code null} argument to a
+     * method in this class causes a {@link NullPointerException
+     * NullPointerException} to be thrown. </p>
+     *
+     * @apiNote Care should be taken with {@code Controller} objects, they
+     * should never be shared with untrusted code.
+     *
+     * @since 9
+     * @spec JPMS
+     */
+    public static final class Controller {
+        private final ModuleLayer layer;
+
+        Controller(ModuleLayer layer) {
+            this.layer = layer;
+        }
+
+        /**
+         * Returns the layer that this object controls.
+         *
+         * @return the module layer
+         */
+        public ModuleLayer layer() {
+            return layer;
+        }
+
+        private void ensureInLayer(Module source) {
+            if (source.getLayer() != layer)
+                throw new IllegalArgumentException(source + " not in layer");
+        }
+
+
+        /**
+         * Updates module {@code source} in the layer to read module
+         * {@code target}. This method is a no-op if {@code source} already
+         * reads {@code target}.
+         *
+         * @implNote <em>Read edges</em> added by this method are <em>weak</em>
+         * and do not prevent {@code target} from being GC'ed when {@code source}
+         * is strongly reachable.
+         *
+         * @param  source
+         *         The source module
+         * @param  target
+         *         The target module to read
+         *
+         * @return This controller
+         *
+         * @throws IllegalArgumentException
+         *         If {@code source} is not in the module layer
+         *
+         * @see Module#addReads
+         */
+        public Controller addReads(Module source, Module target) {
+            ensureInLayer(source);
+            source.implAddReads(target);
+            return this;
+        }
+
+        /**
+         * Updates module {@code source} in the layer to open a package to
+         * module {@code target}. This method is a no-op if {@code source}
+         * already opens the package to at least {@code target}.
+         *
+         * @param  source
+         *         The source module
+         * @param  pn
+         *         The package name
+         * @param  target
+         *         The target module to read
+         *
+         * @return This controller
+         *
+         * @throws IllegalArgumentException
+         *         If {@code source} is not in the module layer or the package
+         *         is not in the source module
+         *
+         * @see Module#addOpens
+         */
+        public Controller addOpens(Module source, String pn, Module target) {
+            ensureInLayer(source);
+            source.implAddOpens(pn, target);
+            return this;
+        }
+    }
+
+
+    /**
+     * Creates a new module layer, with this layer as its parent, by defining the
+     * modules in the given {@code Configuration} to the Java virtual machine.
+     * This method creates one class loader and defines all modules to that
+     * class loader. The {@link ClassLoader#getParent() parent} of each class
+     * loader is the given parent class loader. This method works exactly as
+     * specified by the static {@link
+     * #defineModulesWithOneLoader(Configuration,List,ClassLoader)
+     * defineModulesWithOneLoader} method when invoked with this layer as the
+     * parent. In other words, if this layer is {@code thisLayer} then this
+     * method is equivalent to invoking:
+     * <pre> {@code
+     *     ModuleLayer.defineModulesWithOneLoader(cf, List.of(thisLayer), parentLoader).layer();
+     * }</pre>
+     *
+     * @param  cf
+     *         The configuration for the layer
+     * @param  parentLoader
+     *         The parent class loader for the class loader created by this
+     *         method; may be {@code null} for the bootstrap class loader
+     *
+     * @return The newly created layer
+     *
+     * @throws IllegalArgumentException
+     *         If the parent of the given configuration is not the configuration
+     *         for this layer
+     * @throws LayerInstantiationException
+     *         If the layer cannot be created for any of the reasons specified
+     *         by the static {@code defineModulesWithOneLoader} method
+     * @throws SecurityException
+     *         If {@code RuntimePermission("createClassLoader")} or
+     *         {@code RuntimePermission("getClassLoader")} is denied by
+     *         the security manager
+     *
+     * @see #findLoader
+     */
+    public ModuleLayer defineModulesWithOneLoader(Configuration cf,
+                                                  ClassLoader parentLoader) {
+        return defineModulesWithOneLoader(cf, List.of(this), parentLoader).layer();
+    }
+
+
+    /**
+     * Creates a new module layer, with this layer as its parent, by defining the
+     * modules in the given {@code Configuration} to the Java virtual machine.
+     * Each module is defined to its own {@link ClassLoader} created by this
+     * method. The {@link ClassLoader#getParent() parent} of each class loader
+     * is the given parent class loader. This method works exactly as specified
+     * by the static {@link
+     * #defineModulesWithManyLoaders(Configuration,List,ClassLoader)
+     * defineModulesWithManyLoaders} method when invoked with this layer as the
+     * parent. In other words, if this layer is {@code thisLayer} then this
+     * method is equivalent to invoking:
+     * <pre> {@code
+     *     ModuleLayer.defineModulesWithManyLoaders(cf, List.of(thisLayer), parentLoader).layer();
+     * }</pre>
+     *
+     * @param  cf
+     *         The configuration for the layer
+     * @param  parentLoader
+     *         The parent class loader for each of the class loaders created by
+     *         this method; may be {@code null} for the bootstrap class loader
+     *
+     * @return The newly created layer
+     *
+     * @throws IllegalArgumentException
+     *         If the parent of the given configuration is not the configuration
+     *         for this layer
+     * @throws LayerInstantiationException
+     *         If the layer cannot be created for any of the reasons specified
+     *         by the static {@code defineModulesWithManyLoaders} method
+     * @throws SecurityException
+     *         If {@code RuntimePermission("createClassLoader")} or
+     *         {@code RuntimePermission("getClassLoader")} is denied by
+     *         the security manager
+     *
+     * @see #findLoader
+     */
+    public ModuleLayer defineModulesWithManyLoaders(Configuration cf,
+                                                    ClassLoader parentLoader) {
+        return defineModulesWithManyLoaders(cf, List.of(this), parentLoader).layer();
+    }
+
+
+    /**
+     * Creates a new module layer, with this layer as its parent, by defining the
+     * modules in the given {@code Configuration} to the Java virtual machine.
+     * Each module is mapped, by name, to its class loader by means of the
+     * given function. This method works exactly as specified by the static
+     * {@link #defineModules(Configuration,List,Function) defineModules}
+     * method when invoked with this layer as the parent. In other words, if
+     * this layer is {@code thisLayer} then this method is equivalent to
+     * invoking:
+     * <pre> {@code
+     *     ModuleLayer.defineModules(cf, List.of(thisLayer), clf).layer();
+     * }</pre>
+     *
+     * @param  cf
+     *         The configuration for the layer
+     * @param  clf
+     *         The function to map a module name to a class loader
+     *
+     * @return The newly created layer
+     *
+     * @throws IllegalArgumentException
+     *         If the parent of the given configuration is not the configuration
+     *         for this layer
+     * @throws LayerInstantiationException
+     *         If the layer cannot be created for any of the reasons specified
+     *         by the static {@code defineModules} method
+     * @throws SecurityException
+     *         If {@code RuntimePermission("getClassLoader")} is denied by
+     *         the security manager
+     */
+    public ModuleLayer defineModules(Configuration cf,
+                                     Function<String, ClassLoader> clf) {
+        return defineModules(cf, List.of(this), clf).layer();
+    }
+
+    /**
+     * Creates a new module layer by defining the modules in the given {@code
+     * Configuration} to the Java virtual machine. This method creates one
+     * class loader and defines all modules to that class loader.
+     *
+     * <p> The class loader created by this method implements <em>direct
+     * delegation</em> when loading types from modules. When its {@link
+     * ClassLoader#loadClass(String, boolean) loadClass} method is invoked to
+     * load a class then it uses the package name of the class to map it to a
+     * module. This may be a module in this layer and hence defined to the same
+     * class loader. It may be a package in a module in a parent layer that is
+     * exported to one or more of the modules in this layer. The class
+     * loader delegates to the class loader of the module, throwing {@code
+     * ClassNotFoundException} if not found by that class loader.
+     * When {@code loadClass} is invoked to load classes that do not map to a
+     * module then it delegates to the parent class loader. </p>
+     *
+     * <p> Attempting to create a layer with all modules defined to the same
+     * class loader can fail for the following reasons:
+     *
+     * <ul>
+     *
+     *     <li><p> <em>Overlapping packages</em>: Two or more modules in the
+     *     configuration have the same package. </p></li>
+     *
+     *     <li><p> <em>Split delegation</em>: The resulting class loader would
+     *     need to delegate to more than one class loader in order to load types
+     *     in a specific package. </p></li>
+     *
+     * </ul>
+     *
+     * <p> In addition, a layer cannot be created if the configuration contains
+     * a module named "{@code java.base}", or a module contains a package named
+     * "{@code java}" or a package with a name starting with "{@code java.}". </p>
+     *
+     * <p> If there is a security manager then the class loader created by
+     * this method will load classes and resources with privileges that are
+     * restricted by the calling context of this method. </p>
+     *
+     * @param  cf
+     *         The configuration for the layer
+     * @param  parentLayers
+     *         The list of parent layers in search order
+     * @param  parentLoader
+     *         The parent class loader for the class loader created by this
+     *         method; may be {@code null} for the bootstrap class loader
+     *
+     * @return A controller that controls the newly created layer
+     *
+     * @throws IllegalArgumentException
+     *         If the parent configurations do not match the configuration of
+     *         the parent layers, including order
+     * @throws LayerInstantiationException
+     *         If all modules cannot be defined to the same class loader for any
+     *         of the reasons listed above
+     * @throws SecurityException
+     *         If {@code RuntimePermission("createClassLoader")} or
+     *         {@code RuntimePermission("getClassLoader")} is denied by
+     *         the security manager
+     *
+     * @see #findLoader
+     */
+    public static Controller defineModulesWithOneLoader(Configuration cf,
+                                                        List<ModuleLayer> parentLayers,
+                                                        ClassLoader parentLoader)
+    {
+        List<ModuleLayer> parents = new ArrayList<>(parentLayers);
+        checkConfiguration(cf, parents);
+
+        checkCreateClassLoaderPermission();
+        checkGetClassLoaderPermission();
+
+        try {
+            Loader loader = new Loader(cf.modules(), parentLoader);
+            loader.initRemotePackageMap(cf, parents);
+            ModuleLayer layer =  new ModuleLayer(cf, parents, mn -> loader);
+            return new Controller(layer);
+        } catch (IllegalArgumentException | IllegalStateException e) {
+            throw new LayerInstantiationException(e.getMessage());
+        }
+    }
+
+    /**
+     * Creates a new module layer by defining the modules in the given {@code
+     * Configuration} to the Java virtual machine. Each module is defined to
+     * its own {@link ClassLoader} created by this method. The {@link
+     * ClassLoader#getParent() parent} of each class loader is the given parent
+     * class loader.
+     *
+     * <p> The class loaders created by this method implement <em>direct
+     * delegation</em> when loading types from modules. When {@link
+     * ClassLoader#loadClass(String, boolean) loadClass} method is invoked to
+     * load a class then it uses the package name of the class to map it to a
+     * module. The package may be in the module defined to the class loader.
+     * The package may be exported by another module in this layer to the
+     * module defined to the class loader. It may be in a package exported by a
+     * module in a parent layer. The class loader delegates to the class loader
+     * of the module, throwing {@code ClassNotFoundException} if not found by
+     * that class loader.
+     * When {@code loadClass} is invoked to load classes that do not map to a
+     * module then it delegates to the parent class loader. </p>
+     *
+     * <p> If there is a security manager then the class loaders created by
+     * this method will load classes and resources with privileges that are
+     * restricted by the calling context of this method. </p>
+     *
+     * @param  cf
+     *         The configuration for the layer
+     * @param  parentLayers
+     *         The list of parent layers in search order
+     * @param  parentLoader
+     *         The parent class loader for each of the class loaders created by
+     *         this method; may be {@code null} for the bootstrap class loader
+     *
+     * @return A controller that controls the newly created layer
+     *
+     * @throws IllegalArgumentException
+     *         If the parent configurations do not match the configuration of
+     *         the parent layers, including order
+     * @throws LayerInstantiationException
+     *         If the layer cannot be created because the configuration contains
+     *         a module named "{@code java.base}" or a module contains a package
+     *         named "{@code java}" or a package with a name starting with
+     *         "{@code java.}"
+     *
+     * @throws SecurityException
+     *         If {@code RuntimePermission("createClassLoader")} or
+     *         {@code RuntimePermission("getClassLoader")} is denied by
+     *         the security manager
+     *
+     * @see #findLoader
+     */
+    public static Controller defineModulesWithManyLoaders(Configuration cf,
+                                                          List<ModuleLayer> parentLayers,
+                                                          ClassLoader parentLoader)
+    {
+        List<ModuleLayer> parents = new ArrayList<>(parentLayers);
+        checkConfiguration(cf, parents);
+
+        checkCreateClassLoaderPermission();
+        checkGetClassLoaderPermission();
+
+        LoaderPool pool = new LoaderPool(cf, parents, parentLoader);
+        try {
+            ModuleLayer layer = new ModuleLayer(cf, parents, pool::loaderFor);
+            return new Controller(layer);
+        } catch (IllegalArgumentException | IllegalStateException e) {
+            throw new LayerInstantiationException(e.getMessage());
+        }
+    }
+
+    /**
+     * Creates a new module layer by defining the modules in the given {@code
+     * Configuration} to the Java virtual machine. The given function maps each
+     * module in the configuration, by name, to a class loader. Creating the
+     * layer informs the Java virtual machine about the classes that may be
+     * loaded so that the Java virtual machine knows which module that each
+     * class is a member of.
+     *
+     * <p> The class loader delegation implemented by the class loaders must
+     * respect module readability. The class loaders should be
+     * {@link ClassLoader#registerAsParallelCapable parallel-capable} so as to
+     * avoid deadlocks during class loading. In addition, the entity creating
+     * a new layer with this method should arrange that the class loaders be
+     * ready to load from these modules before there are any attempts to load
+     * classes or resources. </p>
+     *
+     * <p> Creating a layer can fail for the following reasons: </p>
+     *
+     * <ul>
+     *
+     *     <li><p> Two or more modules with the same package are mapped to the
+     *     same class loader. </p></li>
+     *
+     *     <li><p> A module is mapped to a class loader that already has a
+     *     module of the same name defined to it. </p></li>
+     *
+     *     <li><p> A module is mapped to a class loader that has already
+     *     defined types in any of the packages in the module. </p></li>
+     *
+     * </ul>
+     *
+     * <p> In addition, a layer cannot be created if the configuration contains
+     * a module named "{@code java.base}", a configuration contains a module
+     * with a package named "{@code java}" or a package name starting with
+     * "{@code java.}" and the module is mapped to a class loader other than
+     * the {@link ClassLoader#getPlatformClassLoader() platform class loader},
+     * or the function to map a module name to a class loader returns
+     * {@code null}. </p>
+     *
+     * <p> If the function to map a module name to class loader throws an error
+     * or runtime exception then it is propagated to the caller of this method.
+     * </p>
+     *
+     * @apiNote It is implementation specific as to whether creating a layer
+     * with this method is an atomic operation or not. Consequentially it is
+     * possible for this method to fail with some modules, but not all, defined
+     * to the Java virtual machine.
+     *
+     * @param  cf
+     *         The configuration for the layer
+     * @param  parentLayers
+     *         The list of parent layers in search order
+     * @param  clf
+     *         The function to map a module name to a class loader
+     *
+     * @return A controller that controls the newly created layer
+     *
+     * @throws IllegalArgumentException
+     *         If the parent configurations do not match the configuration of
+     *         the parent layers, including order
+     * @throws LayerInstantiationException
+     *         If creating the layer fails for any of the reasons listed above
+     * @throws SecurityException
+     *         If {@code RuntimePermission("getClassLoader")} is denied by
+     *         the security manager
+     */
+    public static Controller defineModules(Configuration cf,
+                                           List<ModuleLayer> parentLayers,
+                                           Function<String, ClassLoader> clf)
+    {
+        List<ModuleLayer> parents = new ArrayList<>(parentLayers);
+        checkConfiguration(cf, parents);
+        Objects.requireNonNull(clf);
+
+        checkGetClassLoaderPermission();
+
+        // The boot layer is checked during module system initialization
+        if (boot() != null) {
+            checkForDuplicatePkgs(cf, clf);
+        }
+
+        try {
+            ModuleLayer layer = new ModuleLayer(cf, parents, clf);
+            return new Controller(layer);
+        } catch (IllegalArgumentException | IllegalStateException e) {
+            throw new LayerInstantiationException(e.getMessage());
+        }
+    }
+
+
+    /**
+     * Checks that the parent configurations match the configuration of
+     * the parent layers.
+     */
+    private static void checkConfiguration(Configuration cf,
+                                           List<ModuleLayer> parentLayers)
+    {
+        Objects.requireNonNull(cf);
+
+        List<Configuration> parentConfigurations = cf.parents();
+        if (parentLayers.size() != parentConfigurations.size())
+            throw new IllegalArgumentException("wrong number of parents");
+
+        int index = 0;
+        for (ModuleLayer parent : parentLayers) {
+            if (parent.configuration() != parentConfigurations.get(index)) {
+                throw new IllegalArgumentException(
+                        "Parent of configuration != configuration of this Layer");
+            }
+            index++;
+        }
+    }
+
+    private static void checkCreateClassLoaderPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null)
+            sm.checkPermission(SecurityConstants.CREATE_CLASSLOADER_PERMISSION);
+    }
+
+    private static void checkGetClassLoaderPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null)
+            sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
+    }
+
+    /**
+     * Checks a configuration and the module-to-loader mapping to ensure that
+     * no two modules mapped to the same class loader have the same package.
+     * It also checks that no two automatic modules have the same package.
+     *
+     * @throws LayerInstantiationException
+     */
+    private static void checkForDuplicatePkgs(Configuration cf,
+                                              Function<String, ClassLoader> clf)
+    {
+        // HashMap allows null keys
+        Map<ClassLoader, Set<String>> loaderToPackages = new HashMap<>();
+        for (ResolvedModule resolvedModule : cf.modules()) {
+            ModuleDescriptor descriptor = resolvedModule.reference().descriptor();
+            ClassLoader loader = clf.apply(descriptor.name());
+
+            Set<String> loaderPackages
+                = loaderToPackages.computeIfAbsent(loader, k -> new HashSet<>());
+
+            for (String pkg : descriptor.packages()) {
+                boolean added = loaderPackages.add(pkg);
+                if (!added) {
+                    throw fail("More than one module with package %s mapped" +
+                               " to the same class loader", pkg);
+                }
+            }
+        }
+    }
+
+    /**
+     * Creates a LayerInstantiationException with the a message formatted from
+     * the given format string and arguments.
+     */
+    private static LayerInstantiationException fail(String fmt, Object ... args) {
+        String msg = String.format(fmt, args);
+        return new LayerInstantiationException(msg);
+    }
+
+
+    /**
+     * Returns the configuration for this layer.
+     *
+     * @return The configuration for this layer
+     */
+    public Configuration configuration() {
+        return cf;
+    }
+
+
+    /**
+     * Returns the list of this layer's parents unless this is the
+     * {@linkplain #empty empty layer}, which has no parents and so an
+     * empty list is returned.
+     *
+     * @return The list of this layer's parents
+     */
+    public List<ModuleLayer> parents() {
+        return parents;
+    }
+
+
+    /**
+     * Returns an ordered stream of layers. The first element is is this layer,
+     * the remaining elements are the parent layers in DFS order.
+     *
+     * @implNote For now, the assumption is that the number of elements will
+     * be very low and so this method does not use a specialized spliterator.
+     */
+    Stream<ModuleLayer> layers() {
+        List<ModuleLayer> allLayers = this.allLayers;
+        if (allLayers != null)
+            return allLayers.stream();
+
+        allLayers = new ArrayList<>();
+        Set<ModuleLayer> visited = new HashSet<>();
+        Deque<ModuleLayer> stack = new ArrayDeque<>();
+        visited.add(this);
+        stack.push(this);
+
+        while (!stack.isEmpty()) {
+            ModuleLayer layer = stack.pop();
+            allLayers.add(layer);
+
+            // push in reverse order
+            for (int i = layer.parents.size() - 1; i >= 0; i--) {
+                ModuleLayer parent = layer.parents.get(i);
+                if (!visited.contains(parent)) {
+                    visited.add(parent);
+                    stack.push(parent);
+                }
+            }
+        }
+
+        this.allLayers = allLayers = Collections.unmodifiableList(allLayers);
+        return allLayers.stream();
+    }
+
+    private volatile List<ModuleLayer> allLayers;
+
+    /**
+     * Returns the set of the modules in this layer.
+     *
+     * @return A possibly-empty unmodifiable set of the modules in this layer
+     */
+    public Set<Module> modules() {
+        Set<Module> modules = this.modules;
+        if (modules == null) {
+            this.modules = modules =
+                Collections.unmodifiableSet(new HashSet<>(nameToModule.values()));
+        }
+        return modules;
+    }
+
+    private volatile Set<Module> modules;
+
+
+    /**
+     * Returns the module with the given name in this layer, or if not in this
+     * layer, the {@linkplain #parents parent} layers. Finding a module in
+     * parent layers is equivalent to invoking {@code findModule} on each
+     * parent, in search order, until the module is found or all parents have
+     * been searched. In a <em>tree of layers</em>  then this is equivalent to
+     * a depth-first search.
+     *
+     * @param  name
+     *         The name of the module to find
+     *
+     * @return The module with the given name or an empty {@code Optional}
+     *         if there isn't a module with this name in this layer or any
+     *         parent layer
+     */
+    public Optional<Module> findModule(String name) {
+        Objects.requireNonNull(name);
+        if (this == EMPTY_LAYER)
+            return Optional.empty();
+        Module m = nameToModule.get(name);
+        if (m != null)
+            return Optional.of(m);
+
+        return layers()
+                .skip(1)  // skip this layer
+                .map(l -> l.nameToModule)
+                .filter(map -> map.containsKey(name))
+                .map(map -> map.get(name))
+                .findAny();
+    }
+
+
+    /**
+     * Returns the {@code ClassLoader} for the module with the given name. If
+     * a module of the given name is not in this layer then the {@link #parents
+     * parent} layers are searched in the manner specified by {@link
+     * #findModule(String) findModule}.
+     *
+     * <p> If there is a security manager then its {@code checkPermission}
+     * method is called with a {@code RuntimePermission("getClassLoader")}
+     * permission to check that the caller is allowed to get access to the
+     * class loader. </p>
+     *
+     * @apiNote This method does not return an {@code Optional<ClassLoader>}
+     * because `null` must be used to represent the bootstrap class loader.
+     *
+     * @param  name
+     *         The name of the module to find
+     *
+     * @return The ClassLoader that the module is defined to
+     *
+     * @throws IllegalArgumentException if a module of the given name is not
+     *         defined in this layer or any parent of this layer
+     *
+     * @throws SecurityException if denied by the security manager
+     */
+    public ClassLoader findLoader(String name) {
+        Optional<Module> om = findModule(name);
+
+        // can't use map(Module::getClassLoader) as class loader can be null
+        if (om.isPresent()) {
+            return om.get().getClassLoader();
+        } else {
+            throw new IllegalArgumentException("Module " + name
+                                               + " not known to this layer");
+        }
+    }
+
+    /**
+     * Returns a string describing this module layer.
+     *
+     * @return A possibly empty string describing this module layer
+     */
+    @Override
+    public String toString() {
+        return modules().stream()
+                .map(Module::getName)
+                .collect(Collectors.joining(", "));
+    }
+
+    /**
+     * Returns the <em>empty</em> layer. There are no modules in the empty
+     * layer. It has no parents.
+     *
+     * @return The empty layer
+     */
+    public static ModuleLayer empty() {
+        return EMPTY_LAYER;
+    }
+
+
+    /**
+     * Returns the boot layer. The boot layer contains at least one module,
+     * {@code java.base}. Its parent is the {@link #empty() empty} layer.
+     *
+     * @apiNote This method returns {@code null} during startup and before
+     *          the boot layer is fully initialized.
+     *
+     * @return The boot layer
+     */
+    public static ModuleLayer boot() {
+        return System.bootLayer;
+    }
+
+    /**
+     * Returns the ServicesCatalog for this Layer, creating it if not
+     * already created.
+     */
+    ServicesCatalog getServicesCatalog() {
+        ServicesCatalog servicesCatalog = this.servicesCatalog;
+        if (servicesCatalog != null)
+            return servicesCatalog;
+
+        synchronized (this) {
+            servicesCatalog = this.servicesCatalog;
+            if (servicesCatalog == null) {
+                servicesCatalog = ServicesCatalog.create();
+                nameToModule.values().forEach(servicesCatalog::register);
+                this.servicesCatalog = servicesCatalog;
+            }
+        }
+
+        return servicesCatalog;
+    }
+
+    private volatile ServicesCatalog servicesCatalog;
+
+
+    /**
+     * Record that this layer has at least one module defined to the given
+     * class loader.
+     */
+    void bindToLoader(ClassLoader loader) {
+        // CLV.computeIfAbsent(loader, (cl, clv) -> new CopyOnWriteArrayList<>())
+        List<ModuleLayer> list = CLV.get(loader);
+        if (list == null) {
+            list = new CopyOnWriteArrayList<>();
+            List<ModuleLayer> previous = CLV.putIfAbsent(loader, list);
+            if (previous != null) list = previous;
+        }
+        list.add(this);
+    }
+
+    /**
+     * Returns a stream of the layers that have at least one module defined to
+     * the given class loader.
+     */
+    static Stream<ModuleLayer> layers(ClassLoader loader) {
+        List<ModuleLayer> list = CLV.get(loader);
+        if (list != null) {
+            return list.stream();
+        } else {
+            return Stream.empty();
+        }
+    }
+
+    // the list of layers with modules defined to a class loader
+    private static final ClassLoaderValue<List<ModuleLayer>> CLV = new ClassLoaderValue<>();
+}
--- a/jdk/src/java.base/share/classes/java/lang/NamedPackage.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/NamedPackage.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
 
 import java.lang.module.Configuration;
 import java.lang.module.ModuleReference;
-import java.lang.reflect.Module;
 import java.net.URI;
 
 /**
--- a/jdk/src/java.base/share/classes/java/lang/Object.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Object.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -561,10 +561,53 @@
      * the finalization of this object to be halted, but is otherwise
      * ignored.
      *
+     * @apiNote
+     * Classes that embed non-heap resources have many options
+     * for cleanup of those resources. The class must ensure that the
+     * lifetime of each instance is longer than that of any resource it embeds.
+     * {@link java.lang.ref.Reference#reachabilityFence} can be used to ensure that
+     * objects remain reachable while resources embedded in the object are in use.
+     * <p>
+     * A subclass should avoid overriding the {@code finalize} method
+     * unless the subclass embeds non-heap resources that must be cleaned up
+     * before the instance is collected.
+     * Finalizer invocations are not automatically chained, unlike constructors.
+     * If a subclass overrides {@code finalize} it must invoke the superclass
+     * finalizer explicitly.
+     * To guard against exceptions prematurely terminating the finalize chain,
+     * the subclass should use a {@code try-finally} block to ensure
+     * {@code super.finalize()} is always invoked. For example,
+     * <pre>{@code      @Override
+     *     protected void finalize() throws Throwable {
+     *         try {
+     *             ... // cleanup subclass state
+     *         } finally {
+     *             super.finalize();
+     *         }
+     *     }
+     * }</pre>
+     *
+     * @deprecated The finalization mechanism is inherently problematic.
+     * Finalization can lead to performance issues, deadlocks, and hangs.
+     * Errors in finalizers can lead to resource leaks; there is no way to cancel
+     * finalization if it is no longer necessary; and no ordering is specified
+     * among calls to {@code finalize} methods of different objects.
+     * Furthermore, there are no guarantees regarding the timing of finalization.
+     * The {@code finalize} method might be called on a finalizable object
+     * only after an indefinite delay, if at all.
+     *
+     * Classes whose instances hold non-heap resources should provide a method
+     * to enable explicit release of those resources, and they should also
+     * implement {@link AutoCloseable} if appropriate.
+     * The {@link java.lang.ref.Cleaner} and {@link java.lang.ref.PhantomReference}
+     * provide more flexible and efficient ways to release resources when an object
+     * becomes unreachable.
+     *
      * @throws Throwable the {@code Exception} raised by this method
      * @see java.lang.ref.WeakReference
      * @see java.lang.ref.PhantomReference
      * @jls 12.6 Finalization of Class Instances
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable { }
 }
--- a/jdk/src/java.base/share/classes/java/lang/Package.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Package.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Module;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
--- a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,9 +29,7 @@
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleDescriptor.Exports;
 import java.lang.module.ModuleDescriptor.Opens;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Member;
-import java.lang.reflect.Module;
 import java.io.FileDescriptor;
 import java.io.File;
 import java.io.FilePermission;
@@ -1441,7 +1439,7 @@
 
     static {
         // Get the modules in the boot layer
-        Stream<Module> bootLayerModules = Layer.boot().modules().stream();
+        Stream<Module> bootLayerModules = ModuleLayer.boot().modules().stream();
 
         // Filter out the modules loaded by the boot or platform loader
         PrivilegedAction<Set<Module>> pa = () ->
--- a/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java	Mon Apr 10 08:31:37 2017 -0700
@@ -33,8 +33,6 @@
 import java.lang.module.ModuleDescriptor.Version;
 import java.lang.module.ModuleReference;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.HashSet;
 import java.util.Objects;
 import java.util.Optional;
@@ -191,7 +189,7 @@
      *         if the module name is not available.
      * @since 9
      * @spec JPMS
-     * @see java.lang.reflect.Module#getName()
+     * @see Module#getName()
      */
     public String getModuleName() {
         return moduleName;
@@ -480,7 +478,7 @@
         if (!VM.isModuleSystemInited())
             return true;
 
-        return Layer.boot() == m.getLayer() && HashedModules.contains(m);
+        return ModuleLayer.boot() == m.getLayer() && HashedModules.contains(m);
     }
 
     /*
@@ -492,7 +490,7 @@
 
         static Set<String> hashedModules() {
 
-            Optional<ResolvedModule> resolvedModule = Layer.boot()
+            Optional<ResolvedModule> resolvedModule = ModuleLayer.boot()
                     .configuration()
                     .findModule("java.base");
             assert resolvedModule.isPresent();
--- a/jdk/src/java.base/share/classes/java/lang/String.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/String.java	Mon Apr 10 08:31:37 2017 -0700
@@ -2672,7 +2672,6 @@
      * point</a> is passed through uninterpreted.
      *
      * @return an IntStream of char values from this sequence
-     * @since 9
      */
     @Override
     public IntStream chars() {
@@ -2692,7 +2691,6 @@
      * {@code int} values which are then passed to the stream.
      *
      * @return an IntStream of Unicode code points from this sequence
-     * @since 9
      */
     @Override
     public IntStream codePoints() {
--- a/jdk/src/java.base/share/classes/java/lang/System.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Mon Apr 10 08:31:37 2017 -0700
@@ -35,33 +35,32 @@
 import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
 import java.lang.annotation.Annotation;
+import java.lang.module.ModuleDescriptor;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Executable;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
+import java.net.URI;
 import java.net.URL;
 import java.security.AccessControlContext;
 import java.security.ProtectionDomain;
-import java.util.Properties;
-import java.util.PropertyPermission;
-import java.util.Map;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.nio.channels.Channel;
 import java.nio.channels.spi.SelectorProvider;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.PropertyPermission;
+import java.util.ResourceBundle;
+import java.util.function.Supplier;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Stream;
 
-import java.util.Objects;
-import java.util.ResourceBundle;
-import java.util.function.Supplier;
-import sun.nio.ch.Interruptible;
+import jdk.internal.module.ModuleBootstrap;
+import jdk.internal.module.ServicesCatalog;
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.Reflection;
-import sun.security.util.SecurityConstants;
-import sun.reflect.annotation.AnnotationType;
 import jdk.internal.HotSpotIntrinsicCandidate;
 import jdk.internal.misc.JavaLangAccess;;
 import jdk.internal.misc.SharedSecrets;;
@@ -69,8 +68,9 @@
 import jdk.internal.logger.LoggerFinderLoader;
 import jdk.internal.logger.LazyLoggers;
 import jdk.internal.logger.LocalizedLoggerWrapper;
-
-import jdk.internal.module.ModuleBootstrap;
+import sun.reflect.annotation.AnnotationType;
+import sun.nio.ch.Interruptible;
+import sun.security.util.SecurityConstants;
 
 /**
  * The <code>System</code> class contains several useful class fields
@@ -1160,7 +1160,7 @@
          * @param msg the string message (or a key in the message catalog, if
          * this logger is a {@link
          * LoggerFinder#getLocalizedLogger(java.lang.String,
-         * java.util.ResourceBundle, java.lang.reflect.Module) localized logger});
+         * java.util.ResourceBundle, java.lang.Module) localized logger});
          * can be {@code null}.
          *
          * @throws NullPointerException if {@code level} is {@code null}.
@@ -1228,7 +1228,7 @@
          * @param msg the string message (or a key in the message catalog, if
          * this logger is a {@link
          * LoggerFinder#getLocalizedLogger(java.lang.String,
-         * java.util.ResourceBundle, java.lang.reflect.Module) localized logger});
+         * java.util.ResourceBundle, java.lang.Module) localized logger});
          * can be {@code null}.
          * @param thrown a {@code Throwable} associated with the log message;
          *        can be {@code null}.
@@ -1277,7 +1277,7 @@
          * java.text.MessageFormat} format, (or a key in the message
          * catalog, if this logger is a {@link
          * LoggerFinder#getLocalizedLogger(java.lang.String,
-         * java.util.ResourceBundle, java.lang.reflect.Module) localized logger});
+         * java.util.ResourceBundle, java.lang.Module) localized logger});
          * can be {@code null}.
          * @param params an optional list of parameters to the message (may be
          * none).
@@ -1482,7 +1482,7 @@
          * message localization.
          *
          * @implSpec By default, this method calls {@link
-         * #getLogger(java.lang.String, java.lang.reflect.Module)
+         * #getLogger(java.lang.String, java.lang.Module)
          * this.getLogger(name, module)} to obtain a logger, then wraps that
          * logger in a {@link Logger} instance where all methods that do not
          * take a {@link ResourceBundle} as parameter are redirected to one
@@ -1566,12 +1566,20 @@
      * @implSpec
      * Instances returned by this method route messages to loggers
      * obtained by calling {@link LoggerFinder#getLogger(java.lang.String,
-     * java.lang.reflect.Module) LoggerFinder.getLogger(name, module)}, where
+     * java.lang.Module) LoggerFinder.getLogger(name, module)}, where
      * {@code module} is the caller's module.
+     * In cases where {@code System.getLogger} is called from a context where
+     * there is no caller frame on the stack (e.g when called directly
+     * from a JNI attached thread), {@code IllegalCallerException} is thrown.
+     * To obtain a logger in such a context, use an auxiliary class that will
+     * implicitly be identified as the caller, or use the system {@link
+     * LoggerFinder#getLoggerFinder() LoggerFinder} to obtain a logger instead.
+     * Note that doing the latter may eagerly initialize the underlying
+     * logging system.
      *
      * @apiNote
      * This method may defer calling the {@link
-     * LoggerFinder#getLogger(java.lang.String, java.lang.reflect.Module)
+     * LoggerFinder#getLogger(java.lang.String, java.lang.Module)
      * LoggerFinder.getLogger} method to create an actual logger supplied by
      * the logging backend, for instance, to allow loggers to be obtained during
      * the system initialization time.
@@ -1580,6 +1588,8 @@
      * @return an instance of {@link Logger} that can be used by the calling
      *         class.
      * @throws NullPointerException if {@code name} is {@code null}.
+     * @throws IllegalCallerException if there is no Java caller frame on the
+     *         stack.
      *
      * @since 9
      */
@@ -1587,6 +1597,9 @@
     public static Logger getLogger(String name) {
         Objects.requireNonNull(name);
         final Class<?> caller = Reflection.getCallerClass();
+        if (caller == null) {
+            throw new IllegalCallerException("no caller frame");
+        }
         return LazyLoggers.getLogger(name, caller.getModule());
     }
 
@@ -1599,9 +1612,17 @@
      * @implSpec
      * The returned logger will perform message localization as specified
      * by {@link LoggerFinder#getLocalizedLogger(java.lang.String,
-     * java.util.ResourceBundle, java.lang.reflect.Module)
-     * LoggerFinder.getLocalizedLogger(name, bundle, module}, where
+     * java.util.ResourceBundle, java.lang.Module)
+     * LoggerFinder.getLocalizedLogger(name, bundle, module)}, where
      * {@code module} is the caller's module.
+     * In cases where {@code System.getLogger} is called from a context where
+     * there is no caller frame on the stack (e.g when called directly
+     * from a JNI attached thread), {@code IllegalCallerException} is thrown.
+     * To obtain a logger in such a context, use an auxiliary class that
+     * will implicitly be identified as the caller, or use the system {@link
+     * LoggerFinder#getLoggerFinder() LoggerFinder} to obtain a logger instead.
+     * Note that doing the latter may eagerly initialize the underlying
+     * logging system.
      *
      * @apiNote
      * This method is intended to be used after the system is fully initialized.
@@ -1620,6 +1641,8 @@
      * resource bundle for message localization.
      * @throws NullPointerException if {@code name} is {@code null} or
      *         {@code bundle} is {@code null}.
+     * @throws IllegalCallerException if there is no Java caller frame on the
+     *         stack.
      *
      * @since 9
      */
@@ -1628,6 +1651,9 @@
         final ResourceBundle rb = Objects.requireNonNull(bundle);
         Objects.requireNonNull(name);
         final Class<?> caller = Reflection.getCallerClass();
+        if (caller == null) {
+            throw new IllegalCallerException("no caller frame");
+        }
         final SecurityManager sm = System.getSecurityManager();
         // We don't use LazyLoggers if a resource bundle is specified.
         // Bootstrap sensitive classes in the JDK do not use resource bundles
@@ -1951,7 +1977,7 @@
     }
 
     // @see #initPhase2()
-    private static Layer bootLayer;
+    static ModuleLayer bootLayer;
 
     /*
      * Invoked by VM.  Phase 2 module system initialization.
@@ -2071,12 +2097,10 @@
             public Thread newThreadWithAcc(Runnable target, AccessControlContext acc) {
                 return new Thread(target, acc);
             }
+            @SuppressWarnings("deprecation")
             public void invokeFinalize(Object o) throws Throwable {
                 o.finalize();
             }
-            public Layer getBootLayer() {
-                return bootLayer;
-            }
             public ConcurrentHashMap<?, ?> createOrGetClassLoaderValueMap(ClassLoader cl) {
                 return cl.createOrGetClassLoaderValueMap();
             }
@@ -2101,6 +2125,44 @@
             public void invalidatePackageAccessCache() {
                 SecurityManager.invalidatePackageAccessCache();
             }
+            public Module defineModule(ClassLoader loader,
+                                       ModuleDescriptor descriptor,
+                                       URI uri) {
+                return new Module(null, loader, descriptor, uri);
+            }
+            public Module defineUnnamedModule(ClassLoader loader) {
+                return new Module(loader);
+            }
+            public void addReads(Module m1, Module m2) {
+                m1.implAddReads(m2);
+            }
+            public void addReadsAllUnnamed(Module m) {
+                m.implAddReadsAllUnnamed();
+            }
+            public void addExports(Module m, String pn, Module other) {
+                m.implAddExports(pn, other);
+            }
+            public void addExportsToAllUnnamed(Module m, String pn) {
+                m.implAddExportsToAllUnnamed(pn);
+            }
+            public void addOpens(Module m, String pn, Module other) {
+                m.implAddOpens(pn, other);
+            }
+            public void addOpensToAllUnnamed(Module m, String pn) {
+                m.implAddOpensToAllUnnamed(pn);
+            }
+            public void addUses(Module m, Class<?> service) {
+                m.implAddUses(service);
+            }
+            public ServicesCatalog getServicesCatalog(ModuleLayer layer) {
+                return layer.getServicesCatalog();
+            }
+            public Stream<ModuleLayer> layers(ModuleLayer layer) {
+                return layer.layers();
+            }
+            public Stream<ModuleLayer> layers(ClassLoader loader) {
+                return ModuleLayer.layers(loader);
+            }
         });
     }
 }
--- a/jdk/src/java.base/share/classes/java/lang/Thread.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Thread.java	Mon Apr 10 08:31:37 2017 -0700
@@ -927,7 +927,7 @@
      *       for example), the <code>interrupt</code> method should be used to
      *       interrupt the wait.
      *       For more information, see
-     *       <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
+     *       <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
      *       are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
      */
     @Deprecated(since="1.2")
@@ -960,7 +960,7 @@
      *        could be used to generate exceptions that the target thread was
      *        not prepared to handle.
      *        For more information, see
-     *        <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
+     *        <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
      *        are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
      *        This method is subject to removal in a future version of Java SE.
      */
@@ -1082,7 +1082,7 @@
      *     If another thread ever attempted to lock this resource, deadlock
      *     would result. Such deadlocks typically manifest themselves as
      *     "frozen" processes. For more information, see
-     *     <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">
+     *     <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">
      *     Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
      *     This method is subject to removal in a future version of Java SE.
      * @throws NoSuchMethodError always
@@ -1122,7 +1122,7 @@
      *   monitor prior to calling <code>resume</code>, deadlock results.  Such
      *   deadlocks typically manifest themselves as "frozen" processes.
      *   For more information, see
-     *   <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
+     *   <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
      *   are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
      */
     @Deprecated(since="1.2")
@@ -1148,7 +1148,7 @@
      * @deprecated This method exists solely for use with {@link #suspend},
      *     which has been deprecated because it is deadlock-prone.
      *     For more information, see
-     *     <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
+     *     <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
      *     are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
      */
     @Deprecated(since="1.2")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/WeakPairMap.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.lang;
+
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.BiFunction;
+
+/**
+ * A WeakHashMap-like data structure that uses a pair of weakly-referenced keys
+ * with identity equality semantics to associate a strongly-referenced value.
+ * Unlike WeakHashMap, this data structure is thread-safe.
+ *
+ * @param <K1> the type of 1st key in key pair
+ * @param <K2> the type of 2nd key in key pair
+ * @param <V>  the type of value
+ * @author Peter Levart
+ */
+final class WeakPairMap<K1, K2, V> {
+
+    private final ConcurrentHashMap<Pair<K1, K2>, V> map = new ConcurrentHashMap<>();
+    private final ReferenceQueue<Object> queue = new ReferenceQueue<>();
+
+    /**
+     * Tests if the specified pair of keys are associated with a value
+     * in the WeakPairMap.
+     *
+     * @param k1 the 1st of the pair of keys
+     * @param k2 the 2nd of the pair of keys
+     * @return true if and only if the specified key pair is in this WeakPairMap,
+     * as determined by the identity comparison; false otherwise
+     * @throws NullPointerException if any of the specified keys is null
+     */
+    public boolean containsKeyPair(K1 k1, K2 k2) {
+        expungeStaleAssociations();
+        return map.containsKey(Pair.lookup(k1, k2));
+    }
+
+    /**
+     * Returns the value to which the specified pair of keys is mapped, or null
+     * if this WeakPairMap contains no mapping for the key pair.
+     * <p>More formally, if this WeakPairMap contains a mapping from a key pair
+     * {@code (_k1, _k2)} to a value {@code v} such that
+     * {@code k1 == _k1 && k2 == _k2}, then this method returns {@code v};
+     * otherwise it returns {@code null}.
+     * (There can be at most one such mapping.)
+     *
+     * @param k1 the 1st of the pair of keys for which the mapped value is to
+     *           be returned
+     * @param k2 the 2nd of the pair of keys for which the mapped value is to
+     *           be returned
+     * @return the value to which the specified key pair is mapped, or null if
+     * this map contains no mapping for the key pair
+     * @throws NullPointerException if any of the specified keys is null
+     */
+    public V get(K1 k1, K2 k2) {
+        expungeStaleAssociations();
+        return map.get(Pair.lookup(k1, k2));
+    }
+
+    /**
+     * Maps the specified key pair to the specified value in this WeakPairMap.
+     * Neither the keys nor the value can be null.
+     * <p>The value can be retrieved by calling the {@link #get} method
+     * with the the same keys (compared by identity).
+     *
+     * @param k1 the 1st of the pair of keys with which the specified value is to
+     *           be associated
+     * @param k2 the 2nd of the pair of keys with which the specified value is to
+     *           be associated
+     * @param v  value to be associated with the specified key pair
+     * @return the previous value associated with key pair, or {@code null} if
+     * there was no mapping for key pair
+     * @throws NullPointerException if any of the specified keys or value is null
+     */
+    public V put(K1 k1, K2 k2, V v) {
+        expungeStaleAssociations();
+        return map.put(Pair.weak(k1, k2, queue), v);
+    }
+
+    /**
+     * If the specified key pair is not already associated with a value,
+     * associates it with the given value and returns {@code null}, else does
+     * nothing and returns the currently associated value.
+     *
+     * @param k1 the 1st of the pair of keys with which the specified value is to
+     *           be associated
+     * @param k2 the 2nd of the pair of keys with which the specified value is to
+     *           be associated
+     * @param v  value to be associated with the specified key pair
+     * @return the previous value associated with key pair, or {@code null} if
+     * there was no mapping for key pair
+     * @throws NullPointerException if any of the specified keys or value is null
+     */
+    public V putIfAbsent(K1 k1, K2 k2, V v) {
+        expungeStaleAssociations();
+        return map.putIfAbsent(Pair.weak(k1, k2, queue), v);
+    }
+
+    /**
+     * If the specified key pair is not already associated with a value,
+     * attempts to compute its value using the given mapping function
+     * and enters it into this WeakPairMap unless {@code null}. The entire
+     * method invocation is performed atomically, so the function is
+     * applied at most once per key pair. Some attempted update operations
+     * on this WeakPairMap by other threads may be blocked while computation
+     * is in progress, so the computation should be short and simple,
+     * and must not attempt to update any other mappings of this WeakPairMap.
+     *
+     * @param k1              the 1st of the pair of keys with which the
+     *                        computed value is to be associated
+     * @param k2              the 2nd of the pair of keys with which the
+     *                        computed value is to be associated
+     * @param mappingFunction the function to compute a value
+     * @return the current (existing or computed) value associated with
+     * the specified key pair, or null if the computed value is null
+     * @throws NullPointerException  if any of the specified keys or
+     *                               mappingFunction is null
+     * @throws IllegalStateException if the computation detectably
+     *                               attempts a recursive update to this map
+     *                               that would otherwise never complete
+     * @throws RuntimeException      or Error if the mappingFunction does so, in
+     *                               which case the mapping is left unestablished
+     */
+    public V computeIfAbsent(K1 k1, K2 k2,
+                             BiFunction<? super K1, ? super K2, ? extends V>
+                                 mappingFunction) {
+        expungeStaleAssociations();
+        try {
+            return map.computeIfAbsent(
+                Pair.weak(k1, k2, queue),
+                pair -> mappingFunction.apply(pair.first(), pair.second()));
+        } finally {
+            Reference.reachabilityFence(k1);
+            Reference.reachabilityFence(k2);
+        }
+    }
+
+    /**
+     * Returns a {@link Collection} view of the values contained in this
+     * WeakPairMap. The collection is backed by the WeakPairMap, so changes to
+     * the map are reflected in the collection, and vice-versa.  The collection
+     * supports element removal, which removes the corresponding
+     * mapping from this map, via the {@code Iterator.remove},
+     * {@code Collection.remove}, {@code removeAll},
+     * {@code retainAll}, and {@code clear} operations.  It does not
+     * support the {@code add} or {@code addAll} operations.
+     *
+     * @return the collection view
+     */
+    public Collection<V> values() {
+        expungeStaleAssociations();
+        return map.values();
+    }
+
+    /**
+     * Removes associations from this WeakPairMap for which at least one of the
+     * keys in key pair has been found weakly-reachable and corresponding
+     * WeakRefPeer(s) enqueued. Called as part of each public operation.
+     */
+    private void expungeStaleAssociations() {
+        WeakRefPeer<?> peer;
+        while ((peer = (WeakRefPeer<?>) queue.poll()) != null) {
+            map.remove(peer.weakPair());
+        }
+    }
+
+    /**
+     * Common interface of both {@link Weak} and {@link Lookup} key pairs.
+     */
+    private interface Pair<K1, K2> {
+
+        static <K1, K2> Pair<K1, K2> weak(K1 k1, K2 k2,
+                                          ReferenceQueue<Object> queue) {
+            return new Weak<>(k1, k2, queue);
+        }
+
+        static <K1, K2> Pair<K1, K2> lookup(K1 k1, K2 k2) {
+            return new Lookup<>(k1, k2);
+        }
+
+        /**
+         * @return The 1st of the pair of keys (may be null for {@link Weak}
+         * when it gets cleared)
+         */
+        K1 first();
+
+        /**
+         * @return The 2nd of the pair of keys (may be null for {@link Weak}
+         * when it gets cleared)
+         */
+        K2 second();
+
+        static int hashCode(Object first, Object second) {
+            // assert first != null && second != null;
+            return System.identityHashCode(first) ^
+                   System.identityHashCode(second);
+        }
+
+        static boolean equals(Object first, Object second, Pair<?, ?> p) {
+            return first != null && second != null &&
+                   first == p.first() && second == p.second();
+        }
+
+        /**
+         * A Pair where both keys are weakly-referenced.
+         * It is composed of two instances of {@link WeakRefPeer}s:
+         * <pre>{@code
+         *
+         *     +-referent-> [K1]                +-referent-> [K2]
+         *     |                                |
+         *   +----------------+               +----------------+
+         *   | Pair.Weak <:   |-----peer----->| (anonymous) <: |
+         *   | WeakRefPeer,   |               | WeakRefPeer    |
+         *   | Pair           |<--weakPair()--|                |
+         *   +----------------+               +----------------+
+         *     |            ^
+         *     |            |
+         *     +-weakPair()-+
+         *
+         * }</pre>
+         * <p>
+         * Pair.Weak is used for CHM keys. Both peers are associated with the
+         * same {@link ReferenceQueue} so when either of their referents
+         * becomes weakly-reachable, the corresponding entries can be
+         * {@link #expungeStaleAssociations() expunged} from the map.
+         */
+        final class Weak<K1, K2> extends WeakRefPeer<K1> implements Pair<K1, K2> {
+
+            // saved hash so it can be retrieved after the reference is cleared
+            private final int hash;
+            // link to <K2> peer
+            private final WeakRefPeer<K2> peer;
+
+            Weak(K1 k1, K2 k2, ReferenceQueue<Object> queue) {
+                super(k1, queue);
+                hash = Pair.hashCode(k1, k2);
+                peer = new WeakRefPeer<>(k2, queue) {
+                    // link back to <K1> peer
+                    @Override
+                    Weak<?, ?> weakPair() { return Weak.this; }
+                };
+            }
+
+            @Override
+            Weak<?, ?> weakPair() {
+                return this;
+            }
+
+            @Override
+            public K1 first() {
+                return get();
+            }
+
+            @Override
+            public K2 second() {
+                return peer.get();
+            }
+
+            @Override
+            public int hashCode() {
+                return hash;
+            }
+
+            @Override
+            public boolean equals(Object obj) {
+                return this == obj ||
+                       (obj instanceof Pair &&
+                        Pair.equals(first(), second(), (Pair<?, ?>) obj));
+            }
+        }
+
+        /**
+         * Optimized lookup Pair, used as lookup key in methods like
+         * {@link java.util.Map#get(Object)} or
+         * {@link java.util.Map#containsKey(Object)}) where
+         * there is a great chance its allocation is eliminated
+         * by escape analysis when such lookups are inlined by JIT.
+         * All its methods are purposely designed so that 'this' is never
+         * passed to any other method or used as identity.
+         */
+        final class Lookup<K1, K2> implements Pair<K1, K2> {
+            private final K1 k1;
+            private final K2 k2;
+
+            Lookup(K1 k1, K2 k2) {
+                this.k1 = Objects.requireNonNull(k1);
+                this.k2 = Objects.requireNonNull(k2);
+            }
+
+            @Override
+            public K1 first() {
+                return k1;
+            }
+
+            @Override
+            public K2 second() {
+                return k2;
+            }
+
+            @Override
+            public int hashCode() {
+                return Pair.hashCode(k1, k2);
+            }
+
+            @Override
+            public boolean equals(Object obj) {
+                return obj instanceof Pair &&
+                       Pair.equals(k1, k2, (Pair<?, ?>) obj);
+            }
+        }
+    }
+
+    /**
+     * Common abstract supertype of a pair of WeakReference peers.
+     */
+    private static abstract class WeakRefPeer<K> extends WeakReference<K> {
+
+        WeakRefPeer(K k, ReferenceQueue<Object> queue) {
+            super(Objects.requireNonNull(k), queue);
+        }
+
+        /**
+         * @return the {@link Pair.Weak} side of the pair of peers.
+         */
+        abstract Pair.Weak<?, ?> weakPair();
+    }
+}
--- a/jdk/src/java.base/share/classes/java/lang/annotation/ElementType.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/annotation/ElementType.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 /**
  * The constants of this enumerated type provide a simple classification of the
  * syntactic locations where annotations may appear in a Java program. These
- * constants are used in {@link Target java.lang.annotation.Target}
+ * constants are used in {@link java.lang.annotation.Target Target}
  * meta-annotations to specify where it is legal to write annotations of a
  * given type.
  *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,364 @@
+<!--
+ 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.  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.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+  <title>Java Thread Primitive Deprecation</title>
+  <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
+</head>
+<body>
+<h2>Java Thread Primitive Deprecation</h2>
+<hr size="3" noshade="noshade" />
+<h3>Why is <code>Thread.stop</code> deprecated?</h3>
+<p>Because it is inherently unsafe. Stopping a thread causes it to
+unlock all the monitors that it has locked. (The monitors are
+unlocked as the <code>ThreadDeath</code> exception propagates up
+the stack.) If any of the objects previously protected by these
+monitors were in an inconsistent state, other threads may now view
+these objects in an inconsistent state. Such objects are said to be
+<i>damaged</i>. When threads operate on damaged objects, arbitrary
+behavior can result. This behavior may be subtle and difficult to
+detect, or it may be pronounced. Unlike other unchecked exceptions,
+<code>ThreadDeath</code> kills threads silently; thus, the user has
+no warning that his program may be corrupted. The corruption can
+manifest itself at any time after the actual damage occurs, even
+hours or days in the future.</p>
+<hr />
+<h3>Couldn't I just catch the <code>ThreadDeath</code> exception
+and fix the damaged object?</h3>
+<p>In theory, perhaps, but it would <em>vastly</em> complicate the
+task of writing correct multithreaded code. The task would be
+nearly insurmountable for two reasons:</p>
+<ol>
+<li>A thread can throw a <code>ThreadDeath</code> exception
+<i>almost anywhere</i>. All synchronized methods and blocks would
+have to be studied in great detail, with this in mind.</li>
+<li>A thread can throw a second <code>ThreadDeath</code> exception
+while cleaning up from the first (in the <code>catch</code> or
+<code>finally</code> clause). Cleanup would have to be repeated till
+it succeeded. The code to ensure this would be quite complex.</li>
+</ol>
+In sum, it just isn't practical.
+<hr />
+<h3>What about <code>Thread.stop(Throwable)</code>?</h3>
+<p>In addition to all of the problems noted above, this method may
+be used to generate exceptions that its target thread is unprepared
+to handle (including checked exceptions that the thread could not
+possibly throw, were it not for this method). For example, the
+following method is behaviorally identical to Java's
+<code>throw</code> operation, but circumvents the compiler's
+attempts to guarantee that the calling method has declared all of
+the checked exceptions that it may throw:</p>
+<pre>
+    static void sneakyThrow(Throwable t) {
+        Thread.currentThread().stop(t);
+    }
+</pre>
+<hr />
+<h3>What should I use instead of <code>Thread.stop</code>?</h3>
+<p>Most uses of <code>stop</code> should be replaced by code that
+simply modifies some variable to indicate that the target thread
+should stop running. The target thread should check this variable
+regularly, and return from its run method in an orderly fashion if
+the variable indicates that it is to stop running. To ensure prompt
+communication of the stop-request, the variable must be
+<tt>volatile</tt> (or access to the variable must be
+synchronized).</p>
+<p>For example, suppose your applet contains the following
+<code>start</code>, <code>stop</code> and <code>run</code>
+methods:</p>
+<pre>
+    private Thread blinker;
+
+    public void start() {
+        blinker = new Thread(this);
+        blinker.start();
+    }
+
+    public void stop() {
+        blinker.stop();  // UNSAFE!
+    }
+
+    public void run() {
+        while (true) {
+            try {
+                Thread.sleep(interval);
+            } catch (InterruptedException e){
+            }
+            repaint();
+        }
+    }
+</pre>
+You can avoid the use of <code>Thread.stop</code> by replacing the
+applet's <code>stop</code> and <code>run</code> methods with:
+<pre>
+    private volatile Thread blinker;
+
+    public void stop() {
+        blinker = null;
+    }
+
+    public void run() {
+        Thread thisThread = Thread.currentThread();
+        while (blinker == thisThread) {
+            try {
+                Thread.sleep(interval);
+            } catch (InterruptedException e){
+            }
+            repaint();
+        }
+    }
+</pre>
+<hr />
+<h3>How do I stop a thread that waits for long periods (e.g., for
+input)?</h3>
+<p>That's what the <code>Thread.interrupt</code> method is for. The
+same "state based" signaling mechanism shown above can be used, but
+the state change (<code>blinker = null</code>, in the previous
+example) can be followed by a call to
+<code>Thread.interrupt</code>, to interrupt the wait:</p>
+<pre>
+    public void stop() {
+        Thread moribund = waiter;
+        waiter = null;
+        moribund.interrupt();
+    }
+</pre>
+For this technique to work, it's critical that any method that
+catches an interrupt exception and is not prepared to deal with it
+immediately reasserts the exception. We say <em>reasserts</em>
+rather than <em>rethrows</em>, because it is not always possible to
+rethrow the exception. If the method that catches the
+<code>InterruptedException</code> is not declared to throw this
+(checked) exception, then it should "reinterrupt itself" with the
+following incantation:
+<pre>
+    Thread.currentThread().interrupt();
+</pre>
+This ensures that the Thread will reraise the
+<code>InterruptedException</code> as soon as it is able.
+<hr />
+<h3>What if a thread doesn't respond to
+<code>Thread.interrupt</code>?</h3>
+<p>In some cases, you can use application specific tricks. For
+example, if a thread is waiting on a known socket, you can close
+the socket to cause the thread to return immediately.
+Unfortunately, there really isn't any technique that works in
+general. <em>It should be noted that in all situations where a
+waiting thread doesn't respond to <code>Thread.interrupt</code>, it
+wouldn't respond to <code>Thread.stop</code> either.</em> Such
+cases include deliberate denial-of-service attacks, and I/O
+operations for which thread.stop and thread.interrupt do not work
+properly.</p>
+<hr />
+<h3>Why are <code>Thread.suspend</code> and
+<code>Thread.resume</code> deprecated?</h3>
+<p><code>Thread.suspend</code> is inherently deadlock-prone. If the
+target thread holds a lock on the monitor protecting a critical
+system resource when it is suspended, no thread can access this
+resource until the target thread is resumed. If the thread that
+would resume the target thread attempts to lock this monitor prior
+to calling <code>resume</code>, deadlock results. Such deadlocks
+typically manifest themselves as "frozen" processes.</p>
+<hr />
+<h3>What should I use instead of <code>Thread.suspend</code> and
+<code>Thread.resume</code>?</h3>
+<p>As with <code>Thread.stop</code>, the prudent approach is to
+have the "target thread" poll a variable indicating the desired
+state of the thread (active or suspended). When the desired state
+is suspended, the thread waits using <code>Object.wait</code>. When
+the thread is resumed, the target thread is notified using
+<code>Object.notify</code>.</p>
+<p>For example, suppose your applet contains the following
+mousePressed event handler, which toggles the state of a thread
+called <code>blinker</code>:</p>
+<pre>
+    private boolean threadSuspended;
+
+    Public void mousePressed(MouseEvent e) {
+        e.consume();
+
+        if (threadSuspended)
+            blinker.resume();
+        else
+            blinker.suspend();  // DEADLOCK-PRONE!
+
+        threadSuspended = !threadSuspended;
+    }
+</pre>
+You can avoid the use of <code>Thread.suspend</code> and
+<code>Thread.resume</code> by replacing the event handler above
+with:
+<pre>
+    public synchronized void mousePressed(MouseEvent e) {
+        e.consume();
+
+        threadSuspended = !threadSuspended;
+
+        if (!threadSuspended)
+            notify();
+    }
+</pre>
+and adding the following code to the "run loop":
+<pre>
+                synchronized(this) {
+                    while (threadSuspended)
+                        wait();
+                }
+</pre>
+The <code>wait</code> method throws the
+<code>InterruptedException</code>, so it must be inside a <code>try
+... catch</code> clause. It's fine to put it in the same clause as
+the <code>sleep</code>. The check should follow (rather than
+precede) the <code>sleep</code> so the window is immediately
+repainted when the thread is "resumed." The resulting
+<code>run</code> method follows:
+<pre>
+    public void run() {
+        while (true) {
+            try {
+                Thread.sleep(interval);
+
+                synchronized(this) {
+                    while (threadSuspended)
+                        wait();
+                }
+            } catch (InterruptedException e){
+            }
+            repaint();
+        }
+    }
+</pre>
+Note that the <code>notify</code> in the <code>mousePressed</code>
+method and the <code>wait</code> in the <code>run</code> method are
+inside <code>synchronized</code> blocks. This is required by the
+language, and ensures that <code>wait</code> and
+<code>notify</code> are properly serialized. In practical terms,
+this eliminates race conditions that could cause the "suspended"
+thread to miss a <code>notify</code> and remain suspended
+indefinitely.
+<p>While the cost of synchronization in Java is decreasing as the
+platform matures, it will never be free. A simple trick can be used
+to remove the synchronization that we've added to each iteration of
+the "run loop." The synchronized block that was added is replaced
+by a slightly more complex piece of code that enters a synchronized
+block only if the thread has actually been suspended:</p>
+<pre>
+                if (threadSuspended) {
+                    synchronized(this) {
+                        while (threadSuspended)
+                            wait();
+                    }
+                }
+</pre>
+<p>In the absence of explicit synchronization,
+<tt>threadSuspended</tt> must be made <tt>volatile</tt> to ensure
+prompt communication of the suspend-request.</p>
+The resulting <code>run</code> method is:
+<pre>
+    private volatile boolean threadSuspended;
+
+    public void run() {
+        while (true) {
+            try {
+                Thread.sleep(interval);
+
+                if (threadSuspended) {
+                    synchronized(this) {
+                        while (threadSuspended)
+                            wait();
+                    }
+                }
+            } catch (InterruptedException e){
+            }
+            repaint();
+        }
+    }
+</pre>
+<hr size="3" noshade="noshade" />
+<h3>Can I combine the two techniques to produce a thread that may
+be safely "stopped" or "suspended"?</h3>
+Yes, it's reasonably straightforward. The one subtlety is that the
+target thread may already be suspended at the time that another
+thread tries to stop it. If the <tt>stop</tt> method merely sets
+the state variable (<tt>blinker</tt>) to null, the target thread
+will remain suspended (waiting on the monitor), rather than exiting
+gracefully as it should. If the applet is restarted, multiple
+threads could end up waiting on the monitor at the same time,
+resulting in erratic behavior.
+<p>To rectify this situation, the <tt>stop</tt> method must ensure
+that the target thread resumes immediately if it is suspended. Once
+the target thread resumes, it must recognize immediately that it
+has been stopped, and exit gracefully. Here's how the resulting
+<tt>run</tt> and <tt>stop</tt> methods look:</p>
+<pre>
+    public void run() {
+        Thread thisThread = Thread.currentThread();
+        while (blinker == thisThread) {
+            try {
+                Thread.sleep(interval);
+
+                synchronized(this) {
+                    while (threadSuspended &amp;&amp; blinker==thisThread)
+                        wait();
+                }
+            } catch (InterruptedException e){
+            }
+            repaint();
+        }
+    }
+
+    public synchronized void stop() {
+        blinker = null;
+        notify();
+    }
+</pre>
+If the <tt>stop</tt> method calls <tt>Thread.interrupt</tt>, as
+described above, it needn't call <tt>notify</tt> as well, but it
+still must be synchronized. This ensures that the target thread
+won't miss an interrupt due to a race condition.
+<hr />
+<h3>What about <code>Thread.destroy</code>?</h3>
+<code>Thread.destroy</code> was never implemented and has been
+deprecated. If it were implemented, it would be deadlock-prone in
+the manner of <code>Thread.suspend</code>. (In fact, it is roughly
+equivalent to <code>Thread.suspend</code> without the possibility
+of a subsequent <code>Thread.resume</code>.)
+<hr />
+<h3>Why is <code>Runtime.runFinalizersOnExit</code>
+deprecated?</h3>
+Because it is inherently unsafe. It may result in finalizers being
+called on live objects while other threads are concurrently
+manipulating those objects, resulting in erratic behavior or
+deadlock. While this problem could be prevented if the class whose
+objects are being finalized were coded to "defend against" this
+call, most programmers do <i>not</i> defend against it. They assume
+that an object is dead at the time that its finalizer is called.
+<p>Further, the call is not "thread-safe" in the sense that it sets
+a VM-global flag. This forces <i>every</i> class with a finalizer
+to defend against the finalization of live objects!</p>
+<p><!-- Body text ends here --></p>
+</body>
+</html>
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java	Mon Apr 10 08:31:37 2017 -0700
@@ -33,7 +33,6 @@
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Mon Apr 10 08:31:37 2017 -0700
@@ -43,7 +43,6 @@
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.lang.reflect.ReflectPermission;
 import java.nio.ByteOrder;
 import java.security.AccessController;
@@ -668,11 +667,11 @@
          *  The value is {@code 0x20}, which does not correspond meaningfully to
          *  any particular {@linkplain java.lang.reflect.Modifier modifier bit}.
          *  A {@code Lookup} with this lookup mode assumes {@linkplain
-         *  java.lang.reflect.Module#canRead(java.lang.reflect.Module) readability}.
+         *  java.lang.Module#canRead(java.lang.Module) readability}.
          *  In conjunction with the {@code PUBLIC} modifier bit, a {@code Lookup}
          *  with this lookup mode can access all public members of public types
          *  of all modules where the type is in a package that is {@link
-         *  java.lang.reflect.Module#isExported(String) exported unconditionally}.
+         *  java.lang.Module#isExported(String) exported unconditionally}.
          *  @since 9
          *  @spec JPMS
          *  @see #publicLookup()
--- a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java	Mon Apr 10 08:31:37 2017 -0700
@@ -64,11 +64,11 @@
  * with the receiver as the parent configuration. The static methods are for
  * more advanced cases where there can be more than one parent configuration. </p>
  *
- * <p> Each {@link java.lang.reflect.Layer layer} of modules in the Java virtual
+ * <p> Each {@link java.lang.ModuleLayer layer} of modules in the Java virtual
  * machine is created from a configuration. The configuration for the {@link
- * java.lang.reflect.Layer#boot() boot} layer is obtained by invoking {@code
- * Layer.boot().configuration()}. The configuration for the boot layer will
- * often be the parent when creating new configurations. </p>
+ * java.lang.ModuleLayer#boot() boot} layer is obtained by invoking {@code
+ * ModuleLayer.boot().configuration()}. The configuration for the boot layer
+ * will often be the parent when creating new configurations. </p>
  *
  * <h3> Example </h3>
  *
@@ -81,7 +81,7 @@
  * <pre>{@code
  *    ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3);
  *
- *    Configuration parent = Layer.boot().configuration();
+ *    Configuration parent = ModuleLayer.boot().configuration();
  *
  *    Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("myapp"));
  *    cf.modules().forEach(m -> {
@@ -95,7 +95,7 @@
  *
  * @since 9
  * @spec JPMS
- * @see java.lang.reflect.Layer
+ * @see java.lang.ModuleLayer
  */
 public final class Configuration {
 
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java	Mon Apr 10 08:31:37 2017 -0700
@@ -60,7 +60,7 @@
  * <p> A module descriptor describes a named module and defines methods to
  * obtain each of its components. The module descriptor for a named module
  * in the Java virtual machine is obtained by invoking the {@link
- * java.lang.reflect.Module Module}'s {@link java.lang.reflect.Module#getDescriptor
+ * java.lang.Module Module}'s {@link java.lang.Module#getDescriptor
  * getDescriptor} method. Module descriptors can also be created using the
  * {@link ModuleDescriptor.Builder} class or by reading the binary form of a
  * module declaration ({@code module-info.class}) using the {@link
@@ -85,7 +85,7 @@
  * <p> {@code ModuleDescriptor} objects are immutable and safe for use by
  * multiple concurrent threads.</p>
  *
- * @see java.lang.reflect.Module
+ * @see java.lang.Module
  * @since 9
  * @spec JPMS
  */
@@ -2110,7 +2110,9 @@
 
         /**
          * Sets the module main class. The package for the main class is added
-         * to the module if not already added.
+         * to the module if not already added. In other words, this method is
+         * equivalent to first invoking this builder's {@link #packages(Set)
+         * packages} method to add the package name of the main class.
          *
          * @param  mc
          *         The module main class
@@ -2134,8 +2136,8 @@
                     throw new IllegalArgumentException(mc + ": unnamed package");
                 }
             }
+            packages.add(pn);
             mainClass = mc;
-            packages.add(pn);
             return this;
         }
 
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java	Mon Apr 10 08:31:37 2017 -0700
@@ -228,14 +228,14 @@
      * directory is treated as an exploded module rather than a directory of
      * modules. </p>
      *
-     * <p> The module finder returned by this method supports modules that are
-     * packaged as JAR files. A JAR file with a {@code module-info.class} in
-     * the top-level directory of the JAR file (or overridden by a versioned
-     * entry in a {@link java.util.jar.JarFile#isMultiRelease() multi-release}
-     * JAR file) is a modular JAR and is an <em>explicit module</em>.
-     * A JAR file that does not have a {@code module-info.class} in the
-     * top-level directory is created as an automatic module. The components
-     * for the automatic module are derived as follows:
+     * <p id="automatic-modules"> The module finder returned by this method
+     * supports modules packaged as JAR files. A JAR file with a {@code
+     * module-info.class} in its top-level directory, or in a versioned entry
+     * in a {@linkplain java.util.jar.JarFile#isMultiRelease() multi-release}
+     * JAR file, is a modular JAR file and thus defines an <em>explicit</em>
+     * module. A JAR file that does not have a {@code module-info.class} in its
+     * top-level directory defines an <em>automatic module</em>, as follows:
+     * </p>
      *
      * <ul>
      *
@@ -254,16 +254,16 @@
      *         ModuleDescriptor.Version} and ignored if it cannot be parsed as
      *         a {@code Version}. </p></li>
      *
-     *         <li><p> For the module name, then any trailing digits and dots
-     *         are removed, all non-alphanumeric characters ({@code [^A-Za-z0-9]})
-     *         are replaced with a dot ({@code "."}), all repeating dots are
-     *         replaced with one dot, and all leading and trailing dots are
-     *         removed. </p></li>
+     *         <li><p> All non-alphanumeric characters ({@code [^A-Za-z0-9]})
+     *         in the module name are replaced with a dot ({@code "."}), all
+     *         repeating dots are replaced with one dot, and all leading and
+     *         trailing dots are removed. </p></li>
      *
      *         <li><p> As an example, a JAR file named {@code foo-bar.jar} will
      *         derive a module name {@code foo.bar} and no version. A JAR file
-     *         named {@code foo-1.2.3-SNAPSHOT.jar} will derive a module name
-     *         {@code foo} and {@code 1.2.3-SNAPSHOT} as the version. </p></li>
+     *         named {@code foo-bar-1.2.3-SNAPSHOT.jar} will derive a module
+     *         name {@code foo.bar} and {@code 1.2.3-SNAPSHOT} as the version.
+     *         </p></li>
      *
      *     </ul></li>
      *
@@ -312,7 +312,9 @@
      *
      * <p> As with automatic modules, the contents of a packaged or exploded
      * module may need to be <em>scanned</em> in order to determine the packages
-     * in the module. If a {@code .class} file (other than {@code
+     * in the module. Whether {@linkplain java.nio.file.Files#isHidden(Path)
+     * hidden files} are ignored or not is implementation specific and therefore
+     * not specified. If a {@code .class} file (other than {@code
      * module-info.class}) is found in the top-level directory then it is
      * assumed to be a class in the unnamed package and so {@code FindException}
      * is thrown. </p>
--- a/jdk/src/java.base/share/classes/java/lang/module/Resolver.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/module/Resolver.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
 import java.io.PrintStream;
 import java.lang.module.ModuleDescriptor.Provides;
 import java.lang.module.ModuleDescriptor.Requires.Modifier;
-import java.lang.reflect.Layer;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -67,6 +66,9 @@
     // maps module name to module reference
     private final Map<String, ModuleReference> nameToReference = new HashMap<>();
 
+    // true if all automatic modules have been found
+    private boolean haveAllAutomaticModules;
+
     // module constraints on target platform
     private String osName;
     private String osArch;
@@ -171,6 +173,21 @@
             ModuleDescriptor descriptor = q.poll();
             assert nameToReference.containsKey(descriptor.name());
 
+            // if the module is an automatic module then all automatic
+            // modules need to be resolved
+            if (descriptor.isAutomatic() && !haveAllAutomaticModules) {
+                addFoundAutomaticModules().forEach(mref -> {
+                    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));
+                    }
+                });
+                haveAllAutomaticModules = true;
+            }
+
             // process dependences
             for (ModuleDescriptor.Requires requires : descriptor.requires()) {
 
@@ -199,10 +216,15 @@
                 if (!nameToReference.containsKey(dn)) {
                     addFoundModule(mref);
                     q.offer(mref.descriptor());
-                    resolved.add(mref.descriptor());
 
                     if (isTracing()) {
-                        trace("Module %s located, required by %s",
+                        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));
                     }
@@ -250,7 +272,7 @@
 
         // the initial set of modules that may use services
         Set<ModuleDescriptor> initialConsumers;
-        if (Layer.boot() == null) {
+        if (ModuleLayer.boot() == null) {
             initialConsumers = new HashSet<>();
         } else {
             initialConsumers = parents.stream()
@@ -301,6 +323,21 @@
         return this;
     }
 
+    /**
+     * Add all automatic modules that have not already been found to the
+     * nameToReference map.
+     */
+    private Set<ModuleReference> addFoundAutomaticModules() {
+        Set<ModuleReference> result = new HashSet<>();
+        findAll().forEach(mref -> {
+            String mn = mref.descriptor().name();
+            if (mref.descriptor().isAutomatic() && !nameToReference.containsKey(mn)) {
+                addFoundModule(mref);
+                result.add(mref);
+            }
+        });
+        return result;
+    }
 
     /**
      * Add the module to the nameToReference map. Also check any constraints on
@@ -534,7 +571,7 @@
         // need "requires transitive" from the modules in parent configurations
         // as there may be selected modules that have a dependency on modules in
         // the parent configuration.
-        if (Layer.boot() == null) {
+        if (ModuleLayer.boot() == null) {
             g2 = new HashMap<>(capacity);
         } else {
             g2 = parents.stream()
--- a/jdk/src/java.base/share/classes/java/lang/module/package-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/module/package-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -70,7 +70,7 @@
  * } </pre>
  *
  * <p> If module {@code m1} is resolved with the configuration for the {@link
- * java.lang.reflect.Layer#boot() boot} layer as the parent then the resulting
+ * java.lang.ModuleLayer#boot() boot} layer as the parent then the resulting
  * configuration contains two modules ({@code m1}, {@code m2}). The edges in
  * its readability graph are:
  * <pre> {@code
@@ -92,10 +92,10 @@
  *
  * <p> {@link java.lang.module.ModuleDescriptor#isAutomatic() Automatic} modules
  * receive special treatment during resolution. Each automatic module is resolved
- * so that it reads all other modules in the configuration and all parent
- * configurations. Each automatic module is also resolved as if it
- * "{@code requires transitive}" all other automatic modules in the configuration
- * (and all automatic modules in parent configurations). </p>
+ * as if it "{@code requires transitive}" all observable automatic modules and
+ * all automatic modules in the parent configurations. Each automatic module is
+ * resolved so that it reads all other modules in the resulting configuration and
+ * all modules in parent configurations. </p>
  *
  * <h2><a name="servicebinding">Service binding</a></h2>
  *
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java	Mon Apr 10 08:31:37 2017 -0700
@@ -174,7 +174,6 @@
      * @throws SecurityException if the request is denied by the security manager
      *         or this is a constructor for {@code java.lang.Class}
      *
-     * @since 9
      * @spec JPMS
      */
     @Override
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,949 +0,0 @@
-/*
- * 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
- * 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.reflect;
-
-import java.lang.module.Configuration;
-import java.lang.module.ModuleDescriptor;
-import java.lang.module.ResolvedModule;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import jdk.internal.loader.ClassLoaderValue;
-import jdk.internal.loader.Loader;
-import jdk.internal.loader.LoaderPool;
-import jdk.internal.misc.SharedSecrets;
-import jdk.internal.module.Modules;
-import jdk.internal.module.ServicesCatalog;
-import sun.security.util.SecurityConstants;
-
-
-/**
- * A layer of modules in the Java virtual machine.
- *
- * <p> A layer is created from a graph of modules in a {@link Configuration}
- * and a function that maps each module to a {@link ClassLoader}.
- * Creating a layer informs the Java virtual machine about the classes that
- * may be loaded from the modules so that the Java virtual machine knows which
- * module that each class is a member of. </p>
- *
- * <p> Creating a layer creates a {@link Module} object for each {@link
- * ResolvedModule} in the configuration. For each resolved module that is
- * {@link ResolvedModule#reads() read}, the {@code Module} {@link
- * Module#canRead reads} the corresponding run-time {@code Module}, which may
- * be in the same layer or a {@link #parents() parent} layer. </p>
- *
- * <p> The {@link #defineModulesWithOneLoader defineModulesWithOneLoader} and
- * {@link #defineModulesWithManyLoaders defineModulesWithManyLoaders} methods
- * provide convenient ways to create a {@code Layer} where all modules are
- * mapped to a single class loader or where each module is mapped to its own
- * class loader. The {@link #defineModules defineModules} method is for more
- * advanced cases where modules are mapped to custom class loaders by means of
- * a function specified to the method. Each of these methods has an instance
- * and static variant. The instance methods create a layer with the receiver
- * as the parent layer. The static methods are for more advanced cases where
- * there can be more than one parent layer or where a {@link Layer.Controller
- * Controller} is needed to control modules in the layer. </p>
- *
- * <p> A Java virtual machine has at least one non-empty layer, the {@link
- * #boot() boot} layer, that is created when the Java virtual machine is
- * started. The boot layer contains module {@code java.base} and is the only
- * layer in the Java virtual machine with a module named "{@code java.base}".
- * The modules in the boot layer are mapped to the bootstrap class loader and
- * other class loaders that are <a href="../ClassLoader.html#builtinLoaders">
- * built-in</a> into the Java virtual machine. The boot layer will often be
- * the {@link #parents() parent} when creating additional layers. </p>
- *
- * <p> Each {@code Module} in a layer is created so that it {@link
- * Module#isExported(String) exports} and {@link Module#isOpen(String) opens}
- * the packages described by its {@link ModuleDescriptor}. Qualified exports
- * (where a package is exported to a set of target modules rather than all
- * modules) are reified when creating the layer as follows: </p>
- * <ul>
- *     <li> If module {@code X} exports a package to {@code Y}, and if the
- *     runtime {@code Module} {@code X} reads {@code Module} {@code Y}, then
- *     the package is exported to {@code Module} {@code Y} (which may be in
- *     the same layer as {@code X} or a parent layer). </li>
- *
- *     <li> If module {@code X} exports a package to {@code Y}, and if the
- *     runtime {@code Module} {@code X} does not read {@code Y} then target
- *     {@code Y} is located as if by invoking {@link #findModule(String)
- *     findModule} to find the module in the layer or its parent layers. If
- *     {@code Y} is found then the package is exported to the instance of
- *     {@code Y} that was found. If {@code Y} is not found then the qualified
- *     export is ignored. </li>
- * </ul>
- *
- * <p> Qualified opens are handled in same way as qualified exports. </p>
- *
- * <p> As when creating a {@code Configuration},
- * {@link ModuleDescriptor#isAutomatic() automatic} modules receive special
- * treatment when creating a layer. An automatic module is created in the
- * Java virtual machine as a {@code Module} that reads every unnamed {@code
- * Module} in the Java virtual machine. </p>
- *
- * <p> Unless otherwise specified, passing a {@code null} argument to a method
- * in this class causes a {@link NullPointerException NullPointerException} to
- * be thrown. </p>
- *
- * <h3> Example usage: </h3>
- *
- * <p> This example creates a configuration by resolving a module named
- * "{@code myapp}" with the configuration for the boot layer as the parent. It
- * then creates a new layer with the modules in this configuration. All modules
- * are defined to the same class loader. </p>
- *
- * <pre>{@code
- *     ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3);
- *
- *     Layer parent = Layer.boot();
- *
- *     Configuration cf = parent.configuration().resolve(finder, ModuleFinder.of(), Set.of("myapp"));
- *
- *     ClassLoader scl = ClassLoader.getSystemClassLoader();
- *
- *     Layer layer = parent.defineModulesWithOneLoader(cf, scl);
- *
- *     Class<?> c = layer.findLoader("myapp").loadClass("app.Main");
- * }</pre>
- *
- * @since 9
- * @spec JPMS
- * @see Module#getLayer()
- */
-
-public final class Layer {
-
-    // the empty Layer
-    private static final Layer EMPTY_LAYER
-        = new Layer(Configuration.empty(), List.of(), null);
-
-    // the configuration from which this Layer was created
-    private final Configuration cf;
-
-    // parent layers, empty in the case of the empty layer
-    private final List<Layer> parents;
-
-    // maps module name to jlr.Module
-    private final Map<String, Module> nameToModule;
-
-    /**
-     * Creates a new Layer from the modules in the given configuration.
-     */
-    private Layer(Configuration cf,
-                  List<Layer> parents,
-                  Function<String, ClassLoader> clf)
-    {
-        this.cf = cf;
-        this.parents = parents; // no need to do defensive copy
-
-        Map<String, Module> map;
-        if (parents.isEmpty()) {
-            map = Collections.emptyMap();
-        } else {
-            map = Module.defineModules(cf, clf, this);
-        }
-        this.nameToModule = map; // no need to do defensive copy
-    }
-
-    /**
-     * Controls a layer. The static methods defined by {@link Layer} to create
-     * module layers return a {@code Controller} that can be used to control
-     * modules in the layer.
-     *
-     * <p> Unless otherwise specified, passing a {@code null} argument to a
-     * method in this class causes a {@link NullPointerException
-     * NullPointerException} to be thrown. </p>
-     *
-     * @apiNote Care should be taken with {@code Controller} objects, they
-     * should never be shared with untrusted code.
-     *
-     * @since 9
-     * @spec JPMS
-     */
-    public static final class Controller {
-        private final Layer layer;
-
-        Controller(Layer layer) {
-            this.layer = layer;
-        }
-
-        /**
-         * Returns the layer that this object controls.
-         *
-         * @return the layer
-         */
-        public Layer layer() {
-            return layer;
-        }
-
-        private void ensureInLayer(Module source) {
-            if (source.getLayer() != layer)
-                throw new IllegalArgumentException(source + " not in layer");
-        }
-
-
-        /**
-         * Updates module {@code source} in the layer to read module
-         * {@code target}. This method is a no-op if {@code source} already
-         * reads {@code target}.
-         *
-         * @implNote <em>Read edges</em> added by this method are <em>weak</em>
-         * and do not prevent {@code target} from being GC'ed when {@code source}
-         * is strongly reachable.
-         *
-         * @param  source
-         *         The source module
-         * @param  target
-         *         The target module to read
-         *
-         * @return This controller
-         *
-         * @throws IllegalArgumentException
-         *         If {@code source} is not in the layer
-         *
-         * @see Module#addReads
-         */
-        public Controller addReads(Module source, Module target) {
-            ensureInLayer(source);
-            Objects.requireNonNull(target);
-            Modules.addReads(source, target);
-            return this;
-        }
-
-        /**
-         * Updates module {@code source} in the layer to open a package to
-         * module {@code target}. This method is a no-op if {@code source}
-         * already opens the package to at least {@code target}.
-         *
-         * @param  source
-         *         The source module
-         * @param  pn
-         *         The package name
-         * @param  target
-         *         The target module to read
-         *
-         * @return This controller
-         *
-         * @throws IllegalArgumentException
-         *         If {@code source} is not in the layer or the package is not
-         *         in the source module
-         *
-         * @see Module#addOpens
-         */
-        public Controller addOpens(Module source, String pn, Module target) {
-            ensureInLayer(source);
-            Objects.requireNonNull(pn);
-            Objects.requireNonNull(target);
-            Modules.addOpens(source, pn, target);
-            return this;
-        }
-    }
-
-
-    /**
-     * Creates a new layer, with this layer as its parent, by defining the
-     * modules in the given {@code Configuration} to the Java virtual machine.
-     * This method creates one class loader and defines all modules to that
-     * class loader. The {@link ClassLoader#getParent() parent} of each class
-     * loader is the given parent class loader. This method works exactly as
-     * specified by the static {@link
-     * #defineModulesWithOneLoader(Configuration,List,ClassLoader)
-     * defineModulesWithOneLoader} method when invoked with this layer as the
-     * parent. In other words, if this layer is {@code thisLayer} then this
-     * method is equivalent to invoking:
-     * <pre> {@code
-     *     Layer.defineModulesWithOneLoader(cf, List.of(thisLayer), parentLoader).layer();
-     * }</pre>
-     *
-     * @param  cf
-     *         The configuration for the layer
-     * @param  parentLoader
-     *         The parent class loader for the class loader created by this
-     *         method; may be {@code null} for the bootstrap class loader
-     *
-     * @return The newly created layer
-     *
-     * @throws IllegalArgumentException
-     *         If the parent of the given configuration is not the configuration
-     *         for this layer
-     * @throws LayerInstantiationException
-     *         If the layer cannot be created for any of the reasons specified
-     *         by the static {@code defineModulesWithOneLoader} method
-     * @throws SecurityException
-     *         If {@code RuntimePermission("createClassLoader")} or
-     *         {@code RuntimePermission("getClassLoader")} is denied by
-     *         the security manager
-     *
-     * @see #findLoader
-     */
-    public Layer defineModulesWithOneLoader(Configuration cf,
-                                            ClassLoader parentLoader) {
-        return defineModulesWithOneLoader(cf, List.of(this), parentLoader).layer();
-    }
-
-
-    /**
-     * Creates a new layer, with this layer as its parent, by defining the
-     * modules in the given {@code Configuration} to the Java virtual machine.
-     * Each module is defined to its own {@link ClassLoader} created by this
-     * method. The {@link ClassLoader#getParent() parent} of each class loader
-     * is the given parent class loader. This method works exactly as specified
-     * by the static {@link
-     * #defineModulesWithManyLoaders(Configuration,List,ClassLoader)
-     * defineModulesWithManyLoaders} method when invoked with this layer as the
-     * parent. In other words, if this layer is {@code thisLayer} then this
-     * method is equivalent to invoking:
-     * <pre> {@code
-     *     Layer.defineModulesWithManyLoaders(cf, List.of(thisLayer), parentLoader).layer();
-     * }</pre>
-     *
-     * @param  cf
-     *         The configuration for the layer
-     * @param  parentLoader
-     *         The parent class loader for each of the class loaders created by
-     *         this method; may be {@code null} for the bootstrap class loader
-     *
-     * @return The newly created layer
-     *
-     * @throws IllegalArgumentException
-     *         If the parent of the given configuration is not the configuration
-     *         for this layer
-     * @throws LayerInstantiationException
-     *         If the layer cannot be created for any of the reasons specified
-     *         by the static {@code defineModulesWithManyLoaders} method
-     * @throws SecurityException
-     *         If {@code RuntimePermission("createClassLoader")} or
-     *         {@code RuntimePermission("getClassLoader")} is denied by
-     *         the security manager
-     *
-     * @see #findLoader
-     */
-    public Layer defineModulesWithManyLoaders(Configuration cf,
-                                              ClassLoader parentLoader) {
-        return defineModulesWithManyLoaders(cf, List.of(this), parentLoader).layer();
-    }
-
-
-    /**
-     * Creates a new layer, with this layer as its parent, by defining the
-     * modules in the given {@code Configuration} to the Java virtual machine.
-     * Each module is mapped, by name, to its class loader by means of the
-     * given function. This method works exactly as specified by the static
-     * {@link #defineModules(Configuration,List,Function) defineModules}
-     * method when invoked with this layer as the parent. In other words, if
-     * this layer is {@code thisLayer} then this method is equivalent to
-     * invoking:
-     * <pre> {@code
-     *     Layer.defineModules(cf, List.of(thisLayer), clf).layer();
-     * }</pre>
-     *
-     * @param  cf
-     *         The configuration for the layer
-     * @param  clf
-     *         The function to map a module name to a class loader
-     *
-     * @return The newly created layer
-     *
-     * @throws IllegalArgumentException
-     *         If the parent of the given configuration is not the configuration
-     *         for this layer
-     * @throws LayerInstantiationException
-     *         If the layer cannot be created for any of the reasons specified
-     *         by the static {@code defineModules} method
-     * @throws SecurityException
-     *         If {@code RuntimePermission("getClassLoader")} is denied by
-     *         the security manager
-     */
-    public Layer defineModules(Configuration cf,
-                               Function<String, ClassLoader> clf) {
-        return defineModules(cf, List.of(this), clf).layer();
-    }
-
-    /**
-     * Creates a new layer by defining the modules in the given {@code
-     * Configuration} to the Java virtual machine. This method creates one
-     * class loader and defines all modules to that class loader.
-     *
-     * <p> The class loader created by this method implements <em>direct
-     * delegation</em> when loading types from modules. When its {@link
-     * ClassLoader#loadClass(String, boolean) loadClass} method is invoked to
-     * load a class then it uses the package name of the class to map it to a
-     * module. This may be a module in this layer and hence defined to the same
-     * class loader. It may be a package in a module in a parent layer that is
-     * exported to one or more of the modules in this layer. The class
-     * loader delegates to the class loader of the module, throwing {@code
-     * ClassNotFoundException} if not found by that class loader.
-     * When {@code loadClass} is invoked to load classes that do not map to a
-     * module then it delegates to the parent class loader. </p>
-     *
-     * <p> Attempting to create a layer with all modules defined to the same
-     * class loader can fail for the following reasons:
-     *
-     * <ul>
-     *
-     *     <li><p> <em>Overlapping packages</em>: Two or more modules in the
-     *     configuration have the same package. </p></li>
-     *
-     *     <li><p> <em>Split delegation</em>: The resulting class loader would
-     *     need to delegate to more than one class loader in order to load types
-     *     in a specific package. </p></li>
-     *
-     * </ul>
-     *
-     * <p> In addition, a layer cannot be created if the configuration contains
-     * a module named "{@code java.base}", or a module contains a package named
-     * "{@code java}" or a package with a name starting with "{@code java.}". </p>
-     *
-     * <p> If there is a security manager then the class loader created by
-     * this method will load classes and resources with privileges that are
-     * restricted by the calling context of this method. </p>
-     *
-     * @param  cf
-     *         The configuration for the layer
-     * @param  parentLayers
-     *         The list of parent layers in search order
-     * @param  parentLoader
-     *         The parent class loader for the class loader created by this
-     *         method; may be {@code null} for the bootstrap class loader
-     *
-     * @return A controller that controls the newly created layer
-     *
-     * @throws IllegalArgumentException
-     *         If the parent configurations do not match the configuration of
-     *         the parent layers, including order
-     * @throws LayerInstantiationException
-     *         If all modules cannot be defined to the same class loader for any
-     *         of the reasons listed above
-     * @throws SecurityException
-     *         If {@code RuntimePermission("createClassLoader")} or
-     *         {@code RuntimePermission("getClassLoader")} is denied by
-     *         the security manager
-     *
-     * @see #findLoader
-     */
-    public static Controller defineModulesWithOneLoader(Configuration cf,
-                                                        List<Layer> parentLayers,
-                                                        ClassLoader parentLoader)
-    {
-        List<Layer> parents = new ArrayList<>(parentLayers);
-        checkConfiguration(cf, parents);
-
-        checkCreateClassLoaderPermission();
-        checkGetClassLoaderPermission();
-
-        try {
-            Loader loader = new Loader(cf.modules(), parentLoader);
-            loader.initRemotePackageMap(cf, parents);
-            Layer layer =  new Layer(cf, parents, mn -> loader);
-            return new Controller(layer);
-        } catch (IllegalArgumentException | IllegalStateException e) {
-            throw new LayerInstantiationException(e.getMessage());
-        }
-    }
-
-    /**
-     * Creates a new layer by defining the modules in the given {@code
-     * Configuration} to the Java virtual machine. Each module is defined to
-     * its own {@link ClassLoader} created by this method. The {@link
-     * ClassLoader#getParent() parent} of each class loader is the given parent
-     * class loader.
-     *
-     * <p> The class loaders created by this method implement <em>direct
-     * delegation</em> when loading types from modules. When {@link
-     * ClassLoader#loadClass(String, boolean) loadClass} method is invoked to
-     * load a class then it uses the package name of the class to map it to a
-     * module. The package may be in the module defined to the class loader.
-     * The package may be exported by another module in this layer to the
-     * module defined to the class loader. It may be in a package exported by a
-     * module in a parent layer. The class loader delegates to the class loader
-     * of the module, throwing {@code ClassNotFoundException} if not found by
-     * that class loader.
-     * When {@code loadClass} is invoked to load classes that do not map to a
-     * module then it delegates to the parent class loader. </p>
-     *
-     * <p> If there is a security manager then the class loaders created by
-     * this method will load classes and resources with privileges that are
-     * restricted by the calling context of this method. </p>
-     *
-     * @param  cf
-     *         The configuration for the layer
-     * @param  parentLayers
-     *         The list of parent layers in search order
-     * @param  parentLoader
-     *         The parent class loader for each of the class loaders created by
-     *         this method; may be {@code null} for the bootstrap class loader
-     *
-     * @return A controller that controls the newly created layer
-     *
-     * @throws IllegalArgumentException
-     *         If the parent configurations do not match the configuration of
-     *         the parent layers, including order
-     * @throws LayerInstantiationException
-     *         If the layer cannot be created because the configuration contains
-     *         a module named "{@code java.base}" or a module contains a package
-     *         named "{@code java}" or a package with a name starting with
-     *         "{@code java.}"
-     *
-     * @throws SecurityException
-     *         If {@code RuntimePermission("createClassLoader")} or
-     *         {@code RuntimePermission("getClassLoader")} is denied by
-     *         the security manager
-     *
-     * @see #findLoader
-     */
-    public static Controller defineModulesWithManyLoaders(Configuration cf,
-                                                          List<Layer> parentLayers,
-                                                          ClassLoader parentLoader)
-    {
-        List<Layer> parents = new ArrayList<>(parentLayers);
-        checkConfiguration(cf, parents);
-
-        checkCreateClassLoaderPermission();
-        checkGetClassLoaderPermission();
-
-        LoaderPool pool = new LoaderPool(cf, parents, parentLoader);
-        try {
-            Layer layer = new Layer(cf, parents, pool::loaderFor);
-            return new Controller(layer);
-        } catch (IllegalArgumentException | IllegalStateException e) {
-            throw new LayerInstantiationException(e.getMessage());
-        }
-    }
-
-    /**
-     * Creates a new layer by defining the modules in the given {@code
-     * Configuration} to the Java virtual machine. The given function maps each
-     * module in the configuration, by name, to a class loader. Creating the
-     * layer informs the Java virtual machine about the classes that may be
-     * loaded so that the Java virtual machine knows which module that each
-     * class is a member of.
-     *
-     * <p> The class loader delegation implemented by the class loaders must
-     * respect module readability. The class loaders should be
-     * {@link ClassLoader#registerAsParallelCapable parallel-capable} so as to
-     * avoid deadlocks during class loading. In addition, the entity creating
-     * a new layer with this method should arrange that the class loaders be
-     * ready to load from these modules before there are any attempts to load
-     * classes or resources. </p>
-     *
-     * <p> Creating a {@code Layer} can fail for the following reasons: </p>
-     *
-     * <ul>
-     *
-     *     <li><p> Two or more modules with the same package are mapped to the
-     *     same class loader. </p></li>
-     *
-     *     <li><p> A module is mapped to a class loader that already has a
-     *     module of the same name defined to it. </p></li>
-     *
-     *     <li><p> A module is mapped to a class loader that has already
-     *     defined types in any of the packages in the module. </p></li>
-     *
-     * </ul>
-     *
-     * <p> In addition, a layer cannot be created if the configuration contains
-     * a module named "{@code java.base}", a configuration contains a module
-     * with a package named "{@code java}" or a package name starting with
-     * "{@code java.}" and the module is mapped to a class loader other than
-     * the {@link ClassLoader#getPlatformClassLoader() platform class loader},
-     * or the function to map a module name to a class loader returns
-     * {@code null}. </p>
-     *
-     * <p> If the function to map a module name to class loader throws an error
-     * or runtime exception then it is propagated to the caller of this method.
-     * </p>
-     *
-     * @apiNote It is implementation specific as to whether creating a Layer
-     * with this method is an atomic operation or not. Consequentially it is
-     * possible for this method to fail with some modules, but not all, defined
-     * to the Java virtual machine.
-     *
-     * @param  cf
-     *         The configuration for the layer
-     * @param  parentLayers
-     *         The list of parent layers in search order
-     * @param  clf
-     *         The function to map a module name to a class loader
-     *
-     * @return A controller that controls the newly created layer
-     *
-     * @throws IllegalArgumentException
-     *         If the parent configurations do not match the configuration of
-     *         the parent layers, including order
-     * @throws LayerInstantiationException
-     *         If creating the layer fails for any of the reasons listed above
-     * @throws SecurityException
-     *         If {@code RuntimePermission("getClassLoader")} is denied by
-     *         the security manager
-     */
-    public static Controller defineModules(Configuration cf,
-                                           List<Layer> parentLayers,
-                                           Function<String, ClassLoader> clf)
-    {
-        List<Layer> parents = new ArrayList<>(parentLayers);
-        checkConfiguration(cf, parents);
-        Objects.requireNonNull(clf);
-
-        checkGetClassLoaderPermission();
-
-        // The boot layer is checked during module system initialization
-        if (boot() != null) {
-            checkForDuplicatePkgs(cf, clf);
-        }
-
-        try {
-            Layer layer = new Layer(cf, parents, clf);
-            return new Controller(layer);
-        } catch (IllegalArgumentException | IllegalStateException e) {
-            throw new LayerInstantiationException(e.getMessage());
-        }
-    }
-
-
-    /**
-     * Checks that the parent configurations match the configuration of
-     * the parent layers.
-     */
-    private static void checkConfiguration(Configuration cf,
-                                           List<Layer> parentLayers)
-    {
-        Objects.requireNonNull(cf);
-
-        List<Configuration> parentConfigurations = cf.parents();
-        if (parentLayers.size() != parentConfigurations.size())
-            throw new IllegalArgumentException("wrong number of parents");
-
-        int index = 0;
-        for (Layer parent : parentLayers) {
-            if (parent.configuration() != parentConfigurations.get(index)) {
-                throw new IllegalArgumentException(
-                        "Parent of configuration != configuration of this Layer");
-            }
-            index++;
-        }
-    }
-
-    private static void checkCreateClassLoaderPermission() {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null)
-            sm.checkPermission(SecurityConstants.CREATE_CLASSLOADER_PERMISSION);
-    }
-
-    private static void checkGetClassLoaderPermission() {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null)
-            sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
-    }
-
-    /**
-     * Checks a configuration and the module-to-loader mapping to ensure that
-     * no two modules mapped to the same class loader have the same package.
-     * It also checks that no two automatic modules have the same package.
-     *
-     * @throws LayerInstantiationException
-     */
-    private static void checkForDuplicatePkgs(Configuration cf,
-                                              Function<String, ClassLoader> clf)
-    {
-        // HashMap allows null keys
-        Map<ClassLoader, Set<String>> loaderToPackages = new HashMap<>();
-        for (ResolvedModule resolvedModule : cf.modules()) {
-            ModuleDescriptor descriptor = resolvedModule.reference().descriptor();
-            ClassLoader loader = clf.apply(descriptor.name());
-
-            Set<String> loaderPackages
-                = loaderToPackages.computeIfAbsent(loader, k -> new HashSet<>());
-
-            for (String pkg : descriptor.packages()) {
-                boolean added = loaderPackages.add(pkg);
-                if (!added) {
-                    throw fail("More than one module with package %s mapped" +
-                               " to the same class loader", pkg);
-                }
-            }
-        }
-    }
-
-    /**
-     * Creates a LayerInstantiationException with the a message formatted from
-     * the given format string and arguments.
-     */
-    private static LayerInstantiationException fail(String fmt, Object ... args) {
-        String msg = String.format(fmt, args);
-        return new LayerInstantiationException(msg);
-    }
-
-
-    /**
-     * Returns the configuration for this layer.
-     *
-     * @return The configuration for this layer
-     */
-    public Configuration configuration() {
-        return cf;
-    }
-
-
-    /**
-     * Returns the list of this layer's parents unless this is the
-     * {@linkplain #empty empty layer}, which has no parents and so an
-     * empty list is returned.
-     *
-     * @return The list of this layer's parents
-     */
-    public List<Layer> parents() {
-        return parents;
-    }
-
-
-    /**
-     * Returns an ordered stream of layers. The first element is is this layer,
-     * the remaining elements are the parent layers in DFS order.
-     *
-     * @implNote For now, the assumption is that the number of elements will
-     * be very low and so this method does not use a specialized spliterator.
-     */
-    Stream<Layer> layers() {
-        List<Layer> allLayers = this.allLayers;
-        if (allLayers != null)
-            return allLayers.stream();
-
-        allLayers = new ArrayList<>();
-        Set<Layer> visited = new HashSet<>();
-        Deque<Layer> stack = new ArrayDeque<>();
-        visited.add(this);
-        stack.push(this);
-
-        while (!stack.isEmpty()) {
-            Layer layer = stack.pop();
-            allLayers.add(layer);
-
-            // push in reverse order
-            for (int i = layer.parents.size() - 1; i >= 0; i--) {
-                Layer parent = layer.parents.get(i);
-                if (!visited.contains(parent)) {
-                    visited.add(parent);
-                    stack.push(parent);
-                }
-            }
-        }
-
-        this.allLayers = allLayers = Collections.unmodifiableList(allLayers);
-        return allLayers.stream();
-    }
-
-    private volatile List<Layer> allLayers;
-
-    /**
-     * Returns the set of the modules in this layer.
-     *
-     * @return A possibly-empty unmodifiable set of the modules in this layer
-     */
-    public Set<Module> modules() {
-        Set<Module> modules = this.modules;
-        if (modules == null) {
-            this.modules = modules =
-                Collections.unmodifiableSet(new HashSet<>(nameToModule.values()));
-        }
-        return modules;
-    }
-
-    private volatile Set<Module> modules;
-
-
-    /**
-     * Returns the module with the given name in this layer, or if not in this
-     * layer, the {@linkplain #parents parent} layers. Finding a module in
-     * parent layers is equivalent to invoking {@code findModule} on each
-     * parent, in search order, until the module is found or all parents have
-     * been searched. In a <em>tree of layers</em>  then this is equivalent to
-     * a depth-first search.
-     *
-     * @param  name
-     *         The name of the module to find
-     *
-     * @return The module with the given name or an empty {@code Optional}
-     *         if there isn't a module with this name in this layer or any
-     *         parent layer
-     */
-    public Optional<Module> findModule(String name) {
-        Objects.requireNonNull(name);
-        if (this == EMPTY_LAYER)
-            return Optional.empty();
-        Module m = nameToModule.get(name);
-        if (m != null)
-            return Optional.of(m);
-
-        return layers()
-                .skip(1)  // skip this layer
-                .map(l -> l.nameToModule)
-                .filter(map -> map.containsKey(name))
-                .map(map -> map.get(name))
-                .findAny();
-    }
-
-
-    /**
-     * Returns the {@code ClassLoader} for the module with the given name. If
-     * a module of the given name is not in this layer then the {@link #parents
-     * parent} layers are searched in the manner specified by {@link
-     * #findModule(String) findModule}.
-     *
-     * <p> If there is a security manager then its {@code checkPermission}
-     * method is called with a {@code RuntimePermission("getClassLoader")}
-     * permission to check that the caller is allowed to get access to the
-     * class loader. </p>
-     *
-     * @apiNote This method does not return an {@code Optional<ClassLoader>}
-     * because `null` must be used to represent the bootstrap class loader.
-     *
-     * @param  name
-     *         The name of the module to find
-     *
-     * @return The ClassLoader that the module is defined to
-     *
-     * @throws IllegalArgumentException if a module of the given name is not
-     *         defined in this layer or any parent of this layer
-     *
-     * @throws SecurityException if denied by the security manager
-     */
-    public ClassLoader findLoader(String name) {
-        Optional<Module> om = findModule(name);
-
-        // can't use map(Module::getClassLoader) as class loader can be null
-        if (om.isPresent()) {
-            return om.get().getClassLoader();
-        } else {
-            throw new IllegalArgumentException("Module " + name
-                                               + " not known to this layer");
-        }
-    }
-
-    /**
-     * Returns a string describing this layer.
-     *
-     * @return A possibly empty string describing this layer
-     */
-    @Override
-    public String toString() {
-        return modules().stream()
-                .map(Module::getName)
-                .collect(Collectors.joining(", "));
-    }
-
-    /**
-     * Returns the <em>empty</em> layer. There are no modules in the empty
-     * layer. It has no parents.
-     *
-     * @return The empty layer
-     */
-    public static Layer empty() {
-        return EMPTY_LAYER;
-    }
-
-
-    /**
-     * Returns the boot layer. The boot layer contains at least one module,
-     * {@code java.base}. Its parent is the {@link #empty() empty} layer.
-     *
-     * @apiNote This method returns {@code null} during startup and before
-     *          the boot layer is fully initialized.
-     *
-     * @return The boot layer
-     */
-    public static Layer boot() {
-        return SharedSecrets.getJavaLangAccess().getBootLayer();
-    }
-
-
-    /**
-     * Returns the ServicesCatalog for this Layer, creating it if not
-     * already created.
-     */
-    ServicesCatalog getServicesCatalog() {
-        ServicesCatalog servicesCatalog = this.servicesCatalog;
-        if (servicesCatalog != null)
-            return servicesCatalog;
-
-        synchronized (this) {
-            servicesCatalog = this.servicesCatalog;
-            if (servicesCatalog == null) {
-                servicesCatalog = ServicesCatalog.create();
-                nameToModule.values().forEach(servicesCatalog::register);
-                this.servicesCatalog = servicesCatalog;
-            }
-        }
-
-        return servicesCatalog;
-    }
-
-    private volatile ServicesCatalog servicesCatalog;
-
-
-    /**
-     * Record that this layer has at least one module defined to the given
-     * class loader.
-     */
-    void bindToLoader(ClassLoader loader) {
-        // CLV.computeIfAbsent(loader, (cl, clv) -> new CopyOnWriteArrayList<>())
-        List<Layer> list = CLV.get(loader);
-        if (list == null) {
-            list = new CopyOnWriteArrayList<>();
-            List<Layer> previous = CLV.putIfAbsent(loader, list);
-            if (previous != null) list = previous;
-        }
-        list.add(this);
-    }
-
-    /**
-     * Returns a stream of the layers that have at least one module defined to
-     * the given class loader.
-     */
-    static Stream<Layer> layers(ClassLoader loader) {
-        List<Layer> list = CLV.get(loader);
-        if (list != null) {
-            return list.stream();
-        } else {
-            return Stream.empty();
-        }
-    }
-
-    // the list of layers with modules defined to a class loader
-    private static final ClassLoaderValue<List<Layer>> CLV = new ClassLoaderValue<>();
-}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/LayerInstantiationException.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  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.reflect;
-
-/**
- * Thrown when creating a Layer fails.
- *
- * @see Layer
- *
- * @since 9
- * @spec JPMS
- */
-public class LayerInstantiationException extends RuntimeException {
-    private static final long serialVersionUID = -906239691613568347L;
-
-    /**
-     * Constructs a {@code LayerInstantiationException} with no detail message.
-     */
-    public LayerInstantiationException() {
-    }
-
-    /**
-     * Constructs a {@code LayerInstantiationException} with the given detail
-     * message.
-     *
-     * @param msg
-     *        The detail message; can be {@code null}
-     */
-    public LayerInstantiationException(String msg) {
-        super(msg);
-    }
-
-    /**
-     * Constructs a {@code LayerInstantiationException} with the given cause.
-     *
-     * @param cause
-     *        The cause; can be {@code null}
-     */
-    public LayerInstantiationException(Throwable cause) {
-        super(cause);
-    }
-
-    /**
-     * Constructs a {@code FindException} with the given detail message
-     * and cause.
-     *
-     * @param msg
-     *        The detail message; can be {@code null}
-     * @param cause
-     *        The cause; can be {@code null}
-     */
-    public LayerInstantiationException(String msg, Throwable cause) {
-        super(msg, cause);
-    }
-
-}
-
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Module.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1591 +0,0 @@
-/*
- * 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
- * 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.reflect;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.module.Configuration;
-import java.lang.module.ModuleReference;
-import java.lang.module.ModuleDescriptor;
-import java.lang.module.ModuleDescriptor.Exports;
-import java.lang.module.ModuleDescriptor.Opens;
-import java.lang.module.ModuleDescriptor.Version;
-import java.lang.module.ResolvedModule;
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.Function;
-import java.util.stream.Stream;
-
-import jdk.internal.loader.BuiltinClassLoader;
-import jdk.internal.loader.BootLoader;
-import jdk.internal.misc.JavaLangAccess;
-import jdk.internal.misc.JavaLangReflectModuleAccess;
-import jdk.internal.misc.SharedSecrets;
-import jdk.internal.module.ServicesCatalog;
-import jdk.internal.module.Resources;
-import jdk.internal.org.objectweb.asm.AnnotationVisitor;
-import jdk.internal.org.objectweb.asm.Attribute;
-import jdk.internal.org.objectweb.asm.ClassReader;
-import jdk.internal.org.objectweb.asm.ClassVisitor;
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.Opcodes;
-import jdk.internal.reflect.CallerSensitive;
-import jdk.internal.reflect.Reflection;
-import sun.security.util.SecurityConstants;
-
-/**
- * Represents a run-time module, either {@link #isNamed() named} or unnamed.
- *
- * <p> Named modules have a {@link #getName() name} and are constructed by the
- * Java Virtual Machine when a graph of modules is defined to the Java virtual
- * machine to create a module {@link Layer Layer}. </p>
- *
- * <p> An unnamed module does not have a name. There is an unnamed module for
- * each {@link ClassLoader ClassLoader}, obtained by invoking its {@link
- * ClassLoader#getUnnamedModule() getUnnamedModule} method. All types that are
- * not in a named module are members of their defining class loader's unnamed
- * module. </p>
- *
- * <p> The package names that are parameters or returned by methods defined in
- * this class are the fully-qualified names of the packages as defined in
- * section 6.5.3 of <cite>The Java&trade; Language Specification</cite>, for
- * example, {@code "java.lang"}. </p>
- *
- * <p> Unless otherwise specified, passing a {@code null} argument to a method
- * in this class causes a {@link NullPointerException NullPointerException} to
- * be thrown. </p>
- *
- * @since 9
- * @spec JPMS
- * @see java.lang.Class#getModule
- */
-
-public final class Module implements AnnotatedElement {
-
-    // the layer that contains this module, can be null
-    private final Layer layer;
-
-    // module name and loader, these fields are read by VM
-    private final String name;
-    private final ClassLoader loader;
-
-    // the module descriptor
-    private final ModuleDescriptor descriptor;
-
-
-    /**
-     * Creates a new named Module. The resulting Module will be defined to the
-     * VM but will not read any other modules, will not have any exports setup
-     * and will not be registered in the service catalog.
-     */
-    private Module(Layer layer,
-                   ClassLoader loader,
-                   ModuleDescriptor descriptor,
-                   URI uri)
-    {
-        this.layer = layer;
-        this.name = descriptor.name();
-        this.loader = loader;
-        this.descriptor = descriptor;
-
-        // define module to VM
-
-        boolean isOpen = descriptor.isOpen();
-        Version version = descriptor.version().orElse(null);
-        String vs = Objects.toString(version, null);
-        String loc = Objects.toString(uri, null);
-        String[] packages = descriptor.packages().toArray(new String[0]);
-        defineModule0(this, isOpen, vs, loc, packages);
-    }
-
-
-    /**
-     * Create the unnamed Module for the given ClassLoader.
-     *
-     * @see ClassLoader#getUnnamedModule
-     */
-    private Module(ClassLoader loader) {
-        this.layer = null;
-        this.name = null;
-        this.loader = loader;
-        this.descriptor = null;
-    }
-
-
-    /**
-     * Creates a named module but without defining the module to the VM.
-     *
-     * @apiNote This constructor is for VM white-box testing.
-     */
-    Module(ClassLoader loader, ModuleDescriptor descriptor) {
-        this.layer = null;
-        this.name = descriptor.name();
-        this.loader = loader;
-        this.descriptor = descriptor;
-    }
-
-
-
-    /**
-     * Returns {@code true} if this module is a named module.
-     *
-     * @return {@code true} if this is a named module
-     *
-     * @see ClassLoader#getUnnamedModule()
-     */
-    public boolean isNamed() {
-        return name != null;
-    }
-
-    /**
-     * Returns the module name or {@code null} if this module is an unnamed
-     * module.
-     *
-     * @return The module name
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Returns the {@code ClassLoader} for this module.
-     *
-     * <p> If there is a security manager then its {@code checkPermission}
-     * method if first called with a {@code RuntimePermission("getClassLoader")}
-     * permission to check that the caller is allowed to get access to the
-     * class loader. </p>
-     *
-     * @return The class loader for this module
-     *
-     * @throws SecurityException
-     *         If denied by the security manager
-     */
-    public ClassLoader getClassLoader() {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
-        }
-        return loader;
-    }
-
-    /**
-     * Returns the module descriptor for this module or {@code null} if this
-     * module is an unnamed module.
-     *
-     * @return The module descriptor for this module
-     */
-    public ModuleDescriptor getDescriptor() {
-        return descriptor;
-    }
-
-    /**
-     * Returns the layer that contains this module or {@code null} if this
-     * module is not in a layer.
-     *
-     * A module {@code Layer} contains named modules and therefore this
-     * method always returns {@code null} when invoked on an unnamed module.
-     *
-     * <p> <a href="Proxy.html#dynamicmodule">Dynamic modules</a> are named
-     * modules that are generated at runtime. A dynamic module may or may
-     * not be in a module Layer. </p>
-     *
-     * @return The layer that contains this module
-     *
-     * @see Proxy
-     */
-    public Layer getLayer() {
-        if (isNamed()) {
-            Layer layer = this.layer;
-            if (layer != null)
-                return layer;
-
-            // special-case java.base as it is created before the boot Layer
-            if (loader == null && name.equals("java.base")) {
-                return SharedSecrets.getJavaLangAccess().getBootLayer();
-            }
-        }
-
-        return null;
-    }
-
-
-    // --
-
-    // special Module to mean "all unnamed modules"
-    private static final Module ALL_UNNAMED_MODULE = new Module(null);
-
-    // special Module to mean "everyone"
-    private static final Module EVERYONE_MODULE = new Module(null);
-
-    // set contains EVERYONE_MODULE, used when a package is opened or
-    // exported unconditionally
-    private static final Set<Module> EVERYONE_SET = Set.of(EVERYONE_MODULE);
-
-
-    // -- readability --
-
-    // the modules that this module reads
-    private volatile Set<Module> reads;
-
-    // additional module (2nd key) that some module (1st key) reflectively reads
-    private static final WeakPairMap<Module, Module, Boolean> reflectivelyReads
-        = new WeakPairMap<>();
-
-
-    /**
-     * Indicates if this module reads the given module. This method returns
-     * {@code true} if invoked to test if this module reads itself. It also
-     * returns {@code true} if invoked on an unnamed module (as unnamed
-     * modules read all modules).
-     *
-     * @param  other
-     *         The other module
-     *
-     * @return {@code true} if this module reads {@code other}
-     *
-     * @see #addReads(Module)
-     */
-    public boolean canRead(Module other) {
-        Objects.requireNonNull(other);
-
-        // an unnamed module reads all modules
-        if (!this.isNamed())
-            return true;
-
-        // all modules read themselves
-        if (other == this)
-            return true;
-
-        // check if this module reads other
-        if (other.isNamed()) {
-            Set<Module> reads = this.reads; // volatile read
-            if (reads != null && reads.contains(other))
-                return true;
-        }
-
-        // check if this module reads the other module reflectively
-        if (reflectivelyReads.containsKeyPair(this, other))
-            return true;
-
-        // if other is an unnamed module then check if this module reads
-        // all unnamed modules
-        if (!other.isNamed()
-            && reflectivelyReads.containsKeyPair(this, ALL_UNNAMED_MODULE))
-            return true;
-
-        return false;
-    }
-
-    /**
-     * If the caller's module is this module then update this module to read
-     * the given module.
-     *
-     * This method is a no-op if {@code other} is this module (all modules read
-     * themselves), this module is an unnamed module (as unnamed modules read
-     * all modules), or this module already reads {@code other}.
-     *
-     * @implNote <em>Read edges</em> added by this method are <em>weak</em> and
-     * do not prevent {@code other} from being GC'ed when this module is
-     * strongly reachable.
-     *
-     * @param  other
-     *         The other module
-     *
-     * @return this module
-     *
-     * @throws IllegalCallerException
-     *         If this is a named module and the caller's module is not this
-     *         module
-     *
-     * @see #canRead
-     */
-    @CallerSensitive
-    public Module addReads(Module other) {
-        Objects.requireNonNull(other);
-        if (this.isNamed()) {
-            Module caller = Reflection.getCallerClass().getModule();
-            if (caller != this) {
-                throw new IllegalCallerException(caller + " != " + this);
-            }
-            implAddReads(other, true);
-        }
-        return this;
-    }
-
-    /**
-     * Updates this module to read another module.
-     *
-     * @apiNote This method is for Proxy use and white-box testing.
-     */
-    void implAddReads(Module other) {
-        implAddReads(other, true);
-    }
-
-    /**
-     * Updates this module to read another module without notifying the VM.
-     *
-     * @apiNote This method is for VM white-box testing.
-     */
-    void implAddReadsNoSync(Module other) {
-        implAddReads(other, false);
-    }
-
-    /**
-     * Makes the given {@code Module} readable to this module.
-     *
-     * If {@code syncVM} is {@code true} then the VM is notified.
-     */
-    private void implAddReads(Module other, boolean syncVM) {
-        if (!canRead(other)) {
-            // update VM first, just in case it fails
-            if (syncVM) {
-                if (other == ALL_UNNAMED_MODULE) {
-                    addReads0(this, null);
-                } else {
-                    addReads0(this, other);
-                }
-            }
-
-            // add reflective read
-            reflectivelyReads.putIfAbsent(this, other, Boolean.TRUE);
-        }
-    }
-
-
-    // -- exported and open packages --
-
-    // the packages are open to other modules, can be null
-    // if the value contains EVERYONE_MODULE then the package is open to all
-    private volatile Map<String, Set<Module>> openPackages;
-
-    // the packages that are exported, can be null
-    // if the value contains EVERYONE_MODULE then the package is exported to all
-    private volatile Map<String, Set<Module>> exportedPackages;
-
-    // additional exports or opens added at run-time
-    // this module (1st key), other module (2nd key)
-    // (package name, open?) (value)
-    private static final WeakPairMap<Module, Module, Map<String, Boolean>>
-        reflectivelyExports = new WeakPairMap<>();
-
-
-    /**
-     * Returns {@code true} if this module exports the given package to at
-     * least the given module.
-     *
-     * <p> This method returns {@code true} if invoked to test if a package in
-     * this module is exported to itself. It always returns {@code true} when
-     * invoked on an unnamed module. A package that is {@link #isOpen open} to
-     * the given module is considered exported to that module at run-time and
-     * so this method returns {@code true} if the package is open to the given
-     * module. </p>
-     *
-     * <p> This method does not check if the given module reads this module. </p>
-     *
-     * @param  pn
-     *         The package name
-     * @param  other
-     *         The other module
-     *
-     * @return {@code true} if this module exports the package to at least the
-     *         given module
-     *
-     * @see ModuleDescriptor#exports()
-     * @see #addExports(String,Module)
-     */
-    public boolean isExported(String pn, Module other) {
-        Objects.requireNonNull(pn);
-        Objects.requireNonNull(other);
-        return implIsExportedOrOpen(pn, other, /*open*/false);
-    }
-
-    /**
-     * Returns {@code true} if this module has <em>opened</em> a package to at
-     * least the given module.
-     *
-     * <p> This method returns {@code true} if invoked to test if a package in
-     * this module is open to itself. It returns {@code true} when invoked on an
-     * {@link ModuleDescriptor#isOpen open} module with a package in the module.
-     * It always returns {@code true} when invoked on an unnamed module. </p>
-     *
-     * <p> This method does not check if the given module reads this module. </p>
-     *
-     * @param  pn
-     *         The package name
-     * @param  other
-     *         The other module
-     *
-     * @return {@code true} if this module has <em>opened</em> the package
-     *         to at least the given module
-     *
-     * @see ModuleDescriptor#opens()
-     * @see #addOpens(String,Module)
-     * @see AccessibleObject#setAccessible(boolean)
-     * @see java.lang.invoke.MethodHandles#privateLookupIn
-     */
-    public boolean isOpen(String pn, Module other) {
-        Objects.requireNonNull(pn);
-        Objects.requireNonNull(other);
-        return implIsExportedOrOpen(pn, other, /*open*/true);
-    }
-
-    /**
-     * Returns {@code true} if this module exports the given package
-     * unconditionally.
-     *
-     * <p> This method always returns {@code true} when invoked on an unnamed
-     * module. A package that is {@link #isOpen(String) opened} unconditionally
-     * is considered exported unconditionally at run-time and so this method
-     * returns {@code true} if the package is opened unconditionally. </p>
-     *
-     * <p> This method does not check if the given module reads this module. </p>
-     *
-     * @param  pn
-     *         The package name
-     *
-     * @return {@code true} if this module exports the package unconditionally
-     *
-     * @see ModuleDescriptor#exports()
-     */
-    public boolean isExported(String pn) {
-        Objects.requireNonNull(pn);
-        return implIsExportedOrOpen(pn, EVERYONE_MODULE, /*open*/false);
-    }
-
-    /**
-     * Returns {@code true} if this module has <em>opened</em> a package
-     * unconditionally.
-     *
-     * <p> This method always returns {@code true} when invoked on an unnamed
-     * module. Additionally, it always returns {@code true} when invoked on an
-     * {@link ModuleDescriptor#isOpen open} module with a package in the
-     * module. </p>
-     *
-     * <p> This method does not check if the given module reads this module. </p>
-     *
-     * @param  pn
-     *         The package name
-     *
-     * @return {@code true} if this module has <em>opened</em> the package
-     *         unconditionally
-     *
-     * @see ModuleDescriptor#opens()
-     */
-    public boolean isOpen(String pn) {
-        Objects.requireNonNull(pn);
-        return implIsExportedOrOpen(pn, EVERYONE_MODULE, /*open*/true);
-    }
-
-
-    /**
-     * Returns {@code true} if this module exports or opens the given package
-     * to the given module. If the other module is {@code EVERYONE_MODULE} then
-     * this method tests if the package is exported or opened unconditionally.
-     */
-    private boolean implIsExportedOrOpen(String pn, Module other, boolean open) {
-        // all packages in unnamed modules are open
-        if (!isNamed())
-            return true;
-
-        // all packages are exported/open to self
-        if (other == this && containsPackage(pn))
-            return true;
-
-        // all packages in open and automatic modules are open
-        if (descriptor.isOpen() || descriptor.isAutomatic())
-            return containsPackage(pn);
-
-        // exported/opened via module declaration/descriptor
-        if (isStaticallyExportedOrOpen(pn, other, open))
-            return true;
-
-        // exported via addExports/addOpens
-        if (isReflectivelyExportedOrOpen(pn, other, open))
-            return true;
-
-        // not exported or open to other
-        return false;
-    }
-
-    /**
-     * Returns {@code true} if this module exports or opens a package to
-     * the given module via its module declaration.
-     */
-    private boolean isStaticallyExportedOrOpen(String pn, Module other, boolean open) {
-        // package is open to everyone or <other>
-        Map<String, Set<Module>> openPackages = this.openPackages;
-        if (openPackages != null) {
-            Set<Module> targets = openPackages.get(pn);
-            if (targets != null) {
-                if (targets.contains(EVERYONE_MODULE))
-                    return true;
-                if (other != EVERYONE_MODULE && targets.contains(other))
-                    return true;
-            }
-        }
-
-        if (!open) {
-            // package is exported to everyone or <other>
-            Map<String, Set<Module>> exportedPackages = this.exportedPackages;
-            if (exportedPackages != null) {
-                Set<Module> targets = exportedPackages.get(pn);
-                if (targets != null) {
-                    if (targets.contains(EVERYONE_MODULE))
-                        return true;
-                    if (other != EVERYONE_MODULE && targets.contains(other))
-                        return true;
-                }
-            }
-        }
-
-        return false;
-    }
-
-
-    /**
-     * Returns {@code true} if this module reflectively exports or opens given
-     * package package to the given module.
-     */
-    private boolean isReflectivelyExportedOrOpen(String pn, Module other, boolean open) {
-        // exported or open to all modules
-        Map<String, Boolean> exports = reflectivelyExports.get(this, EVERYONE_MODULE);
-        if (exports != null) {
-            Boolean b = exports.get(pn);
-            if (b != null) {
-                boolean isOpen = b.booleanValue();
-                if (!open || isOpen) return true;
-            }
-        }
-
-        if (other != EVERYONE_MODULE) {
-
-            // exported or open to other
-            exports = reflectivelyExports.get(this, other);
-            if (exports != null) {
-                Boolean b = exports.get(pn);
-                if (b != null) {
-                    boolean isOpen = b.booleanValue();
-                    if (!open || isOpen) return true;
-                }
-            }
-
-            // other is an unnamed module && exported or open to all unnamed
-            if (!other.isNamed()) {
-                exports = reflectivelyExports.get(this, ALL_UNNAMED_MODULE);
-                if (exports != null) {
-                    Boolean b = exports.get(pn);
-                    if (b != null) {
-                        boolean isOpen = b.booleanValue();
-                        if (!open || isOpen) return true;
-                    }
-                }
-            }
-
-        }
-
-        return false;
-    }
-
-
-    /**
-     * If the caller's module is this module then update this module to export
-     * the given package to the given module.
-     *
-     * <p> This method has no effect if the package is already exported (or
-     * <em>open</em>) to the given module. </p>
-     *
-     * @apiNote As specified in section 5.4.3 of the <cite>The Java&trade;
-     * Virtual Machine Specification </cite>, if an attempt to resolve a
-     * symbolic reference fails because of a linkage error, then subsequent
-     * attempts to resolve the reference always fail with the same error that
-     * was thrown as a result of the initial resolution attempt.
-     *
-     * @param  pn
-     *         The package name
-     * @param  other
-     *         The module
-     *
-     * @return this module
-     *
-     * @throws IllegalArgumentException
-     *         If {@code pn} is {@code null}, or this is a named module and the
-     *         package {@code pn} is not a package in this module
-     * @throws IllegalCallerException
-     *         If this is a named module and the caller's module is not this
-     *         module
-     *
-     * @jvms 5.4.3 Resolution
-     * @see #isExported(String,Module)
-     */
-    @CallerSensitive
-    public Module addExports(String pn, Module other) {
-        if (pn == null)
-            throw new IllegalArgumentException("package is null");
-        Objects.requireNonNull(other);
-
-        if (isNamed()) {
-            Module caller = Reflection.getCallerClass().getModule();
-            if (caller != this) {
-                throw new IllegalCallerException(caller + " != " + this);
-            }
-            implAddExportsOrOpens(pn, other, /*open*/false, /*syncVM*/true);
-        }
-
-        return this;
-    }
-
-    /**
-     * If this module has <em>opened</em> a package to at least the caller
-     * module then update this module to open the package to the given module.
-     * Opening a package with this method allows all types in the package,
-     * and all their members, not just public types and their public members,
-     * to be reflected on by the given module when using APIs that support
-     * private access or a way to bypass or suppress default Java language
-     * access control checks.
-     *
-     * <p> This method has no effect if the package is already <em>open</em>
-     * to the given module. </p>
-     *
-     * @param  pn
-     *         The package name
-     * @param  other
-     *         The module
-     *
-     * @return this module
-     *
-     * @throws IllegalArgumentException
-     *         If {@code pn} is {@code null}, or this is a named module and the
-     *         package {@code pn} is not a package in this module
-     * @throws IllegalCallerException
-     *         If this is a named module and this module has not opened the
-     *         package to at least the caller's module
-     *
-     * @see #isOpen(String,Module)
-     * @see AccessibleObject#setAccessible(boolean)
-     * @see java.lang.invoke.MethodHandles#privateLookupIn
-     */
-    @CallerSensitive
-    public Module addOpens(String pn, Module other) {
-        if (pn == null)
-            throw new IllegalArgumentException("package is null");
-        Objects.requireNonNull(other);
-
-        if (isNamed()) {
-            Module caller = Reflection.getCallerClass().getModule();
-            if (caller != this && !isOpen(pn, caller))
-                throw new IllegalCallerException(pn + " is not open to " + caller);
-            implAddExportsOrOpens(pn, other, /*open*/true, /*syncVM*/true);
-        }
-
-        return this;
-    }
-
-
-    /**
-     * Updates the exports so that package {@code pn} is exported to module
-     * {@code other} but without notifying the VM.
-     *
-     * @apiNote This method is for VM white-box testing.
-     */
-    void implAddExportsNoSync(String pn, Module other) {
-        if (other == null)
-            other = EVERYONE_MODULE;
-        implAddExportsOrOpens(pn.replace('/', '.'), other, false, false);
-    }
-
-    /**
-     * Updates the exports so that package {@code pn} is exported to module
-     * {@code other}.
-     *
-     * @apiNote This method is for white-box testing.
-     */
-    void implAddExports(String pn, Module other) {
-        implAddExportsOrOpens(pn, other, false, true);
-    }
-
-    /**
-     * Updates the module to open package {@code pn} to module {@code other}.
-     *
-     * @apiNote This method is for white-box tests and jtreg
-     */
-    void implAddOpens(String pn, Module other) {
-        implAddExportsOrOpens(pn, other, true, true);
-    }
-
-    /**
-     * Updates a module to export or open a module to another module.
-     *
-     * If {@code syncVM} is {@code true} then the VM is notified.
-     */
-    private void implAddExportsOrOpens(String pn,
-                                       Module other,
-                                       boolean open,
-                                       boolean syncVM) {
-        Objects.requireNonNull(other);
-        Objects.requireNonNull(pn);
-
-        // all packages are open in unnamed, open, and automatic modules
-        if (!isNamed() || descriptor.isOpen() || descriptor.isAutomatic())
-            return;
-
-        // nothing to do if already exported/open to other
-        if (implIsExportedOrOpen(pn, other, open))
-            return;
-
-        // can only export a package in the module
-        if (!containsPackage(pn)) {
-            throw new IllegalArgumentException("package " + pn
-                                               + " not in contents");
-        }
-
-        // update VM first, just in case it fails
-        if (syncVM) {
-            if (other == EVERYONE_MODULE) {
-                addExportsToAll0(this, pn);
-            } else if (other == ALL_UNNAMED_MODULE) {
-                addExportsToAllUnnamed0(this, pn);
-            } else {
-                addExports0(this, pn, other);
-            }
-        }
-
-        // add package name to reflectivelyExports if absent
-        Map<String, Boolean> map = reflectivelyExports
-            .computeIfAbsent(this, other,
-                             (m1, m2) -> new ConcurrentHashMap<>());
-
-        if (open) {
-            map.put(pn, Boolean.TRUE);  // may need to promote from FALSE to TRUE
-        } else {
-            map.putIfAbsent(pn, Boolean.FALSE);
-        }
-    }
-
-
-    // -- services --
-
-    // additional service type (2nd key) that some module (1st key) uses
-    private static final WeakPairMap<Module, Class<?>, Boolean> reflectivelyUses
-        = new WeakPairMap<>();
-
-    /**
-     * If the caller's module is this module then update this module to add a
-     * service dependence on the given service type. This method is intended
-     * for use by frameworks that invoke {@link java.util.ServiceLoader
-     * ServiceLoader} on behalf of other modules or where the framework is
-     * passed a reference to the service type by other code. This method is
-     * a no-op when invoked on an unnamed module or an automatic module.
-     *
-     * <p> This method does not cause {@link Configuration#resolveAndBind
-     * resolveAndBind} to be re-run. </p>
-     *
-     * @param  service
-     *         The service type
-     *
-     * @return this module
-     *
-     * @throws IllegalCallerException
-     *         If this is a named module and the caller's module is not this
-     *         module
-     *
-     * @see #canUse(Class)
-     * @see ModuleDescriptor#uses()
-     */
-    @CallerSensitive
-    public Module addUses(Class<?> service) {
-        Objects.requireNonNull(service);
-
-        if (isNamed() && !descriptor.isAutomatic()) {
-            Module caller = Reflection.getCallerClass().getModule();
-            if (caller != this) {
-                throw new IllegalCallerException(caller + " != " + this);
-            }
-            implAddUses(service);
-        }
-
-        return this;
-    }
-
-    /**
-     * Update this module to add a service dependence on the given service
-     * type.
-     */
-    void implAddUses(Class<?> service) {
-        if (!canUse(service)) {
-            reflectivelyUses.putIfAbsent(this, service, Boolean.TRUE);
-        }
-    }
-
-
-    /**
-     * Indicates if this module has a service dependence on the given service
-     * type. This method always returns {@code true} when invoked on an unnamed
-     * module or an automatic module.
-     *
-     * @param  service
-     *         The service type
-     *
-     * @return {@code true} if this module uses service type {@code st}
-     *
-     * @see #addUses(Class)
-     */
-    public boolean canUse(Class<?> service) {
-        Objects.requireNonNull(service);
-
-        if (!isNamed())
-            return true;
-
-        if (descriptor.isAutomatic())
-            return true;
-
-        // uses was declared
-        if (descriptor.uses().contains(service.getName()))
-            return true;
-
-        // uses added via addUses
-        return reflectivelyUses.containsKeyPair(this, service);
-    }
-
-
-
-    // -- packages --
-
-    // Additional packages that are added to the module at run-time.
-    private volatile Map<String, Boolean> extraPackages;
-
-    private boolean containsPackage(String pn) {
-        if (descriptor.packages().contains(pn))
-            return true;
-        Map<String, Boolean> extraPackages = this.extraPackages;
-        if (extraPackages != null && extraPackages.containsKey(pn))
-            return true;
-        return false;
-    }
-
-
-    /**
-     * Returns an array of the package names of the packages in this module.
-     *
-     * <p> For named modules, the returned array contains an element for each
-     * package in the module. </p>
-     *
-     * <p> For unnamed modules, this method is the equivalent to invoking the
-     * {@link ClassLoader#getDefinedPackages() getDefinedPackages} method of
-     * this module's class loader and returning the array of package names. </p>
-     *
-     * <p> A package name appears at most once in the returned array. </p>
-     *
-     * @apiNote This method returns an array rather than a {@code Set} for
-     * consistency with other {@code java.lang.reflect} types.
-     *
-     * @return an array of the package names of the packages in this module
-     */
-    public String[] getPackages() {
-        if (isNamed()) {
-
-            Set<String> packages = descriptor.packages();
-            Map<String, Boolean> extraPackages = this.extraPackages;
-            if (extraPackages == null) {
-                return packages.toArray(new String[0]);
-            } else {
-                return Stream.concat(packages.stream(),
-                                     extraPackages.keySet().stream())
-                        .toArray(String[]::new);
-            }
-
-        } else {
-            // unnamed module
-            Stream<Package> packages;
-            if (loader == null) {
-                packages = BootLoader.packages();
-            } else {
-                packages = SharedSecrets.getJavaLangAccess().packages(loader);
-            }
-            return packages.map(Package::getName).toArray(String[]::new);
-        }
-    }
-
-    /**
-     * Add a package to this module without notifying the VM.
-     *
-     * @apiNote This method is VM white-box testing.
-     */
-    void implAddPackageNoSync(String pn) {
-        implAddPackage(pn.replace('/', '.'), false);
-    }
-
-    /**
-     * Add a package to this module.
-     *
-     * If {@code syncVM} is {@code true} then the VM is notified. This method is
-     * a no-op if this is an unnamed module or the module already contains the
-     * package.
-     *
-     * @throws IllegalArgumentException if the package name is not legal
-     * @throws IllegalStateException if the package is defined to another module
-     */
-    private void implAddPackage(String pn, boolean syncVM) {
-        // no-op if unnamed module
-        if (!isNamed())
-            return;
-
-        // no-op if module contains the package
-        if (containsPackage(pn))
-            return;
-
-        // check package name is legal for named modules
-        if (pn.isEmpty())
-            throw new IllegalArgumentException("Cannot add <unnamed> package");
-        for (int i=0; i<pn.length(); i++) {
-            char c = pn.charAt(i);
-            if (c == '/' || c == ';' || c == '[') {
-                throw new IllegalArgumentException("Illegal character: " + c);
-            }
-        }
-
-        // create extraPackages if needed
-        Map<String, Boolean> extraPackages = this.extraPackages;
-        if (extraPackages == null) {
-            synchronized (this) {
-                extraPackages = this.extraPackages;
-                if (extraPackages == null)
-                    this.extraPackages = extraPackages = new ConcurrentHashMap<>();
-            }
-        }
-
-        // update VM first in case it fails. This is a no-op if another thread
-        // beats us to add the package first
-        if (syncVM) {
-            // throws IllegalStateException if defined to another module
-            addPackage0(this, pn);
-            if (descriptor.isOpen() || descriptor.isAutomatic()) {
-                addExportsToAll0(this, pn);
-            }
-        }
-        extraPackages.putIfAbsent(pn, Boolean.TRUE);
-    }
-
-
-    // -- creating Module objects --
-
-    /**
-     * Defines all module in a configuration to the runtime.
-     *
-     * @return a map of module name to runtime {@code Module}
-     *
-     * @throws IllegalArgumentException
-     *         If defining any of the modules to the VM fails
-     */
-    static Map<String, Module> defineModules(Configuration cf,
-                                             Function<String, ClassLoader> clf,
-                                             Layer layer)
-    {
-        Map<String, Module> nameToModule = new HashMap<>();
-        Map<String, ClassLoader> moduleToLoader = new HashMap<>();
-
-        boolean isBootLayer = (Layer.boot() == null);
-        Set<ClassLoader> loaders = new HashSet<>();
-
-        // map each module to a class loader
-        for (ResolvedModule resolvedModule : cf.modules()) {
-            String name = resolvedModule.name();
-            ClassLoader loader = clf.apply(name);
-            if (loader != null) {
-                moduleToLoader.put(name, loader);
-                loaders.add(loader);
-            } else if (!isBootLayer) {
-                throw new IllegalArgumentException("loader can't be 'null'");
-            }
-        }
-
-        // define each module in the configuration to the VM
-        for (ResolvedModule resolvedModule : cf.modules()) {
-            ModuleReference mref = resolvedModule.reference();
-            ModuleDescriptor descriptor = mref.descriptor();
-            String name = descriptor.name();
-            URI uri = mref.location().orElse(null);
-            ClassLoader loader = moduleToLoader.get(resolvedModule.name());
-            Module m;
-            if (loader == null && isBootLayer && name.equals("java.base")) {
-                // java.base is already defined to the VM
-                m = Object.class.getModule();
-            } else {
-                m = new Module(layer, loader, descriptor, uri);
-            }
-            nameToModule.put(name, m);
-            moduleToLoader.put(name, loader);
-        }
-
-        // setup readability and exports
-        for (ResolvedModule resolvedModule : cf.modules()) {
-            ModuleReference mref = resolvedModule.reference();
-            ModuleDescriptor descriptor = mref.descriptor();
-
-            String mn = descriptor.name();
-            Module m = nameToModule.get(mn);
-            assert m != null;
-
-            // reads
-            Set<Module> reads = new HashSet<>();
-
-            // name -> source Module when in parent layer
-            Map<String, Module> nameToSource = Collections.emptyMap();
-
-            for (ResolvedModule other : resolvedModule.reads()) {
-                Module m2 = null;
-                if (other.configuration() == cf) {
-                    // this configuration
-                    m2 = nameToModule.get(other.name());
-                    assert m2 != null;
-                } else {
-                    // parent layer
-                    for (Layer parent: layer.parents()) {
-                        m2 = findModule(parent, other);
-                        if (m2 != null)
-                            break;
-                    }
-                    assert m2 != null;
-                    if (nameToSource.isEmpty())
-                        nameToSource = new HashMap<>();
-                    nameToSource.put(other.name(), m2);
-                }
-                reads.add(m2);
-
-                // update VM view
-                addReads0(m, m2);
-            }
-            m.reads = reads;
-
-            // automatic modules read all unnamed modules
-            if (descriptor.isAutomatic()) {
-                m.implAddReads(ALL_UNNAMED_MODULE, true);
-            }
-
-            // exports and opens
-            initExportsAndOpens(m, nameToSource, nameToModule, layer.parents());
-        }
-
-        // register the modules in the boot layer
-        if (isBootLayer) {
-            for (ResolvedModule resolvedModule : cf.modules()) {
-                ModuleReference mref = resolvedModule.reference();
-                ModuleDescriptor descriptor = mref.descriptor();
-                if (!descriptor.provides().isEmpty()) {
-                    String name = descriptor.name();
-                    Module m = nameToModule.get(name);
-                    ClassLoader loader = moduleToLoader.get(name);
-                    ServicesCatalog catalog;
-                    if (loader == null) {
-                        catalog = BootLoader.getServicesCatalog();
-                    } else {
-                        catalog = ServicesCatalog.getServicesCatalog(loader);
-                    }
-                    catalog.register(m);
-                }
-            }
-        }
-
-        // record that there is a layer with modules defined to the class loader
-        for (ClassLoader loader : loaders) {
-            layer.bindToLoader(loader);
-        }
-
-        return nameToModule;
-    }
-
-
-    /**
-     * Find the runtime Module corresponding to the given ResolvedModule
-     * in the given parent layer (or its parents).
-     */
-    private static Module findModule(Layer parent, ResolvedModule resolvedModule) {
-        Configuration cf = resolvedModule.configuration();
-        String dn = resolvedModule.name();
-        return parent.layers()
-                .filter(l -> l.configuration() == cf)
-                .findAny()
-                .map(layer -> {
-                    Optional<Module> om = layer.findModule(dn);
-                    assert om.isPresent() : dn + " not found in layer";
-                    Module m = om.get();
-                    assert m.getLayer() == layer : m + " not in expected layer";
-                    return m;
-                })
-                .orElse(null);
-    }
-
-
-    /**
-     * Initialize the maps of exported and open packages for module m.
-     */
-    private static void initExportsAndOpens(Module m,
-                                            Map<String, Module> nameToSource,
-                                            Map<String, Module> nameToModule,
-                                            List<Layer> parents) {
-        // The VM doesn't special case open or automatic modules so need to
-        // export all packages
-        ModuleDescriptor descriptor = m.getDescriptor();
-        if (descriptor.isOpen() || descriptor.isAutomatic()) {
-            assert descriptor.opens().isEmpty();
-            for (String source : descriptor.packages()) {
-                addExportsToAll0(m, source);
-            }
-            return;
-        }
-
-        Map<String, Set<Module>> openPackages = new HashMap<>();
-        Map<String, Set<Module>> exportedPackages = new HashMap<>();
-
-        // process the open packages first
-        for (Opens opens : descriptor.opens()) {
-            String source = opens.source();
-
-            if (opens.isQualified()) {
-                // qualified opens
-                Set<Module> targets = new HashSet<>();
-                for (String target : opens.targets()) {
-                    Module m2 = findModule(target, nameToSource, nameToModule, parents);
-                    if (m2 != null) {
-                        addExports0(m, source, m2);
-                        targets.add(m2);
-                    }
-                }
-                if (!targets.isEmpty()) {
-                    openPackages.put(source, targets);
-                }
-            } else {
-                // unqualified opens
-                addExportsToAll0(m, source);
-                openPackages.put(source, EVERYONE_SET);
-            }
-        }
-
-        // next the exports, skipping exports when the package is open
-        for (Exports exports : descriptor.exports()) {
-            String source = exports.source();
-
-            // skip export if package is already open to everyone
-            Set<Module> openToTargets = openPackages.get(source);
-            if (openToTargets != null && openToTargets.contains(EVERYONE_MODULE))
-                continue;
-
-            if (exports.isQualified()) {
-                // qualified exports
-                Set<Module> targets = new HashSet<>();
-                for (String target : exports.targets()) {
-                    Module m2 = findModule(target, nameToSource, nameToModule, parents);
-                    if (m2 != null) {
-                        // skip qualified export if already open to m2
-                        if (openToTargets == null || !openToTargets.contains(m2)) {
-                            addExports0(m, source, m2);
-                            targets.add(m2);
-                        }
-                    }
-                }
-                if (!targets.isEmpty()) {
-                    exportedPackages.put(source, targets);
-                }
-
-            } else {
-                // unqualified exports
-                addExportsToAll0(m, source);
-                exportedPackages.put(source, EVERYONE_SET);
-            }
-        }
-
-        if (!openPackages.isEmpty())
-            m.openPackages = openPackages;
-        if (!exportedPackages.isEmpty())
-            m.exportedPackages = exportedPackages;
-    }
-
-    /**
-     * Find the runtime Module with the given name. The module name is the
-     * name of a target module in a qualified exports or opens directive.
-     *
-     * @param target The target module to find
-     * @param nameToSource The modules in parent layers that are read
-     * @param nameToModule The modules in the layer under construction
-     * @param parents The parent layers
-     */
-    private static Module findModule(String target,
-                                     Map<String, Module> nameToSource,
-                                     Map<String, Module> nameToModule,
-                                     List<Layer> parents) {
-        Module m = nameToSource.get(target);
-        if (m == null) {
-            m = nameToModule.get(target);
-            if (m == null) {
-                for (Layer parent : parents) {
-                    m = parent.findModule(target).orElse(null);
-                    if (m != null) break;
-                }
-            }
-        }
-        return m;
-    }
-
-
-    // -- annotations --
-
-    /**
-     * {@inheritDoc}
-     * This method returns {@code null} when invoked on an unnamed module.
-     */
-    @Override
-    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
-        return moduleInfoClass().getDeclaredAnnotation(annotationClass);
-    }
-
-    /**
-     * {@inheritDoc}
-     * This method returns an empty array when invoked on an unnamed module.
-     */
-    @Override
-    public Annotation[] getAnnotations() {
-        return moduleInfoClass().getAnnotations();
-    }
-
-    /**
-     * {@inheritDoc}
-     * This method returns an empty array when invoked on an unnamed module.
-     */
-    @Override
-    public Annotation[] getDeclaredAnnotations() {
-        return moduleInfoClass().getDeclaredAnnotations();
-    }
-
-    // cached class file with annotations
-    private volatile Class<?> moduleInfoClass;
-
-    private Class<?> moduleInfoClass() {
-        Class<?> clazz = this.moduleInfoClass;
-        if (clazz != null)
-            return clazz;
-
-        synchronized (this) {
-            clazz = this.moduleInfoClass;
-            if (clazz == null) {
-                if (isNamed()) {
-                    PrivilegedAction<Class<?>> pa = this::loadModuleInfoClass;
-                    clazz = AccessController.doPrivileged(pa);
-                }
-                if (clazz == null) {
-                    class DummyModuleInfo { }
-                    clazz = DummyModuleInfo.class;
-                }
-                this.moduleInfoClass = clazz;
-            }
-            return clazz;
-        }
-    }
-
-    private Class<?> loadModuleInfoClass() {
-        Class<?> clazz = null;
-        try (InputStream in = getResourceAsStream("module-info.class")) {
-            if (in != null)
-                clazz = loadModuleInfoClass(in);
-        } catch (Exception ignore) { }
-        return clazz;
-    }
-
-    /**
-     * Loads module-info.class as a package-private interface in a class loader
-     * that is a child of this module's class loader.
-     */
-    private Class<?> loadModuleInfoClass(InputStream in) throws IOException {
-        final String MODULE_INFO = "module-info";
-
-        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS
-                                         + ClassWriter.COMPUTE_FRAMES);
-
-        ClassVisitor cv = new ClassVisitor(Opcodes.ASM5, cw) {
-            @Override
-            public void visit(int version,
-                              int access,
-                              String name,
-                              String signature,
-                              String superName,
-                              String[] interfaces) {
-                cw.visit(version,
-                        Opcodes.ACC_INTERFACE
-                            + Opcodes.ACC_ABSTRACT
-                            + Opcodes.ACC_SYNTHETIC,
-                        MODULE_INFO,
-                        null,
-                        "java/lang/Object",
-                        null);
-            }
-            @Override
-            public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
-                // keep annotations
-                return super.visitAnnotation(desc, visible);
-            }
-            @Override
-            public void visitAttribute(Attribute attr) {
-                // drop non-annotation attributes
-            }
-        };
-
-        ClassReader cr = new ClassReader(in);
-        cr.accept(cv, 0);
-        byte[] bytes = cw.toByteArray();
-
-        ClassLoader cl = new ClassLoader(loader) {
-            @Override
-            protected Class<?> findClass(String cn)throws ClassNotFoundException {
-                if (cn.equals(MODULE_INFO)) {
-                    return super.defineClass(cn, bytes, 0, bytes.length);
-                } else {
-                    throw new ClassNotFoundException(cn);
-                }
-            }
-        };
-
-        try {
-            return cl.loadClass(MODULE_INFO);
-        } catch (ClassNotFoundException e) {
-            throw new InternalError(e);
-        }
-    }
-
-
-    // -- misc --
-
-
-    /**
-     * Returns an input stream for reading a resource in this module.
-     * The {@code name} parameter is a {@code '/'}-separated path name that
-     * identifies the resource. As with {@link Class#getResourceAsStream
-     * Class.getResourceAsStream}, this method delegates to the module's class
-     * loader {@link ClassLoader#findResource(String,String)
-     * findResource(String,String)} method, invoking it with the module name
-     * (or {@code null} when the module is unnamed) and the name of the
-     * resource. If the resource name has a leading slash then it is dropped
-     * before delegation.
-     *
-     * <p> A resource in a named module may be <em>encapsulated</em> so that
-     * it cannot be located by code in other modules. Whether a resource can be
-     * located or not is determined as follows: </p>
-     *
-     * <ul>
-     *     <li> If the resource name ends with  "{@code .class}" then it is not
-     *     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>
-     * </ul>
-     *
-     * <p> In the above, the <em>package name</em> for a resource is derived
-     * from the subsequence of characters that precedes the last {@code '/'} in
-     * the name and then replacing each {@code '/'} character in the subsequence
-     * with {@code '.'}. A leading slash is ignored when deriving the package
-     * name. As an example, the package name derived for a resource named
-     * "{@code a/b/c/foo.properties}" is "{@code a.b.c}". A resource name
-     * with the name "{@code META-INF/MANIFEST.MF}" is never encapsulated
-     * because "{@code META-INF}" is not a legal package name. </p>
-     *
-     * <p> This method returns {@code null} if the resource is not in this
-     * module, the resource is encapsulated and cannot be located by the caller,
-     * or access to the resource is denied by the security manager. </p>
-     *
-     * @param  name
-     *         The resource name
-     *
-     * @return An input stream for reading the resource or {@code null}
-     *
-     * @throws IOException
-     *         If an I/O error occurs
-     *
-     * @see Class#getResourceAsStream(String)
-     */
-    @CallerSensitive
-    public InputStream getResourceAsStream(String name) throws IOException {
-        if (name.startsWith("/")) {
-            name = name.substring(1);
-        }
-
-        if (isNamed() && Resources.canEncapsulate(name)) {
-            Module caller = Reflection.getCallerClass().getModule();
-            if (caller != this && caller != Object.class.getModule()) {
-                // ignore packages added for proxies via addPackage
-                Set<String> packages = getDescriptor().packages();
-                String pn = Resources.toPackageName(name);
-                if (packages.contains(pn) && !isOpen(pn, caller)) {
-                    // resource is in package not open to caller
-                    return null;
-                }
-            }
-        }
-
-        String mn = this.name;
-
-        // special-case built-in class loaders to avoid URL connection
-        if (loader == null) {
-            return BootLoader.findResourceAsStream(mn, name);
-        } else if (loader instanceof BuiltinClassLoader) {
-            return ((BuiltinClassLoader) loader).findResourceAsStream(mn, name);
-        }
-
-        // locate resource in module
-        JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
-        URL url = jla.findResource(loader, mn, name);
-        if (url != null) {
-            try {
-                return url.openStream();
-            } catch (SecurityException e) { }
-        }
-
-        return null;
-    }
-
-    /**
-     * Returns the string representation of this module. For a named module,
-     * the representation is the string {@code "module"}, followed by a space,
-     * and then the module name. For an unnamed module, the representation is
-     * the string {@code "unnamed module"}, followed by a space, and then an
-     * implementation specific string that identifies the unnamed module.
-     *
-     * @return The string representation of this module
-     */
-    @Override
-    public String toString() {
-        if (isNamed()) {
-            return "module " + name;
-        } else {
-            String id = Integer.toHexString(System.identityHashCode(this));
-            return "unnamed module @" + id;
-        }
-    }
-
-
-    // -- native methods --
-
-    // JVM_DefineModule
-    private static native void defineModule0(Module module,
-                                             boolean isOpen,
-                                             String version,
-                                             String location,
-                                             String[] pns);
-
-    // JVM_AddReadsModule
-    private static native void addReads0(Module from, Module to);
-
-    // JVM_AddModuleExports
-    private static native void addExports0(Module from, String pn, Module to);
-
-    // JVM_AddModuleExportsToAll
-    private static native void addExportsToAll0(Module from, String pn);
-
-    // JVM_AddModuleExportsToAllUnnamed
-    private static native void addExportsToAllUnnamed0(Module from, String pn);
-
-    // JVM_AddModulePackage
-    private static native void addPackage0(Module m, String pn);
-
-    /**
-     * Register shared secret to provide access to package-private methods
-     */
-    static {
-        SharedSecrets.setJavaLangReflectModuleAccess(
-            new JavaLangReflectModuleAccess() {
-                @Override
-                public Module defineUnnamedModule(ClassLoader loader) {
-                    return new Module(loader);
-                }
-                @Override
-                public Module defineModule(ClassLoader loader,
-                                           ModuleDescriptor descriptor,
-                                           URI uri) {
-                   return new Module(null, loader, descriptor, uri);
-                }
-                @Override
-                public void addReads(Module m1, Module m2) {
-                    m1.implAddReads(m2, true);
-                }
-                @Override
-                public void addReadsAllUnnamed(Module m) {
-                    m.implAddReads(Module.ALL_UNNAMED_MODULE);
-                }
-                @Override
-                public void addExports(Module m, String pn) {
-                    m.implAddExportsOrOpens(pn, Module.EVERYONE_MODULE, false, true);
-                }
-                @Override
-                public void addExports(Module m, String pn, Module other) {
-                    m.implAddExportsOrOpens(pn, other, false, true);
-                }
-                @Override
-                public void addExportsToAllUnnamed(Module m, String pn) {
-                    m.implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, false, true);
-                }
-                @Override
-                public void addOpens(Module m, String pn) {
-                    m.implAddExportsOrOpens(pn, Module.EVERYONE_MODULE, true, true);
-                }
-                @Override
-                public void addOpens(Module m, String pn, Module other) {
-                    m.implAddExportsOrOpens(pn, other, true, true);
-                }
-                @Override
-                public void addOpensToAllUnnamed(Module m, String pn) {
-                    m.implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, true, true);
-                }
-                @Override
-                public void addUses(Module m, Class<?> service) {
-                    m.implAddUses(service);
-                }
-                @Override
-                public ServicesCatalog getServicesCatalog(Layer layer) {
-                    return layer.getServicesCatalog();
-                }
-                @Override
-                public Stream<Layer> layers(Layer layer) {
-                    return layer.layers();
-                }
-                @Override
-                public Stream<Layer> layers(ClassLoader loader) {
-                    return Layer.layers(loader);
-                }
-            });
-    }
-}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Mon Apr 10 08:31:37 2017 -0700
@@ -227,11 +227,11 @@
  * {@code Proxy.newProxyInstance} method should be used instead.
  *
  * <p>
- * A dynamic module can read the modules of all of the superinterfaces of a proxy class
- * and the modules of the types referenced by all public method signatures
+ * A dynamic module can read the modules of all of the superinterfaces of a proxy
+ * class and the modules of the types referenced by all public method signatures
  * of a proxy class.  If a superinterface or a referenced type, say {@code T},
- * is in a non-exported package, the {@linkplain java.lang.reflect.Module module}
- * of {@code T} is updated to export the package of {@code T} to the dynamic module.
+ * is in a non-exported package, the {@linkplain Module module} of {@code T} is
+ * updated to export the package of {@code T} to the dynamic module.
  *
  * <h3>Methods Duplicated in Multiple Proxy Interfaces</h3>
  *
--- a/jdk/src/java.base/share/classes/java/lang/reflect/WeakPairMap.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,354 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  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.reflect;
-
-import java.lang.ref.Reference;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.WeakReference;
-import java.util.Collection;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.BiFunction;
-
-/**
- * A WeakHashMap-like data structure that uses a pair of weakly-referenced keys
- * with identity equality semantics to associate a strongly-referenced value.
- * Unlike WeakHashMap, this data structure is thread-safe.
- *
- * @param <K1> the type of 1st key in key pair
- * @param <K2> the type of 2nd key in key pair
- * @param <V>  the type of value
- * @author Peter Levart
- */
-final class WeakPairMap<K1, K2, V> {
-
-    private final ConcurrentHashMap<Pair<K1, K2>, V> map = new ConcurrentHashMap<>();
-    private final ReferenceQueue<Object> queue = new ReferenceQueue<>();
-
-    /**
-     * Tests if the specified pair of keys are associated with a value
-     * in the WeakPairMap.
-     *
-     * @param k1 the 1st of the pair of keys
-     * @param k2 the 2nd of the pair of keys
-     * @return true if and only if the specified key pair is in this WeakPairMap,
-     * as determined by the identity comparison; false otherwise
-     * @throws NullPointerException if any of the specified keys is null
-     */
-    public boolean containsKeyPair(K1 k1, K2 k2) {
-        expungeStaleAssociations();
-        return map.containsKey(Pair.lookup(k1, k2));
-    }
-
-    /**
-     * Returns the value to which the specified pair of keys is mapped, or null
-     * if this WeakPairMap contains no mapping for the key pair.
-     * <p>More formally, if this WeakPairMap contains a mapping from a key pair
-     * {@code (_k1, _k2)} to a value {@code v} such that
-     * {@code k1 == _k1 && k2 == _k2}, then this method returns {@code v};
-     * otherwise it returns {@code null}.
-     * (There can be at most one such mapping.)
-     *
-     * @param k1 the 1st of the pair of keys for which the mapped value is to
-     *           be returned
-     * @param k2 the 2nd of the pair of keys for which the mapped value is to
-     *           be returned
-     * @return the value to which the specified key pair is mapped, or null if
-     * this map contains no mapping for the key pair
-     * @throws NullPointerException if any of the specified keys is null
-     */
-    public V get(K1 k1, K2 k2) {
-        expungeStaleAssociations();
-        return map.get(Pair.lookup(k1, k2));
-    }
-
-    /**
-     * Maps the specified key pair to the specified value in this WeakPairMap.
-     * Neither the keys nor the value can be null.
-     * <p>The value can be retrieved by calling the {@link #get} method
-     * with the the same keys (compared by identity).
-     *
-     * @param k1 the 1st of the pair of keys with which the specified value is to
-     *           be associated
-     * @param k2 the 2nd of the pair of keys with which the specified value is to
-     *           be associated
-     * @param v  value to be associated with the specified key pair
-     * @return the previous value associated with key pair, or {@code null} if
-     * there was no mapping for key pair
-     * @throws NullPointerException if any of the specified keys or value is null
-     */
-    public V put(K1 k1, K2 k2, V v) {
-        expungeStaleAssociations();
-        return map.put(Pair.weak(k1, k2, queue), v);
-    }
-
-    /**
-     * If the specified key pair is not already associated with a value,
-     * associates it with the given value and returns {@code null}, else does
-     * nothing and returns the currently associated value.
-     *
-     * @param k1 the 1st of the pair of keys with which the specified value is to
-     *           be associated
-     * @param k2 the 2nd of the pair of keys with which the specified value is to
-     *           be associated
-     * @param v  value to be associated with the specified key pair
-     * @return the previous value associated with key pair, or {@code null} if
-     * there was no mapping for key pair
-     * @throws NullPointerException if any of the specified keys or value is null
-     */
-    public V putIfAbsent(K1 k1, K2 k2, V v) {
-        expungeStaleAssociations();
-        return map.putIfAbsent(Pair.weak(k1, k2, queue), v);
-    }
-
-    /**
-     * If the specified key pair is not already associated with a value,
-     * attempts to compute its value using the given mapping function
-     * and enters it into this WeakPairMap unless {@code null}. The entire
-     * method invocation is performed atomically, so the function is
-     * applied at most once per key pair. Some attempted update operations
-     * on this WeakPairMap by other threads may be blocked while computation
-     * is in progress, so the computation should be short and simple,
-     * and must not attempt to update any other mappings of this WeakPairMap.
-     *
-     * @param k1              the 1st of the pair of keys with which the
-     *                        computed value is to be associated
-     * @param k2              the 2nd of the pair of keys with which the
-     *                        computed value is to be associated
-     * @param mappingFunction the function to compute a value
-     * @return the current (existing or computed) value associated with
-     * the specified key pair, or null if the computed value is null
-     * @throws NullPointerException  if any of the specified keys or
-     *                               mappingFunction is null
-     * @throws IllegalStateException if the computation detectably
-     *                               attempts a recursive update to this map
-     *                               that would otherwise never complete
-     * @throws RuntimeException      or Error if the mappingFunction does so, in
-     *                               which case the mapping is left unestablished
-     */
-    public V computeIfAbsent(K1 k1, K2 k2,
-                             BiFunction<? super K1, ? super K2, ? extends V>
-                                 mappingFunction) {
-        expungeStaleAssociations();
-        try {
-            return map.computeIfAbsent(
-                Pair.weak(k1, k2, queue),
-                pair -> mappingFunction.apply(pair.first(), pair.second()));
-        } finally {
-            Reference.reachabilityFence(k1);
-            Reference.reachabilityFence(k2);
-        }
-    }
-
-    /**
-     * Returns a {@link Collection} view of the values contained in this
-     * WeakPairMap. The collection is backed by the WeakPairMap, so changes to
-     * the map are reflected in the collection, and vice-versa.  The collection
-     * supports element removal, which removes the corresponding
-     * mapping from this map, via the {@code Iterator.remove},
-     * {@code Collection.remove}, {@code removeAll},
-     * {@code retainAll}, and {@code clear} operations.  It does not
-     * support the {@code add} or {@code addAll} operations.
-     *
-     * @return the collection view
-     */
-    public Collection<V> values() {
-        expungeStaleAssociations();
-        return map.values();
-    }
-
-    /**
-     * Removes associations from this WeakPairMap for which at least one of the
-     * keys in key pair has been found weakly-reachable and corresponding
-     * WeakRefPeer(s) enqueued. Called as part of each public operation.
-     */
-    private void expungeStaleAssociations() {
-        WeakRefPeer<?> peer;
-        while ((peer = (WeakRefPeer<?>) queue.poll()) != null) {
-            map.remove(peer.weakPair());
-        }
-    }
-
-    /**
-     * Common interface of both {@link Weak} and {@link Lookup} key pairs.
-     */
-    private interface Pair<K1, K2> {
-
-        static <K1, K2> Pair<K1, K2> weak(K1 k1, K2 k2,
-                                          ReferenceQueue<Object> queue) {
-            return new Weak<>(k1, k2, queue);
-        }
-
-        static <K1, K2> Pair<K1, K2> lookup(K1 k1, K2 k2) {
-            return new Lookup<>(k1, k2);
-        }
-
-        /**
-         * @return The 1st of the pair of keys (may be null for {@link Weak}
-         * when it gets cleared)
-         */
-        K1 first();
-
-        /**
-         * @return The 2nd of the pair of keys (may be null for {@link Weak}
-         * when it gets cleared)
-         */
-        K2 second();
-
-        static int hashCode(Object first, Object second) {
-            // assert first != null && second != null;
-            return System.identityHashCode(first) ^
-                   System.identityHashCode(second);
-        }
-
-        static boolean equals(Object first, Object second, Pair<?, ?> p) {
-            return first != null && second != null &&
-                   first == p.first() && second == p.second();
-        }
-
-        /**
-         * A Pair where both keys are weakly-referenced.
-         * It is composed of two instances of {@link WeakRefPeer}s:
-         * <pre>{@code
-         *
-         *     +-referent-> [K1]                +-referent-> [K2]
-         *     |                                |
-         *   +----------------+               +----------------+
-         *   | Pair.Weak <:   |-----peer----->| (anonymous) <: |
-         *   | WeakRefPeer,   |               | WeakRefPeer    |
-         *   | Pair           |<--weakPair()--|                |
-         *   +----------------+               +----------------+
-         *     |            ^
-         *     |            |
-         *     +-weakPair()-+
-         *
-         * }</pre>
-         * <p>
-         * Pair.Weak is used for CHM keys. Both peers are associated with the
-         * same {@link ReferenceQueue} so when either of their referents
-         * becomes weakly-reachable, the corresponding entries can be
-         * {@link #expungeStaleAssociations() expunged} from the map.
-         */
-        final class Weak<K1, K2> extends WeakRefPeer<K1> implements Pair<K1, K2> {
-
-            // saved hash so it can be retrieved after the reference is cleared
-            private final int hash;
-            // link to <K2> peer
-            private final WeakRefPeer<K2> peer;
-
-            Weak(K1 k1, K2 k2, ReferenceQueue<Object> queue) {
-                super(k1, queue);
-                hash = Pair.hashCode(k1, k2);
-                peer = new WeakRefPeer<>(k2, queue) {
-                    // link back to <K1> peer
-                    @Override
-                    Weak<?, ?> weakPair() { return Weak.this; }
-                };
-            }
-
-            @Override
-            Weak<?, ?> weakPair() {
-                return this;
-            }
-
-            @Override
-            public K1 first() {
-                return get();
-            }
-
-            @Override
-            public K2 second() {
-                return peer.get();
-            }
-
-            @Override
-            public int hashCode() {
-                return hash;
-            }
-
-            @Override
-            public boolean equals(Object obj) {
-                return this == obj ||
-                       (obj instanceof Pair &&
-                        Pair.equals(first(), second(), (Pair<?, ?>) obj));
-            }
-        }
-
-        /**
-         * Optimized lookup Pair, used as lookup key in methods like
-         * {@link java.util.Map#get(Object)} or
-         * {@link java.util.Map#containsKey(Object)}) where
-         * there is a great chance its allocation is eliminated
-         * by escape analysis when such lookups are inlined by JIT.
-         * All its methods are purposely designed so that 'this' is never
-         * passed to any other method or used as identity.
-         */
-        final class Lookup<K1, K2> implements Pair<K1, K2> {
-            private final K1 k1;
-            private final K2 k2;
-
-            Lookup(K1 k1, K2 k2) {
-                this.k1 = Objects.requireNonNull(k1);
-                this.k2 = Objects.requireNonNull(k2);
-            }
-
-            @Override
-            public K1 first() {
-                return k1;
-            }
-
-            @Override
-            public K2 second() {
-                return k2;
-            }
-
-            @Override
-            public int hashCode() {
-                return Pair.hashCode(k1, k2);
-            }
-
-            @Override
-            public boolean equals(Object obj) {
-                return obj instanceof Pair &&
-                       Pair.equals(k1, k2, (Pair<?, ?>) obj);
-            }
-        }
-    }
-
-    /**
-     * Common abstract supertype of a pair of WeakReference peers.
-     */
-    private static abstract class WeakRefPeer<K> extends WeakReference<K> {
-
-        WeakRefPeer(K k, ReferenceQueue<Object> queue) {
-            super(Objects.requireNonNull(k), queue);
-        }
-
-        /**
-         * @return the {@link Pair.Weak} side of the pair of peers.
-         */
-        abstract Pair.Weak<?, ?> weakPair();
-    }
-}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/package-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/package-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -25,11 +25,10 @@
 
 /**
  * Provides classes and interfaces for obtaining reflective information about
- * modules, classes and objects.  Reflection allows programmatic access to
- * information about modules and to the fields, methods and constructors of
- * loaded classes, and the use of reflected fields, methods, and constructors
- * to operate on their underlying counterparts, within encapsulation and
- * security restrictions.
+ * classes and objects.  Reflection allows programmatic access to information
+ * about the fields, methods and constructors of loaded classes, and the use
+ * of reflected fields, methods, and constructors to operate on their underlying
+ * counterparts, within encapsulation and security restrictions.
  *
  * <p>{@code AccessibleObject} allows suppression of access checks if
  * the necessary {@code ReflectPermission} is available.
--- a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, 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
@@ -275,6 +275,7 @@
         return (fd == null) ? true : false;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         close();
     }
--- a/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -646,6 +646,7 @@
     /**
      * Cleans up if the user forgets to close it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws IOException {
         close();
     }
--- a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -283,6 +283,7 @@
     /**
      * Overrides finalize, the fd is closed by the Socket.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() {}
 
     /**
--- a/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -175,6 +175,7 @@
     /**
      * Overrides finalize, the fd is closed by the Socket.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() {}
 
     /**
--- a/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -213,7 +213,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public final MappedByteBuffer position(int newPosition) {
@@ -223,7 +222,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public final MappedByteBuffer limit(int newLimit) {
@@ -233,7 +231,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public final MappedByteBuffer mark() {
@@ -243,7 +240,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public final MappedByteBuffer reset() {
@@ -253,7 +249,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public final MappedByteBuffer clear() {
@@ -263,7 +258,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public final MappedByteBuffer flip() {
@@ -273,7 +267,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public final MappedByteBuffer rewind() {
--- a/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template	Mon Apr 10 08:31:37 2017 -0700
@@ -1069,7 +1069,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public
@@ -1083,7 +1082,6 @@
     
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public
@@ -1097,7 +1095,6 @@
     
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public 
@@ -1111,7 +1108,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public 
@@ -1125,7 +1121,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public 
@@ -1139,7 +1134,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public 
@@ -1153,7 +1147,6 @@
 
     /**
      * {@inheritDoc}
-     * @since 9
      */
     @Override
     public 
--- a/jdk/src/java.base/share/classes/java/security/SecureRandom.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/security/SecureRandom.java	Mon Apr 10 08:31:37 2017 -0700
@@ -651,8 +651,6 @@
      * {@code SecureRandom}.
      *
      * @return the string representation
-     *
-     * @since 9
      */
     @Override
     public String toString() {
--- a/jdk/src/java.base/share/classes/java/security/SecureRandomSpi.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/security/SecureRandomSpi.java	Mon Apr 10 08:31:37 2017 -0700
@@ -211,8 +211,6 @@
      * {@code SecureRandom}.
      *
      * @return the string representation
-     *
-     * @since 9
      */
     @Override
     public String toString() {
--- a/jdk/src/java.base/share/classes/java/time/chrono/Era.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/time/chrono/Era.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -310,8 +310,8 @@
      * The parameters control the style of the returned text and the locale.
      * <p>
      * If no textual mapping is found then the {@link #getValue() numeric value} is returned.
-     * <p>
-     * This default implementation is suitable for all implementations.
+     *
+     * @apiNote This default implementation is suitable for most implementations.
      *
      * @param style  the style of the text required, not null
      * @param locale  the locale to use, not null
--- a/jdk/src/java.base/share/classes/java/time/chrono/JapaneseEra.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/time/chrono/JapaneseEra.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -240,19 +240,10 @@
     }
 
     /**
-     * Gets the textual representation of this era.
-     * <p>
-     * This returns the textual name used to identify the era,
-     * suitable for presentation to the user.
-     * The parameters control the style of the returned text and the locale.
-     * <p>
-     * If no textual mapping is found then the {@link #getValue() numeric value}
-     * is returned.
+     * {@inheritDoc}
      *
-     * @param style  the style of the text required, not null
-     * @param locale  the locale to use, not null
-     * @return the text value of the era, not null
-     * @since 9
+     * @param style {@inheritDoc}
+     * @param locale {@inheritDoc}
      */
     @Override
     public String getDisplayName(TextStyle style, Locale locale) {
--- a/jdk/src/java.base/share/classes/java/util/Comparator.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/Comparator.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -112,12 +112,6 @@
      * zero, or a positive integer as the first argument is less than, equal
      * to, or greater than the second.<p>
      *
-     * In the foregoing description, the notation
-     * {@code sgn(}<i>expression</i>{@code )} designates the mathematical
-     * <i>signum</i> function, which is defined to return one of {@code -1},
-     * {@code 0}, or {@code 1} according to whether the value of
-     * <i>expression</i> is negative, zero or positive.<p>
-     *
      * The implementor must ensure that {@code sgn(compare(x, y)) ==
      * -sgn(compare(y, x))} for all {@code x} and {@code y}.  (This
      * implies that {@code compare(x, y)} must throw an exception if and only
@@ -135,7 +129,13 @@
      * {@code (compare(x, y)==0) == (x.equals(y))}.  Generally speaking,
      * any comparator that violates this condition should clearly indicate
      * this fact.  The recommended language is "Note: this comparator
-     * imposes orderings that are inconsistent with equals."
+     * imposes orderings that are inconsistent with equals."<p>
+     *
+     * In the foregoing description, the notation
+     * {@code sgn(}<i>expression</i>{@code )} designates the mathematical
+     * <i>signum</i> function, which is defined to return one of {@code -1},
+     * {@code 0}, or {@code 1} according to whether the value of
+     * <i>expression</i> is negative, zero, or positive, respectively.
      *
      * @param o1 the first object to be compared.
      * @param o2 the second object to be compared.
--- a/jdk/src/java.base/share/classes/java/util/Iterator.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/Iterator.java	Mon Apr 10 08:31:37 2017 -0700
@@ -109,7 +109,8 @@
      * Exceptions thrown by the action are relayed to the caller.
      * <p>
      * The behavior of an iterator is unspecified if the action modifies the
-     * collection in any way (even by calling the {@link #remove remove} method),
+     * collection in any way (even by calling the {@link #remove remove} method
+     * or other mutator methods of {@code Iterator} subtypes),
      * unless an overriding class has specified a concurrent modification policy.
      * <p>
      * Subsequent behavior of an iterator is unspecified if the action throws an
--- a/jdk/src/java.base/share/classes/java/util/Observable.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/Observable.java	Mon Apr 10 08:31:37 2017 -0700
@@ -69,6 +69,8 @@
  * {@link java.beans} package.  For reliable and ordered
  * messaging among threads, consider using one of the concurrent data
  * structures in the {@link java.util.concurrent} package.
+ * For reactive streams style programming, see the
+ * {@link java.util.concurrent.Flow} API.
  */
 @Deprecated(since="9")
 public class Observable {
--- a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java	Mon Apr 10 08:31:37 2017 -0700
@@ -50,7 +50,6 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.net.JarURLConnection;
 import java.net.URL;
 import java.net.URLConnection;
@@ -1836,7 +1835,7 @@
                         cacheKey.setFormat(format);
                         break;
                     }
-                } catch (Exception e) {
+                } catch (LinkageError|Exception e) {
                     cacheKey.setCause(e);
                 }
             }
--- a/jdk/src/java.base/share/classes/java/util/ServiceLoader.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,10 +31,8 @@
 import java.io.InputStreamReader;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.net.URL;
 import java.net.URLConnection;
 import java.security.AccessControlContext;
@@ -50,7 +48,6 @@
 import jdk.internal.loader.BootLoader;
 import jdk.internal.loader.ClassLoaders;
 import jdk.internal.misc.JavaLangAccess;
-import jdk.internal.misc.JavaLangReflectModuleAccess;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.misc.VM;
 import jdk.internal.module.ServicesCatalog;
@@ -160,7 +157,7 @@
  * <h2> Locating providers </h2>
  *
  * <p> The {@code load} methods locate providers using a class loader or module
- * {@link Layer layer}. When locating providers using a class loader then
+ * {@link ModuleLayer layer}. When locating providers using a class loader then
  * providers in both named and unnamed modules may be located. When locating
  * providers using a module layer then only providers in named modules in
  * the layer (or parent layers) are located.
@@ -168,11 +165,11 @@
  * <p> When locating providers using a class loader then any providers in named
  * modules defined to the class loader, or any class loader that is reachable
  * via parent delegation, are located. Additionally, providers in module layers
- * other than the {@link Layer#boot() boot} layer, where the module layer
+ * other than the {@link ModuleLayer#boot() boot} layer, where the module layer
  * contains modules defined to the class loader, or any class loader reachable
  * via parent delegation, are also located. For example, suppose there is a
  * module layer where each module is defined to its own class loader (see {@link
- * Layer#defineModulesWithManyLoaders defineModulesWithManyLoaders}). If the
+ * ModuleLayer#defineModulesWithManyLoaders defineModulesWithManyLoaders}). If the
  * {@code load} method is invoked to locate providers using any of these class
  * loaders for this layer then it will locate all of the providers in that
  * layer, irrespective of their defining class loader.
@@ -198,7 +195,7 @@
  *     will locate providers in modules defined to the class loader, then its
  *     parent class loader, its parent parent, and so on to the bootstrap class
  *     loader. If a {@code ClassLoader}, or any class loader in the parent
- *     delegation chain, defines modules in a custom module {@link Layer} then
+ *     delegation chain, defines modules in a custom module {@link ModuleLayer} then
  *     all providers in that layer are located, irrespective of their class
  *     loader. The ordering of modules defined to the same class loader, or the
  *     ordering of modules in a layer, is not defined. </li>
@@ -216,11 +213,11 @@
  *     method finds the service configuration files. </li>
  * </ul>
  *
- * <p> Service loaders created to locate providers in a module {@link Layer}
- * will first locate providers in the layer, before locating providers in
- * parent layers. Traversal of parent layers is depth-first with each layer
- * visited at most once. For example, suppose L0 is the boot layer, L1 and
- * L2 are custom layers with L0 as their parent. Now suppose that L3 is
+ * <p> Service loaders created to locate providers in a {@linkplain ModuleLayer
+ * module layer} will first locate providers in the layer, before locating
+ * providers in parent layers. Traversal of parent layers is depth-first with
+ * each layer visited at most once. For example, suppose L0 is the boot layer,
+ * L1 and L2 are custom layers with L0 as their parent. Now suppose that L3 is
  * created with L1 and L2 as the parents (in that order). Using a service
  * loader to locate providers with L3 as the content will locate providers
  * in the following order: L3, L1, L0, L2. The ordering of modules in a layer
@@ -352,12 +349,12 @@
     // The class of the service type
     private final String serviceName;
 
-    // The module Layer used to locate providers; null when locating
+    // The module layer used to locate providers; null when locating
     // providers using a class loader
-    private final Layer layer;
+    private final ModuleLayer layer;
 
     // The class loader used to locate, load, and instantiate providers;
-    // null when locating provider using a module Layer
+    // null when locating provider using a module layer
     private final ClassLoader loader;
 
     // The access control context taken when the ServiceLoader is created
@@ -376,10 +373,8 @@
     private int reloadCount;
 
     private static JavaLangAccess LANG_ACCESS;
-    private static JavaLangReflectModuleAccess JLRM_ACCESS;
     static {
         LANG_ACCESS = SharedSecrets.getJavaLangAccess();
-        JLRM_ACCESS = SharedSecrets.getJavaLangReflectModuleAccess();
     }
 
     /**
@@ -425,13 +420,13 @@
 
     /**
      * Initializes a new instance of this class for locating service providers
-     * in a module Layer.
+     * in a module layer.
      *
      * @throws ServiceConfigurationError
      *         If {@code svc} is not accessible to {@code caller} or the caller
      *         module does not use the service type.
      */
-    private ServiceLoader(Class<?> caller, Layer layer, Class<S> svc) {
+    private ServiceLoader(Class<?> caller, ModuleLayer layer, Class<S> svc) {
         Objects.requireNonNull(caller);
         Objects.requireNonNull(layer);
         Objects.requireNonNull(svc);
@@ -512,12 +507,15 @@
 
     /**
      * Checks that the given service type is accessible to types in the given
-     * module, and check that the module declare that it uses the service type. ??
+     * module, and check that the module declares that it uses the service type.
      */
     private static void checkCaller(Class<?> caller, Class<?> svc) {
-        Module callerModule = caller.getModule();
+        if (caller == null) {
+            fail(svc, "no caller to check if it declares `uses`");
+        }
 
         // Check access to the service type
+        Module callerModule = caller.getModule();
         int mods = svc.getModifiers();
         if (!Reflection.verifyMemberAccess(caller, svc, null, mods)) {
             fail(svc, "service type not accessible to " + callerModule);
@@ -826,13 +824,13 @@
 
     /**
      * Implements lazy service provider lookup of service providers that
-     * are provided by modules in a module Layer (or parent layers)
+     * are provided by modules in a module layer (or parent layers)
      */
     private final class LayerLookupIterator<T>
         implements Iterator<Provider<T>>
     {
-        Deque<Layer> stack = new ArrayDeque<>();
-        Set<Layer> visited = new HashSet<>();
+        Deque<ModuleLayer> stack = new ArrayDeque<>();
+        Set<ModuleLayer> visited = new HashSet<>();
         Iterator<ServiceProvider> iterator;
         ServiceProvider next;  // next provider to load
 
@@ -841,8 +839,8 @@
             stack.push(layer);
         }
 
-        private Iterator<ServiceProvider> providers(Layer layer) {
-            ServicesCatalog catalog = JLRM_ACCESS.getServicesCatalog(layer);
+        private Iterator<ServiceProvider> providers(ModuleLayer layer) {
+            ServicesCatalog catalog = LANG_ACCESS.getServicesCatalog(layer);
             return catalog.findServices(serviceName).iterator();
         }
 
@@ -864,10 +862,10 @@
                 if (stack.isEmpty())
                     return false;
 
-                Layer layer = stack.pop();
-                List<Layer> parents = layer.parents();
+                ModuleLayer layer = stack.pop();
+                List<ModuleLayer> parents = layer.parents();
                 for (int i = parents.size() - 1; i >= 0; i--) {
-                    Layer parent = parents.get(i);
+                    ModuleLayer parent = parents.get(i);
                     if (!visited.contains(parent)) {
                         visited.add(parent);
                         stack.push(parent);
@@ -915,8 +913,8 @@
          * Returns iterator to iterate over the implementations of {@code
          * service} in the given layer.
          */
-        private List<ServiceProvider> providers(Layer layer) {
-            ServicesCatalog catalog = JLRM_ACCESS.getServicesCatalog(layer);
+        private List<ServiceProvider> providers(ModuleLayer layer) {
+            ServicesCatalog catalog = LANG_ACCESS.getServicesCatalog(layer);
             return catalog.findServices(serviceName);
         }
 
@@ -946,10 +944,10 @@
                 return providers.iterator();
             } else {
                 List<ServiceProvider> allProviders = new ArrayList<>(providers);
-                Layer bootLayer = Layer.boot();
-                Iterator<Layer> iterator = JLRM_ACCESS.layers(loader).iterator();
+                ModuleLayer bootLayer = ModuleLayer.boot();
+                Iterator<ModuleLayer> iterator = LANG_ACCESS.layers(loader).iterator();
                 while (iterator.hasNext()) {
-                    Layer layer = iterator.next();
+                    ModuleLayer layer = iterator.next();
                     if (layer != bootLayer) {
                         allProviders.addAll(providers(layer));
                     }
@@ -1535,7 +1533,7 @@
 
     /**
      * Creates a new service loader for the given service type that loads
-     * service providers from modules in the given {@code Layer} and its
+     * service providers from modules in the given {@code ModuleLayer} and its
      * ancestors.
      *
      * @apiNote Unlike the other load methods defined here, the service type
@@ -1545,7 +1543,7 @@
      * @param  <S> the class of the service type
      *
      * @param  layer
-     *         The module Layer
+     *         The module layer
      *
      * @param  service
      *         The interface or abstract class representing the service
@@ -1561,7 +1559,7 @@
      * @spec JPMS
      */
     @CallerSensitive
-    public static <S> ServiceLoader<S> load(Layer layer, Class<S> service) {
+    public static <S> ServiceLoader<S> load(ModuleLayer layer, Class<S> service) {
         return new ServiceLoader<>(Reflection.getCallerClass(), layer, service);
     }
 
--- a/jdk/src/java.base/share/classes/java/util/Timer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/Timer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, 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
@@ -108,6 +108,7 @@
      * finalizer forgetting to call it.
      */
     private final Object threadReaper = new Object() {
+        @SuppressWarnings("deprecation")
         protected void finalize() throws Throwable {
             synchronized(queue) {
                 thread.newTasksMayBeScheduled = false;
--- a/jdk/src/java.base/share/classes/java/util/concurrent/Executors.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/Executors.java	Mon Apr 10 08:31:37 2017 -0700
@@ -713,6 +713,7 @@
         FinalizableDelegatedExecutorService(ExecutorService executor) {
             super(executor);
         }
+        @SuppressWarnings("deprecation")
         protected void finalize() {
             super.shutdown();
         }
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1490,7 +1490,17 @@
     /**
      * Invokes {@code shutdown} when this executor is no longer
      * referenced and it has no threads.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() {
         shutdown();
     }
--- a/jdk/src/java.base/share/classes/java/util/jar/Pack200.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/jar/Pack200.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, 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
@@ -452,13 +452,13 @@
         String CODE_ATTRIBUTE_PFX       = "pack.code.attribute.";
 
         /**
-         * The unpacker's progress as a percentage, as periodically
-         * updated by the unpacker.
+         * The packer's progress as a percentage, as periodically
+         * updated by the packer.
          * Values of 0 - 100 are normal, and -1 indicates a stall.
          * Progress can be monitored by polling the value of this
          * property.
          * <p>
-         * At a minimum, the unpacker must set progress to 0
+         * At a minimum, the packer must set progress to 0
          * at the beginning of a packing operation, and to 100
          * at the end.
          */
@@ -623,7 +623,7 @@
          * property.
          * <p>
          * At a minimum, the unpacker must set progress to 0
-         * at the beginning of a packing operation, and to 100
+         * at the beginning of an unpacking operation, and to 100
          * at the end.
          */
         String PROGRESS         = "unpack.progress";
@@ -631,7 +631,7 @@
         /**
          * Get the set of this engine's properties. This set is
          * a "live view", so that changing its
-         * contents immediately affects the Packer engine, and
+         * contents immediately affects the Unpacker engine, and
          * changes from the engine (such as progress indications)
          * are immediately visible in the map.
          *
--- a/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,7 +31,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UncheckedIOException;
-import java.lang.reflect.Module;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Locale;
--- a/jdk/src/java.base/share/classes/java/util/zip/Deflater.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/zip/Deflater.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -551,7 +551,17 @@
 
     /**
      * Closes the compressor when garbage is collected.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() {
         end();
     }
--- a/jdk/src/java.base/share/classes/java/util/zip/Inflater.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/zip/Inflater.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -378,7 +378,17 @@
 
     /**
      * Closes the decompressor when garbage is collected.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() {
         end();
     }
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java	Mon Apr 10 08:31:37 2017 -0700
@@ -420,6 +420,7 @@
                     Integer.MAX_VALUE : (int) avail);
         }
 
+        @SuppressWarnings("deprecation")
         protected void finalize() throws Throwable {
             close();
         }
@@ -641,9 +642,18 @@
      * This will prevent holding up system resources for an undetermined
      * length of time.
      *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      * @throws IOException if an I/O error has occurred
      * @see    java.util.zip.ZipFile#close()
      */
+    @Deprecated(since="9")
     protected void finalize() throws IOException {
         close();
     }
@@ -813,6 +823,7 @@
             }
         }
 
+        @SuppressWarnings("deprecation")
         protected void finalize() {
             close();
         }
--- a/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,7 +25,6 @@
 
 package javax.crypto;
 
-import java.lang.reflect.Module;
 import java.security.*;
 import java.net.*;
 import java.util.*;
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,6 +106,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             cleanup();
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/BootLoader.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/BootLoader.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,8 +27,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.module.ModuleReference;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
@@ -62,8 +60,7 @@
     private static final String JAVA_HOME = System.getProperty("java.home");
 
     static {
-        UNNAMED_MODULE
-            = SharedSecrets.getJavaLangReflectModuleAccess().defineUnnamedModule(null);
+        UNNAMED_MODULE = SharedSecrets.getJavaLangAccess().defineUnnamedModule(null);
         setBootLoaderUnnamedModule0(UNNAMED_MODULE);
     }
 
@@ -255,7 +252,7 @@
 
             if (mn != null) {
                 // named module from runtime image or exploded module
-                Optional<Module> om = Layer.boot().findModule(mn);
+                Optional<Module> om = ModuleLayer.boot().findModule(mn);
                 if (!om.isPresent())
                     throw new InternalError(mn + " not in boot layer");
                 return om.get();
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.lang.reflect.Module;
 import java.net.URL;
 import java.nio.file.InvalidPathException;
 import java.nio.file.Paths;
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java	Mon Apr 10 08:31:37 2017 -0700
@@ -33,7 +33,6 @@
 import java.lang.module.ModuleReader;
 import java.lang.module.ModuleReference;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
@@ -80,8 +79,8 @@
  * loader. This allows automatic modules (for example) to link to types in the
  * unnamed module of the parent class loader.
  *
- * @see Layer#defineModulesWithOneLoader
- * @see Layer#defineModulesWithManyLoaders
+ * @see ModuleModuleLayer#defineModulesWithOneLoader
+ * @see ModuleModuleLayer#defineModulesWithManyLoaders
  */
 
 public final class Loader extends SecureClassLoader {
@@ -207,10 +206,10 @@
      * @param cf the Configuration containing at least modules to be defined to
      *           this class loader
      *
-     * @param parentLayers the parent Layers
+     * @param parentModuleLayers the parent ModuleLayers
      */
     public Loader initRemotePackageMap(Configuration cf,
-                                       List<Layer> parentLayers)
+                                       List<ModuleLayer> parentModuleLayers)
     {
         for (String name : nameToModule.keySet()) {
             ResolvedModule resolvedModule = cf.findModule(name).get();
@@ -236,8 +235,8 @@
                 } else {
 
                     // find the layer for the target module
-                    Layer layer = parentLayers.stream()
-                        .map(parent -> findLayer(parent, other.configuration()))
+                    ModuleLayer layer = parentModuleLayers.stream()
+                        .map(parent -> findModuleLayer(parent, other.configuration()))
                         .flatMap(Optional::stream)
                         .findAny()
                         .orElseThrow(() ->
@@ -286,8 +285,8 @@
      * Find the layer corresponding to the given configuration in the tree
      * of layers rooted at the given parent.
      */
-    private Optional<Layer> findLayer(Layer parent, Configuration cf) {
-        return SharedSecrets.getJavaLangReflectModuleAccess().layers(parent)
+    private Optional<ModuleLayer> findModuleLayer(ModuleLayer parent, Configuration cf) {
+        return SharedSecrets.getJavaLangAccess().layers(parent)
                 .filter(l -> l.configuration() == cf)
                 .findAny();
     }
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/LoaderPool.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/LoaderPool.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
 
 import java.lang.module.Configuration;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -36,7 +35,7 @@
 /**
  * A pool of class loaders.
  *
- * @see Layer#defineModulesWithManyLoaders
+ * @see ModuleLayer#defineModulesWithManyLoaders
  */
 
 public final class LoaderPool {
@@ -51,7 +50,7 @@
      * created with the given parent class loader as its parent.
      */
     public LoaderPool(Configuration cf,
-                      List<Layer> parentLayers,
+                      List<ModuleLayer> parentLayers,
                       ClassLoader parentLoader)
     {
         Map<String, Loader> loaders = new HashMap<>();
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,10 +30,10 @@
 import java.util.HashMap;
 import java.util.Map;
 import java.util.function.Function;
+import java.util.Objects;
 import java.lang.System.LoggerFinder;
 import java.lang.System.Logger;
 import java.lang.ref.ReferenceQueue;
-import java.lang.reflect.Module;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Collection;
@@ -155,6 +155,8 @@
 
     @Override
     public final Logger getLogger(String name,  Module module) {
+        Objects.requireNonNull(name, "name");
+        Objects.requireNonNull(module, "module");
         checkPermission();
         return demandLoggerFor(name, module);
     }
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,7 +31,6 @@
 import java.lang.System.LoggerFinder;
 import java.lang.System.Logger;
 import java.lang.ref.WeakReference;
-import java.lang.reflect.Module;
 import java.util.Objects;
 import jdk.internal.misc.VM;
 import sun.util.logging.PlatformLogger;
@@ -402,10 +401,10 @@
      * @param module The module on behalf of which the logger is created.
      *               If the module is not loaded from the Boot ClassLoader,
      *               the LoggerFinder is accessed and the logger returned
-     *               by {@link LoggerFinder#getLogger(java.lang.String, java.lang.reflect.Module)}
+     *               by {@link LoggerFinder#getLogger(java.lang.String, java.lang.Module)}
      *               is returned to the caller directly.
      *               Otherwise, the logger returned by
-     *               {@link #getLazyLogger(java.lang.String, java.lang.reflect.Module)}
+     *               {@link #getLazyLogger(java.lang.String, java.lang.Module)}
      *               is returned to the caller.
      *
      * @return  a (possibly lazy) Logger instance.
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,10 +27,10 @@
 
 import java.io.IOException;
 import java.lang.annotation.Annotation;
+import java.lang.module.ModuleDescriptor;
 import java.lang.reflect.Executable;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
+import java.net.URI;
 import java.net.URL;
 import java.security.AccessControlContext;
 import java.security.ProtectionDomain;
@@ -38,6 +38,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Stream;
 
+import jdk.internal.module.ServicesCatalog;
 import jdk.internal.reflect.ConstantPool;
 import sun.reflect.annotation.AnnotationType;
 import sun.nio.ch.Interruptible;
@@ -140,11 +141,6 @@
     void invokeFinalize(Object o) throws Throwable;
 
     /**
-     * Returns the boot Layer
-     */
-    Layer getBootLayer();
-
-    /**
      * Returns the ConcurrentHashMap used as a storage for ClassLoaderValue(s)
      * associated with the given class loader, creating it if it doesn't already exist.
      */
@@ -185,4 +181,74 @@
      * Invalidate package access cache
      */
     void invalidatePackageAccessCache();
+
+    /**
+     * Defines a new module to the Java virtual machine. The module
+     * is defined to the given class loader.
+     *
+     * The URI is for information purposes only, it can be {@code null}.
+     */
+    Module defineModule(ClassLoader loader, ModuleDescriptor descriptor, URI uri);
+
+    /**
+     * Defines the unnamed module for the given class loader.
+     */
+    Module defineUnnamedModule(ClassLoader loader);
+
+    /**
+     * Updates the readability so that module m1 reads m2. The new read edge
+     * does not result in a strong reference to m2 (m2 can be GC'ed).
+     *
+     * This method is the same as m1.addReads(m2) but without a permission check.
+     */
+    void addReads(Module m1, Module m2);
+
+    /**
+     * Updates module m to read all unnamed modules.
+     */
+    void addReadsAllUnnamed(Module m);
+
+    /**
+     * Updates module m1 to export a package to module m2. The export does
+     * not result in a strong reference to m2 (m2 can be GC'ed).
+     */
+    void addExports(Module m1, String pkg, Module m2);
+
+    /**
+     * Updates a module m to export a package to all unnamed modules.
+     */
+    void addExportsToAllUnnamed(Module m, String pkg);
+
+    /**
+     * Updates module m1 to open a package to module m2. Opening the
+     * package does not result in a strong reference to m2 (m2 can be GC'ed).
+     */
+    void addOpens(Module m1, String pkg, Module m2);
+
+    /**
+     * Updates a module m to open a package to all unnamed modules.
+     */
+    void addOpensToAllUnnamed(Module m, String pkg);
+
+    /**
+     * Updates a module m to use a service.
+     */
+    void addUses(Module m, Class<?> service);
+
+    /**
+     * Returns the ServicesCatalog for the given Layer.
+     */
+    ServicesCatalog getServicesCatalog(ModuleLayer layer);
+
+    /**
+     * Returns an ordered stream of layers. The first element is is the
+     * given layer, the remaining elements are its parents, in DFS order.
+     */
+    Stream<ModuleLayer> layers(ModuleLayer layer);
+
+    /**
+     * Returns a stream of the layers that have modules defined to the
+     * given class loader.
+     */
+    Stream<ModuleLayer> layers(ClassLoader loader);
 }
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.internal.misc;
-
-import java.lang.module.ModuleDescriptor;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
-import java.net.URI;
-import java.util.stream.Stream;
-
-import jdk.internal.module.ServicesCatalog;
-
-/**
- * Provides access to non-public methods in java.lang.reflect.Module
- */
-
-public interface JavaLangReflectModuleAccess {
-
-    /**
-     * Defines the unnamed module for the given class loader.
-     */
-    Module defineUnnamedModule(ClassLoader loader);
-
-    /**
-     * Defines a new module to the Java virtual machine. The module
-     * is defined to the given class loader.
-     *
-     * The URI is for information purposes only, it can be {@code null}.
-     */
-    Module defineModule(ClassLoader loader, ModuleDescriptor descriptor, URI uri);
-
-    /**
-     * Updates the readability so that module m1 reads m2. The new read edge
-     * does not result in a strong reference to m2 (m2 can be GC'ed).
-     *
-     * This method is the same as m1.addReads(m2) but without a permission check.
-     */
-    void addReads(Module m1, Module m2);
-
-    /**
-     * Updates module m to read all unnamed modules.
-     */
-    void addReadsAllUnnamed(Module m);
-
-    /**
-     * Update module m to export a package to all modules.
-     */
-    void addExports(Module m, String pn);
-
-    /**
-     * Updates module m1 to export a package to module m2. The export does
-     * not result in a strong reference to m2 (m2 can be GC'ed).
-     */
-    void addExports(Module m1, String pkg, Module m2);
-
-    /**
-     * Updates a module m to export a package to all unnamed modules.
-     */
-    void addExportsToAllUnnamed(Module m, String pkg);
-
-    /**
-     * Updates a module m to open a package to all modules.
-     */
-    void addOpens(Module m, String pkg);
-
-    /**
-     * Updates module m1 to open a package to module m2. Opening the
-     * package does not result in a strong reference to m2 (m2 can be GC'ed).
-     */
-    void addOpens(Module m1, String pkg, Module m2);
-
-    /**
-     * Updates a module m to open a package to all unnamed modules.
-     */
-    void addOpensToAllUnnamed(Module m, String pkg);
-
-    /**
-     * Updates a module m to use a service.
-     */
-    void addUses(Module m, Class<?> service);
-
-    /**
-     * Returns the ServicesCatalog for the given Layer.
-     */
-    ServicesCatalog getServicesCatalog(Layer layer);
-
-    /**
-     * Returns an ordered stream of layers. The first element is is the
-     * given layer, the remaining elements are its parents, in DFS order.
-     */
-    Stream<Layer> layers(Layer layer);
-
-    /**
-     * Returns a stream of the layers that have modules defined to the
-     * given class loader.
-     */
-    Stream<Layer> layers(ClassLoader loader);
-}
\ No newline at end of file
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaUtilResourceBundleAccess.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaUtilResourceBundleAccess.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,7 +25,6 @@
 
 package jdk.internal.misc;
 
-import java.lang.reflect.Module;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java	Mon Apr 10 08:31:37 2017 -0700
@@ -50,7 +50,6 @@
     private static JavaUtilJarAccess javaUtilJarAccess;
     private static JavaLangAccess javaLangAccess;
     private static JavaLangModuleAccess javaLangModuleAccess;
-    private static JavaLangReflectModuleAccess javaLangReflectModuleAccess;
     private static JavaLangInvokeAccess javaLangInvokeAccess;
     private static JavaLangRefAccess javaLangRefAccess;
     private static JavaIOAccess javaIOAccess;
@@ -119,16 +118,6 @@
         return javaLangModuleAccess;
     }
 
-    public static void setJavaLangReflectModuleAccess(JavaLangReflectModuleAccess jlrma) {
-        javaLangReflectModuleAccess = jlrma;
-    }
-
-    public static JavaLangReflectModuleAccess getJavaLangReflectModuleAccess() {
-        if (javaLangReflectModuleAccess == null)
-            unsafe.ensureClassInitialized(java.lang.reflect.Module.class);
-        return javaLangReflectModuleAccess;
-    }
-
     public static void setJavaLangRefAccess(JavaLangRefAccess jlra) {
         javaLangRefAccess = jlra;
     }
--- a/jdk/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
 
 import java.io.PrintStream;
 import java.lang.invoke.MethodHandles;
-import java.lang.reflect.Module;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.CodeSource;
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Mon Apr 10 08:31:37 2017 -0700
@@ -32,9 +32,6 @@
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReference;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
-import java.lang.reflect.LayerInstantiationException;
-import java.lang.reflect.Module;
 import java.net.URI;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -61,7 +58,7 @@
  * resolving a set of module names specified via the launcher (or equivalent)
  * -m and --add-modules options. The modules are located on a module path that
  * is constructed from the upgrade module path, system modules, and application
- * module path. The Configuration is instantiated as the boot Layer with each
+ * module path. The Configuration is instantiated as the boot layer with each
  * module in the the configuration defined to one of the built-in class loaders.
  */
 
@@ -106,11 +103,11 @@
     }
 
     /**
-     * Initialize the module system, returning the boot Layer.
+     * Initialize the module system, returning the boot layer.
      *
      * @see java.lang.System#initPhase2()
      */
-    public static Layer boot() {
+    public static ModuleLayer boot() {
 
         long t0 = System.nanoTime();
 
@@ -237,7 +234,6 @@
             ModuleFinder f = finder;  // observable modules
             systemModules.findAll()
                 .stream()
-                .filter(mref -> !ModuleResolution.doNotResolveByDefault(mref))
                 .map(ModuleReference::descriptor)
                 .map(ModuleDescriptor::name)
                 .filter(mn -> f.find(mn).isPresent())  // observable
@@ -321,8 +317,7 @@
         if (SystemModules.hasSplitPackages() || needPostResolutionChecks) {
             Map<String, String> packageToModule = new HashMap<>();
             for (ResolvedModule resolvedModule : cf.modules()) {
-                ModuleDescriptor descriptor =
-                    resolvedModule.reference().descriptor();
+                ModuleDescriptor descriptor = resolvedModule.reference().descriptor();
                 String name = descriptor.name();
                 for (String p : descriptor.packages()) {
                     String other = packageToModule.putIfAbsent(p, name);
@@ -338,7 +333,7 @@
         long t4 = System.nanoTime();
 
         // define modules to VM/runtime
-        Layer bootLayer = Layer.empty().defineModules(cf, clf);
+        ModuleLayer bootLayer = ModuleLayer.empty().defineModules(cf, clf);
 
         PerfCounters.layerCreateTime.addElapsedTimeFrom(t4);
 
@@ -476,7 +471,7 @@
      * Process the --add-reads options to add any additional read edges that
      * are specified on the command-line.
      */
-    private static void addExtraReads(Layer bootLayer) {
+    private static void addExtraReads(ModuleLayer bootLayer) {
 
         // decode the command line options
         Map<String, List<String>> map = decode("jdk.module.addreads.");
@@ -514,7 +509,7 @@
      * Process the --add-exports and --add-opens options to export/open
      * additional packages specified on the command-line.
      */
-    private static void addExtraExportsAndOpens(Layer bootLayer) {
+    private static void addExtraExportsAndOpens(ModuleLayer bootLayer) {
         // --add-exports
         String prefix = "jdk.module.addexports.";
         Map<String, List<String>> extraExports = decode(prefix);
@@ -548,7 +543,7 @@
         }
     }
 
-    private static void addExtraExportsOrOpens(Layer bootLayer,
+    private static void addExtraExportsOrOpens(ModuleLayer bootLayer,
                                                Map<String, List<String>> map,
                                                boolean opens)
     {
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java	Mon Apr 10 08:31:37 2017 -0700
@@ -135,8 +135,9 @@
                     Path top = file;
                     Files.find(top, Integer.MAX_VALUE,
                                ((path, attrs) -> attrs.isRegularFile()))
-                            .filter(path -> !isAutomatic
+                            .filter(path -> (!isAutomatic
                                     || path.toString().endsWith(".class"))
+                                    && !isHidden(path))
                             .map(path -> toPackageName(top, path))
                             .filter(Checks::isPackageName)
                             .forEach(packages::add);
@@ -177,11 +178,13 @@
 
         ModuleTarget target = null;
         ModuleHashes recordedHashes = null;
+        ModuleHashes.HashSupplier hasher = null;
         ModuleResolution mres = null;
         if (mref instanceof ModuleReferenceImpl) {
             ModuleReferenceImpl impl = (ModuleReferenceImpl)mref;
             target = impl.moduleTarget();
             recordedHashes = impl.recordedHashes();
+            hasher = impl.hasher();
             mres = impl.moduleResolution();
         }
 
@@ -191,7 +194,7 @@
                                        this,
                                        target,
                                        recordedHashes,
-                                       null,
+                                       hasher,
                                        mres);
 
     }
@@ -556,7 +559,7 @@
 
 
     /**
-     * Derives a package name from a file path to a .class file.
+     * Derives a package name from the file path of an entry in an exploded patch
      */
     private static String toPackageName(Path top, Path file) {
         Path entry = top.relativize(file);
@@ -569,6 +572,17 @@
     }
 
     /**
+     * Returns true if the given file exists and is a hidden file
+     */
+    private boolean isHidden(Path file) {
+        try {
+            return Files.isHidden(file);
+        } catch (IOException ioe) {
+            return false;
+        }
+    }
+
+    /**
      * Derives a package name from the name of an entry in a JAR file.
      */
     private static String toPackageName(Path file, JarEntry entry) {
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java	Mon Apr 10 08:31:37 2017 -0700
@@ -547,7 +547,6 @@
      */
     private static class Patterns {
         static final Pattern DASH_VERSION = Pattern.compile("-(\\d+(\\.|$))");
-        static final Pattern TRAILING_VERSION = Pattern.compile("(\\.|\\d)*$");
         static final Pattern NON_ALPHANUM = Pattern.compile("[^A-Za-z0-9]");
         static final Pattern REPEATING_DOTS = Pattern.compile("(\\.)(\\1)+");
         static final Pattern LEADING_DOTS = Pattern.compile("^\\.");
@@ -558,9 +557,6 @@
      * Clean up candidate module name derived from a JAR file name.
      */
     private static String cleanModuleName(String mn) {
-        // drop trailing version from name
-        mn = Patterns.TRAILING_VERSION.matcher(mn).replaceAll("");
-
         // replace non-alphanumeric
         mn = Patterns.NON_ALPHANUM.matcher(mn).replaceAll(".");
 
@@ -630,7 +626,7 @@
     private Set<String> explodedPackages(Path dir) {
         try {
             return Files.find(dir, Integer.MAX_VALUE,
-                              ((path, attrs) -> attrs.isRegularFile()))
+                    ((path, attrs) -> attrs.isRegularFile() && !isHidden(path)))
                     .map(path -> dir.relativize(path))
                     .map(this::toPackageName)
                     .flatMap(Optional::stream)
@@ -726,6 +722,17 @@
         }
     }
 
+    /**
+     * Returns true if the given file exists and is a hidden file
+     */
+    private boolean isHidden(Path file) {
+        try {
+            return Files.isHidden(file);
+        } catch (IOException ioe) {
+            return false;
+        }
+    }
+
     private static final PerfCounter scanTime
         = PerfCounter.newPerfCounter("jdk.module.finder.modulepath.scanTime");
     private static final PerfCounter moduleCount
--- a/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,15 +26,13 @@
 package jdk.internal.module;
 
 import java.lang.module.ModuleDescriptor;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.net.URI;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
 import jdk.internal.loader.BootLoader;
 import jdk.internal.loader.ClassLoaders;
-import jdk.internal.misc.JavaLangReflectModuleAccess;
+import jdk.internal.misc.JavaLangAccess;
 import jdk.internal.misc.SharedSecrets;
 
 /**
@@ -51,8 +49,7 @@
 public class Modules {
     private Modules() { }
 
-    private static final JavaLangReflectModuleAccess JLRMA
-        = SharedSecrets.getJavaLangReflectModuleAccess();
+    private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
 
     /**
      * Creates a new Module. The module has the given ModuleDescriptor and
@@ -67,7 +64,7 @@
                                       ModuleDescriptor descriptor,
                                       URI uri)
     {
-        return JLRMA.defineModule(loader, descriptor, uri);
+        return JLA.defineModule(loader, descriptor, uri);
     }
 
     /**
@@ -75,23 +72,14 @@
      * Same as m1.addReads(m2) but without a caller check.
      */
     public static void addReads(Module m1, Module m2) {
-        JLRMA.addReads(m1, m2);
+        JLA.addReads(m1, m2);
     }
 
     /**
      * Update module m to read all unnamed modules.
      */
     public static void addReadsAllUnnamed(Module m) {
-        JLRMA.addReadsAllUnnamed(m);
-    }
-
-    /**
-     * Update module m to export a package to all modules.
-     *
-     * This method is for intended for use by tests only.
-     */
-    public static void addExports(Module m, String pn) {
-        JLRMA.addExports(m, pn);
+        JLA.addReadsAllUnnamed(m);
     }
 
     /**
@@ -99,23 +87,14 @@
      * Same as m1.addExports(pn, m2) but without a caller check
      */
     public static void addExports(Module m1, String pn, Module m2) {
-        JLRMA.addExports(m1, pn, m2);
+        JLA.addExports(m1, pn, m2);
     }
 
     /**
      * Updates module m to export a package to all unnamed modules.
      */
     public static void addExportsToAllUnnamed(Module m, String pn) {
-        JLRMA.addExportsToAllUnnamed(m, pn);
-    }
-
-    /**
-     * Update module m to open a package to all modules.
-     *
-     * This method is for intended for use by tests only.
-     */
-    public static void addOpens(Module m, String pn) {
-        JLRMA.addOpens(m, pn);
+        JLA.addExportsToAllUnnamed(m, pn);
     }
 
     /**
@@ -123,14 +102,14 @@
      * Same as m1.addOpens(pn, m2) but without a caller check.
      */
     public static void addOpens(Module m1, String pn, Module m2) {
-        JLRMA.addOpens(m1, pn, m2);
+        JLA.addOpens(m1, pn, m2);
     }
 
     /**
      * Updates module m to open a package to all unnamed modules.
      */
     public static void addOpensToAllUnnamed(Module m, String pn) {
-        JLRMA.addOpensToAllUnnamed(m, pn);
+        JLA.addOpensToAllUnnamed(m, pn);
     }
 
     /**
@@ -138,16 +117,16 @@
      * Same as m2.addUses(service) but without a caller check.
      */
     public static void addUses(Module m, Class<?> service) {
-        JLRMA.addUses(m, service);
+        JLA.addUses(m, service);
     }
 
     /**
      * Updates module m to provide a service
      */
     public static void addProvides(Module m, Class<?> service, Class<?> impl) {
-        Layer layer = m.getLayer();
+        ModuleLayer layer = m.getLayer();
 
-        if (layer == null || layer == Layer.boot()) {
+        if (layer == null || layer == ModuleLayer.boot()) {
             // update ClassLoader catalog
             PrivilegedAction<ClassLoader> pa = m::getClassLoader;
             ClassLoader loader = AccessController.doPrivileged(pa);
@@ -162,9 +141,7 @@
 
         if (layer != null) {
             // update Layer catalog
-            SharedSecrets.getJavaLangReflectModuleAccess()
-                    .getServicesCatalog(layer)
-                    .addProvider(m, service, impl);
+            JLA.getServicesCatalog(layer).addProvider(m, service, impl);
         }
     }
 
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,7 +25,6 @@
 
 package jdk.internal.module;
 
-import java.lang.reflect.Module;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleDescriptor.Provides;
 import java.util.ArrayList;
--- a/jdk/src/java.base/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the foundational APIs of the Java SE Platform.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.base {
--- a/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
 
 import java.lang.reflect.Modifier;
 import static java.lang.reflect.Modifier.*;
-import java.lang.reflect.Module;
 import java.util.Objects;
 import jdk.internal.reflect.Reflection;
 
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Mon Apr 10 08:31:37 2017 -0700
@@ -50,10 +50,8 @@
 import java.lang.module.ModuleDescriptor.Exports;
 import java.lang.module.ModuleDescriptor.Opens;
 import java.lang.module.ModuleDescriptor.Provides;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.URI;
@@ -467,7 +465,7 @@
                 String mn = s[0];
                 String pn = s[1];
 
-                Layer.boot().findModule(mn).ifPresent(m -> {
+                ModuleLayer.boot().findModule(mn).ifPresent(m -> {
                     if (m.getDescriptor().packages().contains(pn)) {
                         if (open) {
                             Modules.addOpensToAllUnnamed(m, pn);
@@ -564,7 +562,7 @@
         }
 
         // main module is in the boot layer
-        Layer layer = Layer.boot();
+        ModuleLayer layer = ModuleLayer.boot();
         Optional<Module> om = layer.findModule(mainModule);
         if (!om.isPresent()) {
             // should not happen
@@ -854,7 +852,7 @@
         private static void setFXLaunchParameters(String what, int mode) {
 
             // find the module with the FX launcher
-            Optional<Module> om = Layer.boot().findModule(JAVAFX_GRAPHICS_MODULE_NAME);
+            Optional<Module> om = ModuleLayer.boot().findModule(JAVAFX_GRAPHICS_MODULE_NAME);
             if (!om.isPresent()) {
                 abort(null, "java.launcher.cls.error5");
             }
@@ -938,8 +936,7 @@
      * 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 (-listmods:java.base,java.desktop for
-     * example).
+     * names of the modules to list (e.g. --list-modules java.base,java.desktop)
      */
     static void listModules(boolean printToStderr, String optionFlag)
         throws IOException, ClassNotFoundException
@@ -947,89 +944,97 @@
         initOutput(printToStderr);
 
         ModuleFinder finder = jdk.internal.module.ModuleBootstrap.finder();
-
         int colon = optionFlag.indexOf('=');
         if (colon == -1) {
             finder.findAll().stream()
-                .sorted(Comparator.comparing(ModuleReference::descriptor))
-                .forEach(md -> {
-                    ostream.println(midAndLocation(md.descriptor(),
-                                                   md.location()));
-                });
+                  .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 observable!%n", name);
+                    System.err.format("%s not found%n", name);
                     continue;
                 }
-
-                ModuleDescriptor md = mref.descriptor();
-                if (md.isOpen())
-                    ostream.print("open ");
-                if (md.isAutomatic())
-                    ostream.print("automatic ");
-                if (md.modifiers().contains(ModuleDescriptor.Modifier.SYNTHETIC))
-                    ostream.print("synthetic ");
-                if (md.modifiers().contains(ModuleDescriptor.Modifier.MANDATED))
-                    ostream.print("mandated ");
-                ostream.println("module " + midAndLocation(md, mref.location()));
-
-                // 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()))
-                            .collect(Collectors.joining(" "));
-                    ostream.format("  exports %s%n", modsAndSource);
-                }
-
-                for (Requires d : md.requires()) {
-                    ostream.format("  requires %s%n", d);
-                }
-                for (String s : md.uses()) {
-                    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(", ")));
-                }
-
-                // 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());
-                    }
-                }
-
-                // open packages
-                for (Opens obj: md.opens()) {
-                    String modsAndSource = Stream.concat(toStringStream(obj.modifiers()),
-                            Stream.of(obj.source()))
-                            .collect(Collectors.joining(" "));
-                    ostream.format("  opens %s", modsAndSource);
-                    if (obj.isQualified())
-                        formatCommaList(ostream, " to", obj.targets());
-                    else
-                        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));
+                describeModule(finder, mref, true);
             }
         }
     }
 
+    /**
+     * Describes the given module.
+     */
+    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();
+
+        if (!verbose)
+            return;
+
+        // 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()))
+                    .collect(Collectors.joining(" "));
+            ostream.format("  exports %s%n", modsAndSource);
+        }
+
+        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);
+        }
+        for (String s : md.uses()) {
+            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(", ")));
+        }
+
+        // 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());
+            }
+        }
+
+        // open packages
+        for (Opens obj: md.opens()) {
+            String modsAndSource = Stream.concat(toStringStream(obj.modifiers()),
+                    Stream.of(obj.source()))
+                    .collect(Collectors.joining(" "));
+            ostream.format("  opens %s", modsAndSource);
+            if (obj.isQualified())
+                formatCommaList(ostream, " to", obj.targets());
+            else
+                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));
+    }
+
     static <T> String toString(Set<T> s) {
         return toStringStream(s).collect(Collectors.joining(" "));
     }
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -39,7 +39,8 @@
 java.launcher.opt.hotspot    =\    {0}\t  is a synonym for the "{1}" VM  [deprecated]\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n\
+java.launcher.opt.footer = \
+\    -cp <class search path of directories and zip/jar files>\n\
 \    -classpath <class search path of directories and zip/jar files>\n\
 \    --class-path <class search path of directories and zip/jar files>\n\
 \                  A {0} separated list of directories, JAR archives,\n\
@@ -101,8 +102,11 @@
 \                  should always be passed as the argument to the -splash option.\n\
 \                  The most appropriate scaled image provided will be picked up\n\
 \                  automatically.\n\
-\                  See the SplashScreen API documentation for more information.\n\
-\    @<filepath>   read options from the specified file\n\n\
+\                  See the SplashScreen API documentation for more information\n\
+\    @argument files\n\
+\                  one or more argument files containing options\n\
+\    -disable-@files\n\
+\                  prevent further argument file expansion\n\
 \To specify an argument for a long option, you can use --<name>=<value> or\n\
 \--<name> <value>.\n
 
--- a/jdk/src/java.base/share/classes/sun/net/www/MeteredStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/net/www/MeteredStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -203,6 +203,7 @@
         return super.markSupported();
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             close();
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,6 +77,7 @@
      * Called by layered delegator's finalize() method to handle closing
      * the underlying object.
      */
+    @SuppressWarnings("deprecation")
     protected void dispose() throws Throwable {
         super.finalize();
     }
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -478,6 +478,7 @@
      * sun.net.www.protocol.http.HttpURLConnection's finalize()
      * would have to be made public.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         delegate.dispose();
     }
--- a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1034,6 +1034,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws IOException {
         // fd is null if constructor threw exception
         if (fd != null)
--- a/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,7 +25,6 @@
 
 package sun.reflect.misc;
 
-import java.lang.reflect.Module;
 import java.io.EOFException;
 import java.security.AllPermission;
 import java.security.AccessController;
--- a/jdk/src/java.base/share/classes/sun/security/provider/KeyProtector.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/provider/KeyProtector.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, 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
@@ -147,6 +147,7 @@
      * Ensures that the password bytes of this key protector are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         if (passwdBytes != null) {
             Arrays.fill(passwdBytes, (byte)0x00);
--- a/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -265,6 +265,7 @@
      * the penalty of prematurly killing SSL sessions.
      */
     @Override
+    @SuppressWarnings("deprecation")
     protected final void finalize() throws Throwable {
         try {
             close();
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -247,6 +247,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected final void finalize() throws Throwable {
         // empty
         super.finalize();
--- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1025,6 +1025,13 @@
             cf = CertificateFactory.getInstance("X509");
         }
 
+        // -trustcacerts can only be specified on -importcert.
+        // Reset it so that warnings on CA cert will remain for
+        // -printcert, etc.
+        if (command != IMPORTCERT) {
+            trustcacerts = false;
+        }
+
         if (trustcacerts) {
             caks = KeyStoreUtil.getCacertsKeyStore();
         }
@@ -1758,9 +1765,8 @@
         if (keyPass == null) {
             keyPass = promptForKeyPass(alias, null, storePass);
         }
+        checkWeak(rb.getString("the.generated.certificate"), chain[0]);
         keyStore.setKeyEntry(alias, privKey, keyPass, chain);
-
-        checkWeak(rb.getString("the.generated.certificate"), chain[0]);
     }
 
     /**
@@ -2118,6 +2124,10 @@
         }
 
         try {
+            Certificate c = srckeystore.getCertificate(alias);
+            if (c != null) {
+                checkWeak("<" + newAlias + ">", c);
+            }
             keyStore.setEntry(newAlias, entry, pp);
             // Place the check so that only successful imports are blocked.
             // For example, we don't block a failed SecretEntry import.
@@ -2127,10 +2137,6 @@
                             "The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified."));
                 }
             }
-            Certificate c = srckeystore.getCertificate(alias);
-            if (c != null) {
-                checkWeak("<" + newAlias + ">", c);
-            }
             return 1;
         } catch (KeyStoreException kse) {
             Object[] source2 = {alias, kse.toString()};
@@ -2814,8 +2820,8 @@
         }
 
         if (noprompt) {
+            checkWeak(rb.getString("the.input"), cert);
             keyStore.setCertificateEntry(alias, cert);
-            checkWeak(rb.getString("the.input"), cert);
             return true;
         }
 
@@ -3049,6 +3055,11 @@
         MessageFormat form = new MessageFormat
                 (rb.getString(".PATTERN.printX509Cert.with.weak"));
         PublicKey pkey = cert.getPublicKey();
+        String sigName = cert.getSigAlgName();
+        // No need to warn about sigalg of a trust anchor
+        if (!isTrustedCert(cert)) {
+            sigName = withWeak(sigName);
+        }
         Object[] source = {cert.getSubjectDN().toString(),
                         cert.getIssuerDN().toString(),
                         cert.getSerialNumber().toString(16),
@@ -3056,7 +3067,7 @@
                         cert.getNotAfter().toString(),
                         getCertFingerPrint("SHA-1", cert),
                         getCertFingerPrint("SHA-256", cert),
-                        withWeak(cert.getSigAlgName()),
+                        sigName,
                         withWeak(pkey),
                         cert.getVersion()
                         };
@@ -3111,7 +3122,7 @@
      * or null otherwise. A label is added.
      */
     private static Pair<String,Certificate>
-            getTrustedSigner(Certificate cert, KeyStore ks) throws Exception {
+            getSigner(Certificate cert, KeyStore ks) throws Exception {
         if (ks.getCertificateAlias(cert) != null) {
             return new Pair<>("", cert);
         }
@@ -3467,9 +3478,9 @@
         // do we trust the cert at the top?
         Certificate topCert = replyCerts[replyCerts.length-1];
         boolean fromKeyStore = true;
-        Pair<String,Certificate> root = getTrustedSigner(topCert, keyStore);
+        Pair<String,Certificate> root = getSigner(topCert, keyStore);
         if (root == null && trustcacerts && caks != null) {
-            root = getTrustedSigner(topCert, caks);
+            root = getSigner(topCert, caks);
             fromKeyStore = false;
         }
         if (root == null) {
@@ -4301,9 +4312,19 @@
         return result;
     }
 
+    private boolean isTrustedCert(Certificate cert) throws KeyStoreException {
+        if (caks != null && caks.getCertificateAlias(cert) != null) {
+            return true;
+        } else {
+            String inKS = keyStore.getCertificateAlias(cert);
+            return inKS != null && keyStore.isCertificateEntry(inKS);
+        }
+    }
+
     private void checkWeak(String label, String sigAlg, Key key) {
 
-        if (!DISABLED_CHECK.permits(SIG_PRIMITIVE_SET, sigAlg, null)) {
+        if (sigAlg != null && !DISABLED_CHECK.permits(
+                SIG_PRIMITIVE_SET, sigAlg, null)) {
             weakWarnings.add(String.format(
                     rb.getString("whose.sigalg.risk"), label, sigAlg));
         }
@@ -4316,7 +4337,8 @@
         }
     }
 
-    private void checkWeak(String label, Certificate[] certs) {
+    private void checkWeak(String label, Certificate[] certs)
+            throws KeyStoreException {
         for (int i = 0; i < certs.length; i++) {
             Certificate cert = certs[i];
             if (cert instanceof X509Certificate) {
@@ -4325,15 +4347,18 @@
                 if (certs.length > 1) {
                     fullLabel = oneInMany(label, i, certs.length);
                 }
-                checkWeak(fullLabel, xc.getSigAlgName(), xc.getPublicKey());
+                checkWeak(fullLabel, xc);
             }
         }
     }
 
-    private void checkWeak(String label, Certificate cert) {
+    private void checkWeak(String label, Certificate cert)
+            throws KeyStoreException {
         if (cert instanceof X509Certificate) {
             X509Certificate xc = (X509Certificate)cert;
-            checkWeak(label, xc.getSigAlgName(), xc.getPublicKey());
+            // No need to check the sigalg of a trust anchor
+            String sigAlg = isTrustedCert(cert) ? null : xc.getSigAlgName();
+            checkWeak(label, sigAlg, xc.getPublicKey());
         }
     }
 
--- a/jdk/src/java.base/share/legal/zlib.md	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/legal/zlib.md	Mon Apr 10 08:31:37 2017 -0700
@@ -1,9 +1,9 @@
-## zlib v1.2.8
+## zlib v1.2.11
 
 ### zlib License
 <pre>
 
-Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
 
 This software is provided 'as-is', without any express or implied
 warranty.  In no event will the authors be held liable for any damages
--- a/jdk/src/java.base/share/native/libjava/Module.c	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.base/share/native/libjava/Module.c	Mon Apr 10 08:31:37 2017 -0700
@@ -29,12 +29,12 @@
 #include "jni_util.h"
 #include "jvm.h"
 
-#include "java_lang_reflect_Module.h"
+#include "java_lang_Module.h"
 
 /*
  * Gets the UTF-8 chars for the string and translates '.' to '/'.  Does no
  * further validation, assumption being that both calling code in
- * java.lang.reflect.Module and VM will do deeper validation.
+ * java.lang.Module and VM will do deeper validation.
  */
 static char*
 GetInternalPackageName(JNIEnv *env, jstring pkg, char* buf, jsize buf_size)
@@ -68,7 +68,7 @@
 }
 
 JNIEXPORT void JNICALL
-Java_java_lang_reflect_Module_defineModule0(JNIEnv *env, jclass cls, jobject module,
+Java_java_lang_Module_defineModule0(JNIEnv *env, jclass cls, jobject module,
                                             jboolean is_open, jstring version,
                                             jstring location, jobjectArray packages)
 {
@@ -109,14 +109,14 @@
 }
 
 JNIEXPORT void JNICALL
-Java_java_lang_reflect_Module_addReads0(JNIEnv *env, jclass cls, jobject from, jobject to)
+Java_java_lang_Module_addReads0(JNIEnv *env, jclass cls, jobject from, jobject to)
 {
     JVM_AddReadsModule(env, from, to);
 }
 
 JNIEXPORT void JNICALL
-Java_java_lang_reflect_Module_addExports0(JNIEnv *env, jclass cls, jobject from,
-                                          jstring pkg, jobject to)
+Java_java_lang_Module_addExports0(JNIEnv *env, jclass cls, jobject from,
+                                  jstring pkg, jobject to)
 {
     char buf[128];
     char* pkg_name;
@@ -136,8 +136,8 @@
 }
 
 JNIEXPORT void JNICALL
-Java_java_lang_reflect_Module_addExportsToAll0(JNIEnv *env, jclass cls, jobject from,
-                                               jstring pkg)
+Java_java_lang_Module_addExportsToAll0(JNIEnv *env, jclass cls, jobject from,
+                                       jstring pkg)
 {
     char buf[128];
     char* pkg_name;
@@ -157,8 +157,8 @@
 }
 
 JNIEXPORT void JNICALL
-Java_java_lang_reflect_Module_addExportsToAllUnnamed0(JNIEnv *env, jclass cls,
-                                                      jobject from, jstring pkg)
+Java_java_lang_Module_addExportsToAllUnnamed0(JNIEnv *env, jclass cls,
+                                              jobject from, jstring pkg)
 {
     char buf[128];
     char* pkg_name;
@@ -178,7 +178,7 @@
 }
 
 JNIEXPORT void JNICALL
-Java_java_lang_reflect_Module_addPackage0(JNIEnv *env, jclass cls, jobject m, jstring pkg)
+Java_java_lang_Module_addPackage0(JNIEnv *env, jclass cls, jobject m, jstring pkg)
 {
     char buf[128];
     char* pkg_name;
--- a/jdk/src/java.datatransfer/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.datatransfer/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,8 +24,9 @@
  */
 
 /**
- * Defines an API for transferring data between and within applications.
+ * Defines the API for transferring data between and within applications.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.datatransfer {
--- a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,6 +114,7 @@
         changes.putAll(other.changes);
     }
 
+    @SuppressWarnings("deprecation")
     protected synchronized void finalize() throws Throwable {
         if (cfDictionaryPtr == 0) return;
         disposeCFDictionary(cfDictionaryPtr);
--- a/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java	Mon Apr 10 08:31:37 2017 -0700
@@ -124,6 +124,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             super.finalize();
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java	Mon Apr 10 08:31:37 2017 -0700
@@ -250,6 +250,7 @@
         return compFont;
     }
 
+    @SuppressWarnings("deprecation")
     protected synchronized void finalize() {
         if (nativeFontPtr != 0) {
             disposeNativeFont(nativeFontPtr);
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -127,6 +127,7 @@
         return nativeStrikePtr;
     }
 
+    @SuppressWarnings("deprecation")
     protected synchronized void finalize() throws Throwable {
         if (nativeStrikePtr != 0) {
             disposeNativeStrikePtr(nativeStrikePtr);
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,6 +135,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected final void finalize() throws Throwable {
         dispose();
     }
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, 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
@@ -556,6 +556,7 @@
     // The following methods are CPrinterJob specific.
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         synchronized (fNSPrintInfoLock) {
             if (fNSPrintInfo != -1) {
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, 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
@@ -72,6 +72,7 @@
         streamPos = pos;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         // Empty finalizer (for improved performance; no need to call
         // super.finalize() in this case)
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +143,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         // Empty finalizer (for improved performance; no need to call
         // super.finalize() in this case)
@@ -279,6 +280,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         // Empty finalizer (for improved performance; no need to call
         // super.finalize() in this case)
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java	Mon Apr 10 08:31:37 2017 -0700
@@ -435,6 +435,7 @@
         return compDataLength;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         super.finalize();
         if(JPEGWriter != null) {
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,6 +139,7 @@
         JPEGReader.read(0, JPEGParam);
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         super.finalize();
         JPEGReader.dispose();
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -610,6 +610,7 @@
         JPEGReader.read(0, JPEGParam);
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         super.finalize();
         JPEGReader.dispose();
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 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
@@ -60,6 +60,7 @@
         this.stream = stream;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             stream.close();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -444,6 +444,7 @@
      * close this device if discarded by the garbage collector.
      */
     @Override
+    @SuppressWarnings("deprecation")
     protected final void finalize() {
         close();
     }
--- a/jdk/src/java.desktop/share/classes/java/awt/Graphics.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/Graphics.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -1159,8 +1159,18 @@
 
     /**
      * Disposes of this graphics context once it is no longer referenced.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      * @see #dispose
      */
+    @Deprecated(since="9")
     public void finalize() {
         dispose();
     }
--- a/jdk/src/java.desktop/share/classes/java/awt/PrintJob.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/PrintJob.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, 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
@@ -79,8 +79,18 @@
 
     /**
      * Ends this print job once it is no longer referenced.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      * @see #end
      */
+    @Deprecated(since="9")
     public void finalize() {
         end();
     }
--- a/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java	Mon Apr 10 08:31:37 2017 -0700
@@ -751,7 +751,17 @@
 
     /**
      * Frees the resources associated with an ICC_Profile object.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize () {
         if (cmmProfile != null) {
             CMSManager.getModule().freeProfile(cmmProfile);
--- a/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1620,7 +1620,17 @@
      * Disposes of system resources associated with this
      * {@code ColorModel} once this {@code ColorModel} is no
      * longer referenced.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     public void finalize() {
     }
 
@@ -1952,4 +1962,4 @@
         return lg16Toog16LUT;
     }
 
-}
\ No newline at end of file
+}
--- a/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1514,7 +1514,17 @@
      * Disposes of system resources associated with this
      * {@code ColorModel} once this {@code ColorModel} is no
      * longer referenced.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     public void finalize() {
     }
 
@@ -1630,4 +1640,4 @@
         }
         return result;
     }
-}
\ No newline at end of file
+}
--- a/jdk/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
 import org.w3c.dom.Node;
 
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
--- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Arrays;
--- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, 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
@@ -706,7 +706,17 @@
      *
      * @exception Throwable if an error occurs during superclass
      * finalization.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     public void finalize() throws Throwable {
         deregisterAll();
         super.finalize();
@@ -846,6 +856,7 @@
         poset.clear();
     }
 
+    @SuppressWarnings("deprecation")
     public synchronized void finalize() {
         clear();
     }
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, 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
@@ -260,7 +260,17 @@
 
     /**
      * {@inheritDoc}
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable {
         // Empty finalizer: for performance reasons we instead use the
         // Disposer mechanism for ensuring that the underlying
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, 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
@@ -155,7 +155,17 @@
 
     /**
      * {@inheritDoc}
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable {
         // Empty finalizer: for performance reasons we instead use the
         // Disposer mechanism for ensuring that the underlying
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, 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
@@ -163,7 +163,17 @@
 
     /**
      * {@inheritDoc}
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable {
         // Empty finalizer: for performance reasons we instead use the
         // Disposer mechanism for ensuring that the underlying
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, 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
@@ -867,7 +867,17 @@
      *
      * @exception Throwable if an error occurs during superclass
      * finalization.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable {
         if (!isClosed) {
             try {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, 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
@@ -178,7 +178,17 @@
 
     /**
      * {@inheritDoc}
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable {
         // Empty finalizer: for performance reasons we instead use the
         // Disposer mechanism for ensuring that the underlying
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,7 +31,6 @@
 import java.security.PrivilegedAction;
 import java.util.Objects;
 import javax.swing.event.*;
-import java.lang.reflect.Module;
 import java.lang.ref.SoftReference;
 import java.util.HashMap;
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -351,6 +351,7 @@
             return rec.offset;
         }
 
+        @SuppressWarnings("deprecation")
         protected void finalize() throws Throwable {
             // schedule the record to be removed later
             // on another thread.
--- a/jdk/src/java.desktop/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,6 +27,7 @@
  * Defines the AWT and Swing user interface toolkits, plus APIs for
  * accessibility, audio, imaging, printing, and JavaBeans.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.desktop {
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -472,6 +472,7 @@
             this.pData = pData;
         }
 
+        @SuppressWarnings("deprecation")
         public void finalize() {
             if (pData != 0L) {
                 BufImgSurfaceData.freeNativeICMData(pData);
--- a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, 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
@@ -3633,6 +3633,7 @@
      * enough to know that if our override is empty then it should not
      * mark us as finalizeable.
      */
+    @SuppressWarnings("deprecation")
     public void finalize() {
         // DO NOT REMOVE THIS METHOD
     }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -383,6 +383,7 @@
      */
     //public native void dispose();
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         //dispose();
     }
--- a/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, 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
@@ -1336,6 +1336,7 @@
     /**
      * Empty finalizer as no clean up needed here.
      */
+    @SuppressWarnings("deprecation")
     public void finalize() {
     }
 
--- a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, 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
@@ -942,6 +942,7 @@
      * Ends this print job once it is no longer referenced.
      * @see #end
      */
+    @SuppressWarnings("deprecation")
     public void finalize() {
         end();
     }
--- a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, 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
@@ -1099,6 +1099,7 @@
     /**
      * Empty finalizer as no clean up needed here.
      */
+    @SuppressWarnings("deprecation")
     public void finalize() {
     }
 
--- a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, 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
@@ -1264,6 +1264,7 @@
     /**
      * Empty finalizer as no clean up needed here.
      */
+    @SuppressWarnings("deprecation")
     public void finalize() {
     }
 
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -181,6 +181,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         dispose();
         super.finalize();
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -132,6 +132,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable
     {
         // Release the resources used by the native input context.
--- a/jdk/src/java.instrument/share/classes/java/lang/instrument/ClassFileTransformer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/ClassFileTransformer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,7 +25,6 @@
 
 package java.lang.instrument;
 
-import java.lang.reflect.Module;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
--- a/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,7 +25,6 @@
 
 package java.lang.instrument;
 
-import java.lang.reflect.Module;
 import java.security.ProtectionDomain;
 import java.util.List;
 import java.util.Map;
@@ -346,7 +345,7 @@
 
 
     /**
-     * Determines whether a class is modifiable by
+     * Tests whether a class is modifiable by
      * {@linkplain #retransformClasses retransformation}
      * or {@linkplain #redefineClasses redefinition}.
      * If a class is modifiable then this method returns <code>true</code>.
@@ -711,8 +710,11 @@
      *         {@code extraProvides} map contains a service provider type that
      *         is not a member of the module or an implementation of the service;
      *         or {@code extraProvides} maps a key to an empty list
+     * @throws UnmodifiableModuleException if the module cannot be modified
      * @throws NullPointerException if any of the arguments are {@code null} or
      *         any of the Sets or Maps contains a {@code null} key or value
+     *
+     * @see #isModifiableModule(Module)
      * @since 9
      * @spec JPMS
      */
@@ -722,4 +724,19 @@
                         Map<String, Set<Module>> extraOpens,
                         Set<Class<?>> extraUses,
                         Map<Class<?>, List<Class<?>>> extraProvides);
+
+    /**
+     * 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}.
+     *
+     * @param module the module to test if it can be modified
+     * @return {@code true} if the module is modifiable, otherwise {@code false}
+     * @throws NullPointerException if the module is {@code null}
+     *
+     * @since 9
+     * @spec JPMS
+     */
+    boolean isModifiableModule(Module module);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableModuleException.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,56 @@
+/*
+ * 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.instrument;
+
+/**
+ * Thrown to indicate that a module cannot be modified.
+ *
+ * @see Instrumentation#redefineModule
+ * @since 9
+ * @spec JPMS
+ */
+
+public class UnmodifiableModuleException extends RuntimeException {
+    private static final long serialVersionUID = 6912511912351080644L;
+
+    /**
+     * Constructs an {@code UnmodifiableModuleException} with no
+     * detail message.
+     */
+    public UnmodifiableModuleException() {
+        super();
+    }
+
+    /**
+     * Constructs an {@code UnmodifiableModuleException} with the
+     * specified detail message.
+     *
+     * @param  msg the detail message.
+     */
+    public UnmodifiableModuleException(String msg) {
+        super(msg);
+    }
+}
--- a/jdk/src/java.instrument/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.instrument/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,6 +27,7 @@
  * Defines services that allow agents to
  * instrument programs running on the JVM.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.instrument {
--- a/jdk/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,11 +23,10 @@
  * questions.
  */
 
-
 package sun.instrument;
 
+import java.lang.instrument.UnmodifiableModuleException;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 import java.lang.reflect.AccessibleObject;
 import java.lang.instrument.ClassFileTransformer;
 import java.lang.instrument.ClassDefinition;
@@ -132,6 +131,13 @@
         return isModifiableClass0(mNativeAgent, theClass);
     }
 
+    public boolean isModifiableModule(Module module) {
+        if (module == null) {
+            throw new NullPointerException("'module' is null");
+        }
+        return true;
+    }
+
     public boolean
     isRetransformClassesSupported() {
         // ask lazily since there is some overhead
@@ -243,6 +249,9 @@
         if (!module.isNamed())
             return;
 
+        if (!isModifiableModule(module))
+            throw new UnmodifiableModuleException(module.getName());
+
         // copy and check reads
         extraReads = new HashSet<>(extraReads);
         if (extraReads.contains(null))
@@ -312,7 +321,7 @@
             return Collections.emptyMap();
 
         Map<String, Set<Module>> result = new HashMap<>();
-        Set<String> packages = Set.of(module.getPackages());
+        Set<String> packages = module.getPackages();
         for (Map.Entry<String, Set<Module>> e : map.entrySet()) {
             String pkg = e.getKey();
             if (pkg == null)
--- a/jdk/src/java.instrument/share/classes/sun/instrument/TransformerManager.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.instrument/share/classes/sun/instrument/TransformerManager.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,10 +25,8 @@
 
 package sun.instrument;
 
-
 import java.lang.instrument.Instrumentation;
 import java.lang.instrument.ClassFileTransformer;
-import java.lang.reflect.Module;
 import java.security.ProtectionDomain;
 
 /*
--- a/jdk/src/java.instrument/share/native/libinstrument/JPLISAgent.h	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.instrument/share/native/libinstrument/JPLISAgent.h	Mon Apr 10 08:31:37 2017 -0700
@@ -66,7 +66,7 @@
 #define JPLIS_INSTRUMENTIMPL_AGENTMAININVOKER_METHODSIGNATURE "(Ljava/lang/String;Ljava/lang/String;)V"
 #define JPLIS_INSTRUMENTIMPL_TRANSFORM_METHODNAME           "transform"
 #define JPLIS_INSTRUMENTIMPL_TRANSFORM_METHODSIGNATURE      \
-    "(Ljava/lang/reflect/Module;Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/Class;Ljava/security/ProtectionDomain;[BZ)[B"
+    "(Ljava/lang/Module;Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/Class;Ljava/security/ProtectionDomain;[BZ)[B"
 
 
 /*
--- a/jdk/src/java.logging/share/classes/java/util/logging/Level.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Level.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,10 +24,10 @@
  */
 
 package java.util.logging;
+
 import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
-import java.lang.reflect.Module;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
  * questions.
  */
 
-
 package java.util.logging;
 
 import java.io.*;
@@ -43,7 +42,6 @@
 import jdk.internal.misc.JavaAWTAccess;
 import jdk.internal.misc.SharedSecrets;
 import sun.util.logging.internal.LoggingProviderImpl;
-import java.lang.reflect.Module;
 import static jdk.internal.logger.DefaultLoggerFinder.isSystem;
 
 /**
--- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,11 +23,9 @@
  * questions.
  */
 
-
 package java.util.logging;
 
 import java.lang.ref.WeakReference;
-import java.lang.reflect.Module;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
@@ -664,7 +662,7 @@
      * a new logger is created.
      * <p>
      * If a new logger is created its log level will be configured
-     * based on the LogManager configuration and it will configured
+     * based on the LogManager configuration and it will be configured
      * to also send logging output to its parent's Handlers.  It will
      * be registered in the LogManager global namespace.
      * <p>
@@ -726,7 +724,7 @@
      *
      * <p>
      * If a new logger is created its log level will be configured
-     * based on the LogManager and it will configured to also send logging
+     * based on the LogManager and it will be configured to also send logging
      * output to its parent's Handlers.  It will be registered in
      * the LogManager global namespace.
      * <p>
--- a/jdk/src/java.logging/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.logging/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the Java Logging API.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.logging {
--- a/jdk/src/java.logging/share/classes/sun/util/logging/internal/LoggingProviderImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.logging/share/classes/sun/util/logging/internal/LoggingProviderImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -32,7 +32,6 @@
 import java.util.function.Supplier;
 import java.lang.System.LoggerFinder;
 import java.lang.System.Logger;
-import java.lang.reflect.Module;
 import java.util.Objects;
 import java.util.logging.LogManager;
 import jdk.internal.logger.DefaultLoggerFinder;
--- a/jdk/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnector.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnector.java	Mon Apr 10 08:31:37 2017 -0700
@@ -43,7 +43,6 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Module;
 import java.lang.reflect.Proxy;
 import java.net.MalformedURLException;
 import java.rmi.MarshalledObject;
--- a/jdk/src/java.management.rmi/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.management.rmi/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -46,6 +46,7 @@
  *           and load the appropriate {@code JMXConnectorServerProvider} service
  *           implementation for the given protocol.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.management.rmi {
--- a/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -38,8 +38,8 @@
  * a synchronizer that may be exclusively owned by a thread and uses
  * {@link AbstractOwnableSynchronizer AbstractOwnableSynchronizer}
  * (or its subclass) to implement its synchronization property.
- * {@link ReentrantLock ReentrantLock} and
- * {@link ReentrantReadWriteLock ReentrantReadWriteLock} are
+ * {@link ReentrantLock ReentrantLock} and the write-lock (but not
+ * the read-lock) of {@link ReentrantReadWriteLock ReentrantReadWriteLock} are
  * two examples of ownable synchronizers provided by the platform.
  *
  * <h3><a name="MappedType">MXBean Mapping</a></h3>
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
 import com.sun.jmx.mbeanserver.Util;
 import java.io.IOException;
 import java.io.UncheckedIOException;
-import java.lang.reflect.Module;
 import java.net.MalformedURLException;
 import java.util.Collections;
 import java.util.HashMap;
--- a/jdk/src/java.management/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.management/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,6 +29,7 @@
  * The JMX API consists of interfaces for monitoring and management of the
  * JVM and other components in the Java runtime.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.management {
--- a/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java	Mon Apr 10 08:31:37 2017 -0700
@@ -45,7 +45,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import java.lang.reflect.Module;
 import java.lang.reflect.UndeclaredThrowableException;
 import java.security.PrivilegedAction;
 import java.util.Collections;
@@ -181,8 +180,7 @@
             return AccessController.doPrivileged(new PrivilegedAction<>() {
                 @Override
                 public Class<?> run() {
-                    Optional<Module> logging = java.lang.reflect.Layer.boot()
-                        .findModule("java.logging");
+                    Optional<Module> logging = ModuleLayer.boot().findModule("java.logging");
                     if (logging.isPresent()) {
                         return Class.forName(logging.get(), className);
                     }
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
@@ -382,6 +382,7 @@
         listArg = ne.listArg;
     }
 
+    @SuppressWarnings("deprecation")
     protected final void finalize() {
         cleanup();
     }
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -474,6 +474,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         if (debug > 0) System.err.println("LdapClient: finalize " + this);
         forceClose(pooled);
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -2609,6 +2609,7 @@
 
    // ----------------- Connection  ---------------------
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         try {
             close();
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
@@ -129,6 +129,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         clearPassword();
     }
--- a/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java	Mon Apr 10 08:31:37 2017 -0700
@@ -176,7 +176,7 @@
     InputStream getResourceAsStream(Class<?> c, String name) {
         PrivilegedAction<InputStream> act = () -> {
             try {
-                java.lang.reflect.Module m = c.getModule();
+                Module m = c.getModule();
                 return c.getModule().getResourceAsStream(resolveName(c,name));
              } catch (IOException x) {
                  return null;
--- a/jdk/src/java.naming/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.naming/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the Java Naming and Directory Interface (JNDI) API.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.naming {
--- a/jdk/src/java.prefs/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.prefs/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the Preferences API.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.prefs {
--- a/jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java	Mon Apr 10 08:31:37 2017 -0700
@@ -67,11 +67,11 @@
     *
     * <ul><li>The class to be activated and the special activation constructor are both public,
     * and the class resides in a package that is
-    * {@linkplain java.lang.reflect.Module#isExported(String,java.lang.reflect.Module) exported}
+    * {@linkplain Module#isExported(String,Module) exported}
     * to at least the {@code java.rmi} module; or
     *
     * <li>The class to be activated resides in a package that is
-    * {@linkplain java.lang.reflect.Module#isOpen(String,java.lang.reflect.Module) open}
+    * {@linkplain Module#isOpen(String,Module) open}
     * to at least the {@code java.rmi} module.
     * </ul>
     *
--- a/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java	Mon Apr 10 08:31:37 2017 -0700
@@ -135,9 +135,9 @@
  * remote object's class.
  *
  * <li>Each remote interface must either be public and reside in a package that is
- * {@linkplain java.lang.reflect.Module#isExported(String,java.lang.reflect.Module) exported}
+ * {@linkplain Module#isExported(String,Module) exported}
  * to at least the {@code java.rmi} module, or it must reside in a package that is
- * {@linkplain java.lang.reflect.Module#isOpen(String,java.lang.reflect.Module) open}
+ * {@linkplain Module#isOpen(String,Module) open}
  * to at least the {@code java.rmi} module.
  *
  * <li>The proxy's invocation handler is a {@link
--- a/jdk/src/java.rmi/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.rmi/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the Remote Method Invocation (RMI) API.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.rmi {
--- a/jdk/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1999, 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
@@ -128,6 +128,7 @@
     /**
      * Closes the stream when garbage is collected.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws IOException {
         close();
     }
--- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -440,6 +440,7 @@
     /**
      * Shut down connection upon finalization.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable
     {
         super.finalize();
--- a/jdk/src/java.scripting/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.scripting/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the Scripting API.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.scripting {
--- a/jdk/src/java.se.ee/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.se.ee/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,6 +29,7 @@
  * This module requires {@code java.se} and supplements it with modules
  * that define CORBA and Java EE APIs. These modules are upgradeable.
  *
+ * @moduleGraph
  * @since 9
  */
 @SuppressWarnings("deprecation")
--- a/jdk/src/java.se/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.se/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,6 +29,7 @@
  * The modules defining CORBA and Java EE APIs are not required by
  * this module, but they are required by {@code java.se.ee}.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.se {
--- a/jdk/src/java.security.jgss/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.security.jgss/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,6 +28,7 @@
  * <P>
  * This module also contains GSS-API mechanisms including Kerberos v5 and SPNEGO.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.security.jgss {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSCredElement.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSCredElement.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -130,6 +130,7 @@
         return "N/A";
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         dispose();
     }
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSNameElement.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSNameElement.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, 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
@@ -289,6 +289,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         dispose();
     }
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, 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
@@ -618,6 +618,7 @@
         return isInitiator;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         dispose();
     }
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, 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
@@ -136,6 +136,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         clearPassword();
     }
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, 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
@@ -199,6 +199,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         clearPassword();
     }
--- a/jdk/src/java.security.sasl/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.security.sasl/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,6 +30,7 @@
  * This module also contains SASL mechanisms including DIGEST-MD5,
  * CRAM-MD5, and NTLM.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.security.sasl {
--- a/jdk/src/java.smartcardio/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.smartcardio/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the Java Smart Card I/O API.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.smartcardio {
--- a/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/CardImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/CardImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -274,6 +274,7 @@
             + ", protocol " + getProtocol() + ", state " + state;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (state == State.OK) {
--- a/jdk/src/java.sql.rowset/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.sql.rowset/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the JDBC RowSet API.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.sql.rowset {
--- a/jdk/src/java.sql/share/classes/java/sql/Connection.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.sql/share/classes/java/sql/Connection.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1535,8 +1535,9 @@
      * <li>The connection pool caches {@code PooledConnection} objects</li>
      * <li>Returns a logical connection handle when {@code getConnection} is
      * called by the application</li>
-     * <li>The pool manager calls {@code Connection.close} on the logical connection handle
-     * prior to returning the {@code PooledConnection} back to the cache</li>
+     * <li>The logical {@code Connection} is closed by calling
+     * {@code Connection.close} prior to returning the {@code PooledConnection}
+     * to the cache.</li>
      * </ul>
      * @throws SQLException if an error occurs
      * @since 9
@@ -1577,8 +1578,9 @@
      * <li>The connection pool caches {@code PooledConnection} objects</li>
      * <li>Returns a logical connection handle when {@code getConnection} is
      * called by the application</li>
-     * <li>The pool manager calls {@code Connection.close} on the logical connection handle
-     * prior to returning the {@code PooledConnection} back to the cache</li>
+     * <li>The logical {@code Connection} is closed by calling
+     * {@code Connection.close} prior to returning the {@code PooledConnection}
+     * to the cache.</li>
      * </ul>
      * @throws SQLException if an error occurs
      * @since 9
@@ -1590,7 +1592,10 @@
     }
 
     /**
-     * Sets and validates the sharding keys for this connection.
+     * Sets and validates the sharding keys for this connection. A {@code null}
+     * value may be specified for the sharding Key. The validity
+     * of a {@code null} sharding key is vendor-specific. Consult your vendor&#39;s
+     * documentation for additional information.
      * @implSpec
      * The default implementation will throw a
      * {@code SQLFeatureNotSupportedException}.
@@ -1600,7 +1605,8 @@
      * {@code Connection}. The timeout value indicates how long the driver
      * should wait for the {@code Connection} to verify that the sharding key
      * is valid before {@code setShardingKeyIfValid} returns false.
-     * @param shardingKey the sharding key to be validated against this connection
+     * @param shardingKey the sharding key to be validated against this connection.
+     * The sharding key may be {@code null}
      * @param superShardingKey the super sharding key to be validated against this
      * connection. The super sharding key may be {@code null}.
      * @param timeout time in seconds before which the validation process is expected to
@@ -1610,10 +1616,10 @@
      * and set on this connection; false if the sharding keys are not valid or
      * the timeout period expires before the operation completes.
      * @throws SQLException if an error occurs while performing this validation;
-     * the {@code shardingkey} is {@code null}; a {@code superSharedingKey} is specified
+     * a {@code superSharedingKey} is specified
      * without a {@code shardingKey};
      * this method is called on a closed {@code connection}; or
-     * the {@code timeout} value is less than 0.
+     * the {@code timeout} value is negative.
      * @throws SQLFeatureNotSupportedException if the driver does not support sharding
      * @since 9
      * @see ShardingKey
@@ -1626,7 +1632,10 @@
     }
 
     /**
-     * Sets and validates the sharding key for this connection.
+     * Sets and validates the sharding key for this connection. A {@code null}
+     * value may be specified for the sharding Key. The validity
+     * of a {@code null} sharding key is vendor-specific. Consult your vendor&#39;s
+     * documentation for additional information.
      * @implSpec
      * The default implementation will throw a
      * {@code SQLFeatureNotSupportedException}.
@@ -1635,7 +1644,8 @@
      * {@code Connection}. The timeout value indicates how long the driver
      * should wait for the {@code Connection} to verify that the sharding key
      * is valid before {@code setShardingKeyIfValid} returns false.
-     * @param shardingKey the sharding key to be validated against this connection
+     * @param shardingKey the sharding key to be validated against this connection.
+     * The sharding key may be {@code null}
      * @param timeout time in seconds before which the validation process is expected to
      * be completed,else the validation process is aborted. A value of 0 indicates
      * the validation process will not time out.
@@ -1643,8 +1653,8 @@
      * set on this connection; false if the sharding key is not valid or
      * the timeout period expires before the operation completes.
      * @throws SQLException if there is an error while performing this validation;
-     * this method is called on a closed {@code connection}; the {@code shardingkey}
-     * is {@code null}; or the {@code timeout} value is less than 0.
+     * this method is called on a closed {@code connection};
+     * or the {@code timeout} value is negative.
      * @throws SQLFeatureNotSupportedException if the driver does not support sharding
      * @since 9
      * @see ShardingKey
@@ -1664,12 +1674,12 @@
      * This method sets the specified sharding keys but does not require a
      * round trip to the database to validate that the sharding keys are valid
      * for the {@code Connection}.
-     * @param shardingKey the sharding key to set on this connection.
+     * @param shardingKey the sharding key to set on this connection. The sharding
+     * key may be {@code null}
      * @param superShardingKey the super sharding key to set on this connection.
      * The super sharding key may be {@code null}
      * @throws SQLException if an error  occurs setting the sharding keys;
-     * this method is called on a closed {@code connection};
-     * the {@code shardingkey} is {@code null}; or
+     * this method is called on a closed {@code connection}; or
      * a {@code superSharedingKey} is specified without a {@code shardingKey}
      * @throws SQLFeatureNotSupportedException if the driver does not support sharding
      * @since 9
@@ -1690,10 +1700,10 @@
      * This method sets the specified sharding key but does not require a
      * round trip to the database to validate that the sharding key is valid
      * for the {@code Connection}.
-     * @param shardingKey the sharding key to set on this connection.
-     * @throws SQLException if an error  occurs setting the sharding key;
-     * this method is called on a closed {@code connection}; or the
-     * {@code shardkingKey} is {@code null}
+     * @param shardingKey the sharding key to set on this connection. The sharding
+     * key may be {@code null}
+     * @throws SQLException if an error occurs setting the sharding key; or
+     * this method is called on a closed {@code connection}
      * @throws SQLFeatureNotSupportedException if the driver does not support sharding
      * @since 9
      * @see ShardingKey
--- a/jdk/src/java.sql/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.sql/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the JDBC API.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.sql {
--- a/jdk/src/java.transaction/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.transaction/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,6 +29,7 @@
  * The subset consists of RMI exception types which are mapped to CORBA system
  * exceptions by the 'Java Language to IDL Mapping Specification'.
  *
+ * @moduleGraph
  * @since 9
  */
 @Deprecated(since="9", forRemoval=true)
--- a/jdk/src/java.xml.crypto/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/java.xml.crypto/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,8 +24,9 @@
  */
 
 /**
- * Defines an API for XML cryptography.
+ * Defines the API for XML cryptography.
  *
+ * @moduleGraph
  * @since 9
  */
 module java.xml.crypto {
--- a/jdk/src/jdk.accessibility/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.accessibility/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines JDK utility classes used by implementors of Assistive Technologies.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.accessibility {
--- a/jdk/src/jdk.attach/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.attach/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the attach API.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.attach {
--- a/jdk/src/jdk.charsets/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.charsets/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,13 @@
  * questions.
  */
 
+/**
+ * {@link java.nio.charset.Charset Charset} provider for the charsets that
+ * are not in {@code java.base} (mostly double byte and IBM charsets).
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.charsets {
     provides java.nio.charset.spi.CharsetProvider
         with sun.nio.cs.ext.ExtendedCharsets;
--- a/jdk/src/jdk.crypto.cryptoki/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.crypto.cryptoki/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * The SunPKCS11 security provider.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.crypto.cryptoki {
--- a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -241,6 +241,7 @@
             pc.setPassword(password);  // this clones the password if not null
         }
 
+        @SuppressWarnings("deprecation")
         protected void finalize() throws Throwable {
             if (password != null) {
                 Arrays.fill(password, ' ');
@@ -1022,7 +1023,7 @@
                                     ("trusted certificates may only be set by " +
                                     "token initialization application"));
             }
-            Module module = token.provider.nssModule;
+            Secmod.Module module = token.provider.nssModule;
             if ((module.type != ModuleType.KEYSTORE) && (module.type != ModuleType.FIPS)) {
                 // XXX allow TRUSTANCHOR module
                 throw new KeyStoreException("Trusted certificates can only be "
--- a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java	Mon Apr 10 08:31:37 2017 -0700
@@ -77,7 +77,7 @@
 
     final boolean removable;
 
-    final Module nssModule;
+    final Secmod.Module nssModule;
 
     final boolean nssUseSecmodTrust;
 
@@ -148,7 +148,7 @@
 
         boolean useSecmod = config.getNssUseSecmod();
         boolean nssUseSecmodTrust = config.getNssUseSecmodTrust();
-        Module nssModule = null;
+        Secmod.Module nssModule = null;
 
         //
         // Initialization via Secmod. The way this works is as follows:
@@ -217,7 +217,7 @@
                 // XXX which exception to throw
                 throw new ProviderException("Could not initialize NSS", e);
             }
-            List<Module> modules = secmod.getModules();
+            List<Secmod.Module> modules = secmod.getModules();
             if (config.getShowInfo()) {
                 System.out.println("NSS modules: " + modules);
             }
@@ -258,7 +258,7 @@
                             ("Invalid external module: " + moduleName);
                 }
                 int k = 0;
-                for (Module module : modules) {
+                for (Secmod.Module module : modules) {
                     if (module.getType() == ModuleType.EXTERNAL) {
                         if (++k == moduleIndex) {
                             nssModule = module;
--- a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -1531,6 +1531,7 @@
      *
      * @exception Throwable If finalization fails.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         disconnect();
     }
--- a/jdk/src/jdk.crypto.ec/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.crypto.ec/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * The SunEC security provider.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.crypto.ec {
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * The SunMSCAPI security provider.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.crypto.mscapi {
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -52,6 +52,7 @@
         /**
          * Finalization method
          */
+        @SuppressWarnings("deprecation")
         protected void finalize() throws Throwable
         {
             try {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * The OracleUCrypto security provider.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.crypto.ucrypto {
--- a/jdk/src/jdk.editpad/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.editpad/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Implementation of the edit pad service.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.editpad {
--- a/jdk/src/jdk.httpserver/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.httpserver/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Defines the JDK-specific API for HTTP server.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.httpserver {
 
     exports com.sun.net.httpserver;
--- a/jdk/src/jdk.incubator.httpclient/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,6 +27,7 @@
  * Defines the high-level HTTP and WebSocket API.
  * {@Incubating}
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.incubator.httpclient {
--- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java	Mon Apr 10 08:31:37 2017 -0700
@@ -306,6 +306,7 @@
      * Shuts down the ConsoleReader if the JVM attempts to clean it up.
      */
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             shutdown();
--- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -74,7 +74,7 @@
                 //in.resetPromptLine(in.getPrompt(), in.getHistory().current().toString(), -1);
                 //but that would mean more re-writing on the screen, (and prints an additional
                 //empty line), so using setBuffer directly:
-                Method setBuffer = in.getClass().getDeclaredMethod("setBuffer", String.class);
+                Method setBuffer = ConsoleReader.class.getDeclaredMethod("setBuffer", String.class);
 
                 setBuffer.setAccessible(true);
                 setBuffer.invoke(in, in.getHistory().current().toString());
--- a/jdk/src/jdk.jartool/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jartool/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,13 @@
  * questions.
  */
 
+/**
+ * Defines tools for manipulating Java Archive (JAR) files,
+ * including the jar and jarsigner tools.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.jartool {
     exports com.sun.jarsigner;
     exports jdk.security.jarsigner;
--- a/jdk/src/jdk.jcmd/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jcmd/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,13 @@
  * questions.
  */
 
+/**
+ * Defines tools for diagnostics and troubleshooting a JVM,
+ * including the jcmd, jps, jstat and other diagnostics tools.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.jcmd {
     requires jdk.attach;
     requires jdk.internal.jvmstat;
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,11 +25,11 @@
 
 package sun.tools.common;
 
-import java.lang.reflect.Module;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import com.sun.tools.attach.VirtualMachine;
 import com.sun.tools.attach.VirtualMachineDescriptor;
@@ -145,4 +145,17 @@
         return this.getVirtualMachineDescriptors(null);
     }
 
+    public Collection<String> getVirtualMachinePids(Class<?> excludeClass) {
+        if (singlePid != null) {
+            // There is a bug in AttachProvider, when VM is debuggee-suspended it's not listed by the AttachProvider.
+            // If we are talking about a specific pid, just return it.
+            return List.of(singlePid);
+        } else {
+            return getVMDs(excludeClass, matchClass).stream().map(x -> {return x.id();}).collect(Collectors.toList());
+        }
+    }
+
+    public Collection<String> getVirtualMachinePids() {
+        return this.getVirtualMachinePids(null);
+    }
 }
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jcmd/JCmd.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jcmd/JCmd.java	Mon Apr 10 08:31:37 2017 -0700
@@ -80,22 +80,22 @@
             System.exit(0);
         }
 
-        Collection<VirtualMachineDescriptor> vids = ap.getVirtualMachineDescriptors(JCmd.class);
+        Collection<String> pids = ap.getVirtualMachinePids(JCmd.class);
 
-        if (vids.isEmpty()) {
+        if (pids.isEmpty()) {
             System.err.println("Could not find any processes matching : '"
                                + arg.getProcessString() + "'");
             System.exit(1);
         }
 
         boolean success = true;
-        for (VirtualMachineDescriptor vid : vids) {
-            System.out.println(vid.id() + ":");
+        for (String pid : pids) {
+            System.out.println(pid + ":");
             if (arg.isListCounters()) {
-                listCounters(vid.id());
+                listCounters(pid);
             } else {
                 try {
-                    executeCommandForPid(vid.id(), arg.getCommand());
+                    executeCommandForPid(pid, arg.getCommand());
                 } catch(AttachOperationFailedException ex) {
                     System.err.println(ex.getMessage());
                     success = false;
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jinfo/JInfo.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jinfo/JInfo.java	Mon Apr 10 08:31:37 2017 -0700
@@ -96,37 +96,37 @@
         String parg = args[optionCount];
 
         ProcessArgumentMatcher ap = new ProcessArgumentMatcher(parg);
-        Collection<VirtualMachineDescriptor> vids = ap.getVirtualMachineDescriptors(JInfo.class);
+        Collection<String> pids = ap.getVirtualMachinePids(JInfo.class);
 
-        if (vids.isEmpty()) {
+        if (pids.isEmpty()) {
             System.err.println("Could not find any processes matching : '" + parg + "'");
             System.exit(1);
         }
 
-        for (VirtualMachineDescriptor vid : vids) {
-            if (vids.size() > 1) {
-                System.out.println("Pid:" + vid.id());
+        for (String pid : pids) {
+            if (pids.size() > 1) {
+                System.out.println("Pid:" + pid);
             }
             if (!doFlag && !doFlags && !doSysprops) {
                 // Print flags and sysporps if no options given
-                sysprops(vid.id());
+                sysprops(pid);
                 System.out.println();
-                flags(vid.id());
+                flags(pid);
                 System.out.println();
-                commandLine(vid.id());
+                commandLine(pid);
             }
             if (doFlag) {
                 if (flag < 0) {
                     System.err.println("Missing flag");
                     usage(1);
                 }
-                flag(vid.id(), args[flag]);
+                flag(pid, args[flag]);
             }
             if (doFlags) {
-                flags(vid.id());
+                flags(pid);
             }
             if (doSysprops) {
-                sysprops(vid.id());
+                sysprops(pid);
             }
         }
     }
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java	Mon Apr 10 08:31:37 2017 -0700
@@ -91,16 +91,15 @@
         // As more options are added we should create an abstract tool class and
         // have a table to map the options
         ProcessArgumentMatcher ap = new ProcessArgumentMatcher(pidArg);
-        Collection<VirtualMachineDescriptor> vids = ap.getVirtualMachineDescriptors(JMap.class);
+        Collection<String> pids = ap.getVirtualMachinePids(JMap.class);
 
-        if (vids.isEmpty()) {
+        if (pids.isEmpty()) {
             System.err.println("Could not find any processes matching : '" + pidArg + "'");
             System.exit(1);
         }
 
-        for (VirtualMachineDescriptor vid : vids) {
-            String pid = vid.id();
-            if (vids.size() > 1) {
+        for (String pid : pids) {
+            if (pids.size() > 1) {
                 System.out.println("Pid:" + pid);
             }
             if (option.equals("-histo")) {
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstack/JStack.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstack/JStack.java	Mon Apr 10 08:31:37 2017 -0700
@@ -84,18 +84,18 @@
             params = new String[0];
         }
         ProcessArgumentMatcher ap = new ProcessArgumentMatcher(pidArg);
-        Collection<VirtualMachineDescriptor> vids = ap.getVirtualMachineDescriptors(JStack.class);
+        Collection<String> pids = ap.getVirtualMachinePids(JStack.class);
 
-        if (vids.isEmpty()) {
+        if (pids.isEmpty()) {
             System.err.println("Could not find any processes matching : '" + pidArg + "'");
             System.exit(1);
         }
 
-        for (VirtualMachineDescriptor vid : vids) {
-            if (vids.size() > 1) {
-                System.out.println("Pid:" + vid.id());
+        for (String pid : pids) {
+            if (pids.size() > 1) {
+                System.out.println("Pid:" + pid);
             }
-            runThreadDump(vid.id(), params);
+            runThreadDump(pid, params);
         }
     }
 
--- a/jdk/src/jdk.jconsole/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jconsole/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,13 @@
  * questions.
  */
 
+/**
+ * Defines the JMX graphical tool, jconsole, for monitoring and managing
+ * a running application.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.jconsole {
     requires transitive java.desktop;
     requires transitive java.management;
--- a/jdk/src/jdk.jdi/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jdi/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Defines the Java Debugger Interface.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.jdi {
--- a/jdk/src/jdk.jdwp.agent/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jdwp.agent/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,6 +26,7 @@
 /**
  * Java Debug Wire Protocol.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.jdwp.agent {
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c	Mon Apr 10 08:31:37 2017 -0700
@@ -29,8 +29,8 @@
 #include "ModuleReferenceImpl.h"
 
 
-static jclass jlrM(JNIEnv *env) {
-    return findClass(env, "Ljava/lang/reflect/Module;");
+static jclass jlM(JNIEnv *env) {
+    return findClass(env, "Ljava/lang/Module;");
 }
 
 static jboolean
@@ -43,7 +43,7 @@
     jobject module;
 
     if (method == NULL) {
-        method = getMethod(env, jlrM(env), "getName", "()Ljava/lang/String;");
+        method = getMethod(env, jlM(env), "getName", "()Ljava/lang/String;");
     }
     module = inStream_readModuleRef(getEnv(), in);
     if (inStream_error(in)) {
@@ -71,7 +71,7 @@
     jobject module;
 
     if (method == NULL) {
-        method = getMethod(env, jlrM(env), "getClassLoader", "()Ljava/lang/ClassLoader;");
+        method = getMethod(env, jlM(env), "getClassLoader", "()Ljava/lang/ClassLoader;");
     }
     module = inStream_readModuleRef(env, in);
     if (inStream_error(in)) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,8 +35,12 @@
 import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 import jdk.internal.jimage.BasicImageReader;
 import jdk.internal.jimage.ImageHeader;
 import jdk.internal.jimage.ImageLocation;
@@ -99,7 +103,7 @@
     }
 
     static class OptionsValues {
-        Task task = Task.LIST;
+        Task task = null;
         String directory = ".";
         String include = "";
         boolean fullVersion;
@@ -172,24 +176,31 @@
         }
 
         try {
-            List<String> unhandled = OPTION_HELPER.handleOptions(this, args);
+            String command;
+            String[] remaining = args;
+            try {
+                command = args[0];
+                options.task = Enum.valueOf(Task.class, args[0].toUpperCase(Locale.ENGLISH));
+                remaining = args.length > 1 ? Arrays.copyOfRange(args, 1, args.length)
+                                            : new String[0];
+            } catch (IllegalArgumentException ex) {
+                command = null;
+                options.task = null;
+            }
 
-            if(!unhandled.isEmpty()) {
-                try {
-                    options.task = Enum.valueOf(Task.class, unhandled.get(0).toUpperCase());
-                } catch (IllegalArgumentException ex) {
-                    throw TASK_HELPER.newBadArgs("err.not.a.task", unhandled.get(0));
-                }
+            // process arguments
+            List<String> unhandled = OPTION_HELPER.handleOptions(this, remaining);
+            for (String f : unhandled) {
+                options.jimages.add(new File(f));
+            }
 
-                for(int i = 1; i < unhandled.size(); i++) {
-                    options.jimages.add(new File(unhandled.get(i)));
-                }
-            } else if (!options.help && !options.version && !options.fullVersion) {
-                throw TASK_HELPER.newBadArgs("err.invalid.task", "<unspecified>");
+            if (options.task == null && !options.help && !options.version && !options.fullVersion) {
+                throw TASK_HELPER.newBadArgs("err.not.a.task",
+                    command != null ? command : "<unspecified>");
             }
 
             if (options.help) {
-                if (unhandled.isEmpty()) {
+                if (options.task == null) {
                     log.println(TASK_HELPER.getMessage("main.usage", PROGNAME));
                     Arrays.asList(RECOGNIZED_OPTIONS).stream()
                         .filter(option -> !option.isHidden())
@@ -203,15 +214,19 @@
                         log.println(TASK_HELPER.getMessage("main.usage." +
                                 options.task.toString().toLowerCase()));
                     } catch (MissingResourceException ex) {
-                        throw TASK_HELPER.newBadArgs("err.not.a.task", unhandled.get(0));
+                        throw TASK_HELPER.newBadArgs("err.not.a.task", command);
                     }
                 }
                 return EXIT_OK;
             }
 
             if (options.version || options.fullVersion) {
+                if (options.task == null && !unhandled.isEmpty()) {
+                    throw TASK_HELPER.newBadArgs("err.not.a.task",
+                        Stream.of(args).collect(Collectors.joining(" ")));
+                }
+
                 TASK_HELPER.showVersion(options.fullVersion);
-
                 if (unhandled.isEmpty()) {
                     return EXIT_OK;
                 }
@@ -435,7 +450,7 @@
                 iterate(this::listTitle, null, this::verify);
                 break;
             default:
-                throw TASK_HELPER.newBadArgs("err.invalid.task",
+                throw TASK_HELPER.newBadArgs("err.not.a.task",
                         options.task.name()).showUsage(true);
         }
         return true;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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,8 @@
  */
 package jdk.tools.jlink.internal;
 
-import java.lang.reflect.Layer;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
 import java.nio.ByteOrder;
 import java.nio.file.Path;
 import java.util.ArrayList;
@@ -33,6 +34,8 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+
+import jdk.internal.module.ModulePath;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.builder.ImageBuilder;
@@ -51,10 +54,10 @@
      * @return A new plugin or null if plugin is unknown.
      */
     public static Plugin newPlugin(String name,
-            Map<String, String> configuration, Layer pluginsLayer) {
+            Map<String, String> configuration, ModuleLayer pluginsLayer) {
         Objects.requireNonNull(name);
         Objects.requireNonNull(configuration);
-        pluginsLayer = pluginsLayer == null ? Layer.boot() : pluginsLayer;
+        pluginsLayer = pluginsLayer == null ? ModuleLayer.boot() : pluginsLayer;
         return PluginRepository.newPlugin(configuration, name, pluginsLayer);
     }
 
@@ -147,8 +150,8 @@
         private final Path output;
         private final Set<String> modules;
         private final Set<String> limitmods;
-
         private final ByteOrder endian;
+        private final ModuleFinder finder;
 
         /**
          * jlink configuration,
@@ -160,31 +163,23 @@
          * @param endian Jimage byte order. Native order by default
          */
         public JlinkConfiguration(Path output,
-                List<Path> modulepaths,
-                Set<String> modules,
-                Set<String> limitmods,
-                ByteOrder endian) {
-            this.output = output;
-            this.modulepaths = modulepaths == null ? Collections.emptyList() : modulepaths;
-            this.modules = modules == null ? Collections.emptySet() : modules;
-            this.limitmods = limitmods == null ? Collections.emptySet() : limitmods;
-            this.endian = endian == null ? ByteOrder.nativeOrder() : endian;
-        }
+                                  List<Path> modulepaths,
+                                  Set<String> modules,
+                                  Set<String> limitmods,
+                                  ByteOrder endian) {
+            if (Objects.requireNonNull(modulepaths).isEmpty()) {
+                throw new IllegalArgumentException("Empty module path");
+            }
+            if (Objects.requireNonNull(modules).isEmpty()) {
+                throw new IllegalArgumentException("Empty modules");
+            }
 
-        /**
-         * jlink configuration,
-         *
-         * @param output Output directory, must not exist.
-         * @param modulepaths Modules paths
-         * @param modules Root modules to resolve
-         * @param limitmods Limit the universe of observable modules
-         */
-        public JlinkConfiguration(Path output,
-                List<Path> modulepaths,
-                Set<String> modules,
-                Set<String> limitmods) {
-            this(output, modulepaths, modules, limitmods,
-                    ByteOrder.nativeOrder());
+            this.output = output;
+            this.modulepaths = modulepaths;
+            this.modules = modules;
+            this.limitmods = Objects.requireNonNull(limitmods);
+            this.endian = Objects.requireNonNull(endian);
+            this.finder = moduleFinder();
         }
 
         /**
@@ -222,6 +217,45 @@
             return limitmods;
         }
 
+        /**
+         * Returns {@link ModuleFinder} that finds all observable modules
+         * for this jlink configuration.
+         */
+        public ModuleFinder finder() {
+            return finder;
+        }
+
+        /**
+         * Returns a {@link Configuration} of the given module path,
+         * root modules with full service binding.
+         */
+        public Configuration resolveAndBind()
+        {
+            return Configuration.empty().resolveAndBind(finder,
+                                                        ModuleFinder.of(),
+                                                        modules);
+        }
+
+        /**
+         * Returns a {@link Configuration} of the given module path,
+         * root modules with no service binding.
+         */
+        public Configuration resolve()
+        {
+            return Configuration.empty().resolve(finder,
+                                                 ModuleFinder.of(),
+                                                 modules);
+        }
+
+        private ModuleFinder moduleFinder() {
+            Path[] entries = modulepaths.toArray(new Path[0]);
+            ModuleFinder finder = ModulePath.of(Runtime.version(), true, entries);
+            if (!limitmods.isEmpty()) {
+                finder = JlinkTask.limitFinder(finder, limitmods, modules);
+            }
+            return finder;
+        }
+
         @Override
         public String toString() {
             StringBuilder builder = new StringBuilder();
@@ -295,7 +329,7 @@
 
     private PluginsConfiguration addAutoEnabledPlugins(PluginsConfiguration pluginsConfig) {
         List<Plugin> plugins = new ArrayList<>(pluginsConfig.getPlugins());
-        List<Plugin> bootPlugins = PluginRepository.getPlugins(Layer.boot());
+        List<Plugin> bootPlugins = PluginRepository.getPlugins(ModuleLayer.boot());
         for (Plugin bp : bootPlugins) {
             if (Utils.isAutoEnabled(bp)) {
                 try {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -110,6 +110,12 @@
             Path path = Paths.get(arg);
             task.options.output = path;
         }, "--output"),
+        new Option<JlinkTask>(false, (task, opt, arg) -> {
+            task.options.bindServices = true;
+        }, "--bind-services"),
+        new Option<JlinkTask>(false, (task, opt, arg) -> {
+            task.options.suggestProviders = true;
+        }, "--suggest-providers", "", true),
         new Option<JlinkTask>(true, (task, opt, arg) -> {
             String[] values = arg.split("=");
             // check values
@@ -141,6 +147,9 @@
             }
         }, "--endian"),
         new Option<JlinkTask>(false, (task, opt, arg) -> {
+            task.options.verbose = true;
+        }, "--verbose", "-v"),
+        new Option<JlinkTask>(false, (task, opt, arg) -> {
             task.options.version = true;
         }, "--version"),
         new Option<JlinkTask>(true, (task, opt, arg) -> {
@@ -185,6 +194,7 @@
     static class OptionsValues {
         boolean help;
         String  saveoptsfile;
+        boolean verbose;
         boolean version;
         boolean fullVersion;
         final List<Path> modulePath = new ArrayList<>();
@@ -195,6 +205,8 @@
         Path packagedModulesPath;
         ByteOrder endian = ByteOrder.nativeOrder();
         boolean ignoreSigning = false;
+        boolean bindServices = false;
+        boolean suggestProviders = false;
     }
 
     int run(String[] args) {
@@ -203,7 +215,11 @@
                    new PrintWriter(System.err, true));
         }
         try {
-            optionsHelper.handleOptionsNoUnhandled(this, args);
+            List<String> remaining = optionsHelper.handleOptions(this, args);
+            if (remaining.size() > 0 && !options.suggestProviders) {
+                throw taskHelper.newBadArgs("err.orphan.arguments", toString(remaining))
+                                .showUsage(true);
+            }
             if (options.help) {
                 optionsHelper.showHelp(PROGNAME);
                 return EXIT_OK;
@@ -217,17 +233,24 @@
                 return EXIT_OK;
             }
 
-            if (taskHelper.getExistingImage() == null) {
-                if (options.modulePath.isEmpty()) {
-                    throw taskHelper.newBadArgs("err.modulepath.must.be.specified").showUsage(true);
-                }
-                createImage();
-            } else {
+            if (taskHelper.getExistingImage() != null) {
                 postProcessOnly(taskHelper.getExistingImage());
+                return EXIT_OK;
             }
 
-            if (options.saveoptsfile != null) {
-                Files.write(Paths.get(options.saveoptsfile), getSaveOpts().getBytes());
+            if (options.modulePath.isEmpty()) {
+                throw taskHelper.newBadArgs("err.modulepath.must.be.specified")
+                                .showUsage(true);
+            }
+
+            JlinkConfiguration config = initJlinkConfig();
+            if (options.suggestProviders) {
+                suggestProviders(config, remaining);
+            } else {
+                createImage(config);
+                if (options.saveoptsfile != null) {
+                    Files.write(Paths.get(options.saveoptsfile), getSaveOpts().getBytes());
+                }
             }
 
             return EXIT_OK;
@@ -266,25 +289,13 @@
         Objects.requireNonNull(config.getOutput());
         plugins = plugins == null ? new PluginsConfiguration() : plugins;
 
-        if (config.getModulepaths().isEmpty()) {
-            throw new IllegalArgumentException("Empty module paths");
-        }
-
-        ModuleFinder finder = newModuleFinder(config.getModulepaths(),
-                                              config.getLimitmods(),
-                                              config.getModules());
-
-        if (config.getModules().isEmpty()) {
-            throw new IllegalArgumentException("No modules to add");
-        }
-
         // First create the image provider
         ImageProvider imageProvider =
-                createImageProvider(finder,
-                                    config.getModules(),
-                                    config.getByteOrder(),
+                createImageProvider(config,
                                     null,
                                     IGNORE_SIGNING_DEFAULT,
+                                    false,
+                                    false,
                                     null);
 
         // Then create the Plugin Stack
@@ -319,20 +330,24 @@
 
     // the token for "all modules on the module path"
     private static final String ALL_MODULE_PATH = "ALL-MODULE-PATH";
-    private void createImage() throws Exception {
-        if (options.output == null) {
-            throw taskHelper.newBadArgs("err.output.must.be.specified").showUsage(true);
-        }
-
+    private JlinkConfiguration initJlinkConfig() throws BadArgs {
         if (options.addMods.isEmpty()) {
             throw taskHelper.newBadArgs("err.mods.must.be.specified", "--add-modules")
-                    .showUsage(true);
+                .showUsage(true);
         }
 
         Set<String> roots = new HashSet<>();
         for (String mod : options.addMods) {
             if (mod.equals(ALL_MODULE_PATH)) {
-                ModuleFinder finder = modulePathFinder();
+                Path[] entries = options.modulePath.toArray(new Path[0]);
+                ModuleFinder finder = ModulePath.of(Runtime.version(), true, entries);
+                if (!options.limitMods.isEmpty()) {
+                    // finder for the observable modules specified in
+                    // the --module-path and --limit-modules options
+                    finder = limitFinder(finder, options.limitMods, Collections.emptySet());
+                }
+
+                // all observable modules are roots
                 finder.findAll()
                       .stream()
                       .map(ModuleReference::descriptor)
@@ -343,40 +358,34 @@
             }
         }
 
-        ModuleFinder finder = newModuleFinder(options.modulePath,
-                                              options.limitMods,
-                                              roots);
+        return new JlinkConfiguration(options.output,
+                                      options.modulePath,
+                                      roots,
+                                      options.limitMods,
+                                      options.endian);
+    }
 
+    private void createImage(JlinkConfiguration config) throws Exception {
+        if (options.output == null) {
+            throw taskHelper.newBadArgs("err.output.must.be.specified").showUsage(true);
+        }
 
         // First create the image provider
-        ImageProvider imageProvider = createImageProvider(finder,
-                                                          roots,
-                                                          options.endian,
+        ImageProvider imageProvider = createImageProvider(config,
                                                           options.packagedModulesPath,
                                                           options.ignoreSigning,
+                                                          options.bindServices,
+                                                          options.verbose,
                                                           log);
 
         // Then create the Plugin Stack
-        ImagePluginStack stack = ImagePluginConfiguration.
-                parseConfiguration(taskHelper.getPluginsConfig(options.output, options.launchers));
+        ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(
+            taskHelper.getPluginsConfig(options.output, options.launchers));
 
         //Ask the stack to proceed
         stack.operate(imageProvider);
     }
 
-    /**
-     * Returns a module finder to find the observable modules specified in
-     * the --module-path and --limit-modules options
-     */
-    private ModuleFinder modulePathFinder() {
-        Path[] entries = options.modulePath.toArray(new Path[0]);
-        ModuleFinder finder = ModulePath.of(Runtime.version(), true, entries);
-        if (!options.limitMods.isEmpty()) {
-            finder = limitFinder(finder, options.limitMods, Collections.emptySet());
-        }
-        return finder;
-    }
-
     /*
      * Returns a module finder of the given module path that limits
      * the observable modules to those in the transitive closure of
@@ -405,22 +414,32 @@
         return Paths.get(uri);
     }
 
-    private static ImageProvider createImageProvider(ModuleFinder finder,
-                                                     Set<String> roots,
-                                                     ByteOrder order,
+
+    private static ImageProvider createImageProvider(JlinkConfiguration config,
                                                      Path retainModulesPath,
                                                      boolean ignoreSigning,
+                                                     boolean bindService,
+                                                     boolean verbose,
                                                      PrintWriter log)
             throws IOException
     {
-        if (roots.isEmpty()) {
-            throw new IllegalArgumentException("empty modules and limitmods");
-        }
+        Configuration cf = bindService ? config.resolveAndBind()
+                                       : config.resolve();
 
-        Configuration cf = Configuration.empty()
-                .resolve(finder,
-                         ModuleFinder.of(),
-                         roots);
+        if (verbose && log != null) {
+            // print modules to be linked in
+            cf.modules().stream()
+              .sorted(Comparator.comparing(ResolvedModule::name))
+              .forEach(rm -> log.format("module %s (%s)%n",
+                                        rm.name(), rm.reference().location().get()));
+
+            // print provider info
+            Set<ModuleReference> references = cf.modules().stream()
+                .map(ResolvedModule::reference).collect(Collectors.toSet());
+
+            String msg = String.format("%n%s:", taskHelper.getMessage("providers.header"));
+            printProviders(log, msg, references);
+        }
 
         // emit a warning for any incubating modules in the configuration
         if (log != null) {
@@ -438,16 +457,16 @@
 
         Map<String, Path> mods = cf.modules().stream()
             .collect(Collectors.toMap(ResolvedModule::name, JlinkTask::toPathLocation));
-        return new ImageHelper(cf, mods, order, retainModulesPath, ignoreSigning);
+        return new ImageHelper(cf, mods, config.getByteOrder(), retainModulesPath, ignoreSigning);
     }
 
     /*
      * Returns a ModuleFinder that limits observability to the given root
      * modules, their transitive dependences, plus a set of other modules.
      */
-    private static ModuleFinder limitFinder(ModuleFinder finder,
-                                            Set<String> roots,
-                                            Set<String> otherMods) {
+    public static ModuleFinder limitFinder(ModuleFinder finder,
+                                           Set<String> roots,
+                                           Set<String> otherMods) {
 
         // resolve all root modules
         Configuration cf = Configuration.empty()
@@ -484,6 +503,147 @@
         };
     }
 
+    /*
+     * Returns a map of each service type to the modules that use it
+     */
+    private static Map<String, Set<String>> uses(Set<ModuleReference> modules) {
+        // collects the services used by the modules and print uses
+        Map<String, Set<String>> uses = new HashMap<>();
+        modules.stream()
+               .map(ModuleReference::descriptor)
+               .forEach(md -> md.uses().forEach(s ->
+                   uses.computeIfAbsent(s, _k -> new HashSet<>()).add(md.name()))
+               );
+        return uses;
+    }
+
+    private static void printProviders(PrintWriter log,
+                                       String header,
+                                       Set<ModuleReference> modules) {
+        printProviders(log, header, modules, uses(modules));
+    }
+
+    /*
+     * Prints the providers that are used by the services specified in
+     * the given modules.
+     *
+     * The specified uses maps a service type name to the modules
+     * using the service type and that may or may not be present
+     * the given modules.
+     */
+    private static void printProviders(PrintWriter log,
+                                       String header,
+                                       Set<ModuleReference> modules,
+                                       Map<String, Set<String>> uses) {
+        if (modules.isEmpty())
+            return;
+
+        // Build a map of a service type to the provider modules
+        Map<String, Set<ModuleDescriptor>> providers = new HashMap<>();
+        modules.stream()
+            .map(ModuleReference::descriptor)
+            .forEach(md -> {
+                md.provides().stream()
+                  .filter(p -> uses.containsKey(p.service()))
+                  .forEach(p -> providers.computeIfAbsent(p.service(), _k -> new HashSet<>())
+                                         .add(md));
+            });
+
+        if (!providers.isEmpty()) {
+            log.println(header);
+        }
+
+        // print the providers of the service types used by the specified modules
+        // sorted by the service type name and then provider's module name
+        providers.entrySet().stream()
+            .sorted(Map.Entry.comparingByKey())
+            .forEach(e -> {
+                String service = e.getKey();
+                e.getValue().stream()
+                 .sorted(Comparator.comparing(ModuleDescriptor::name))
+                 .forEach(md ->
+                     md.provides().stream()
+                       .filter(p -> p.service().equals(service))
+                       .forEach(p -> log.format("  module %s provides %s, used by %s%n",
+                                                md.name(), p.service(),
+                                                uses.get(p.service()).stream()
+                                                    .sorted()
+                                                    .collect(Collectors.joining(","))))
+                 );
+            });
+    }
+
+    private void suggestProviders(JlinkConfiguration config, List<String> args)
+        throws BadArgs
+    {
+        if (args.size() > 1) {
+            throw taskHelper.newBadArgs("err.orphan.argument",
+                                        toString(args.subList(1, args.size())))
+                            .showUsage(true);
+        }
+
+        if (options.bindServices) {
+            log.println(taskHelper.getMessage("no.suggested.providers"));
+            return;
+        }
+
+        ModuleFinder finder = config.finder();
+        if (args.isEmpty()) {
+            // print providers used by the modules resolved without service binding
+            Configuration cf = config.resolve();
+            Set<ModuleReference> mrefs = cf.modules().stream()
+                .map(ResolvedModule::reference)
+                .collect(Collectors.toSet());
+
+            // print uses of the modules that would be linked into the image
+            mrefs.stream()
+                 .sorted(Comparator.comparing(mref -> mref.descriptor().name()))
+                 .forEach(mref -> {
+                     ModuleDescriptor md = mref.descriptor();
+                     log.format("module %s located (%s)%n", md.name(),
+                                mref.location().get());
+                     md.uses().stream().sorted()
+                       .forEach(s -> log.format("    uses %s%n", s));
+                 });
+
+            String msg = String.format("%n%s:", taskHelper.getMessage("suggested.providers.header"));
+            printProviders(log, msg, finder.findAll(), uses(mrefs));
+
+        } else {
+            // comma-separated service types, if specified
+            Set<String> names = Stream.of(args.get(0).split(","))
+                .collect(Collectors.toSet());
+            // find the modules that provide the specified service
+            Set<ModuleReference> mrefs = finder.findAll().stream()
+                .filter(mref -> mref.descriptor().provides().stream()
+                                    .map(ModuleDescriptor.Provides::service)
+                                    .anyMatch(names::contains))
+                .collect(Collectors.toSet());
+
+            // the specified services may or may not be in the modules that
+            // would be linked in.  So find uses declared in all observable modules
+            Map<String, Set<String>> uses = uses(finder.findAll());
+
+            // check if any name given on the command line are unused service
+            mrefs.stream()
+                 .flatMap(mref -> mref.descriptor().provides().stream()
+                                      .map(ModuleDescriptor.Provides::service))
+                 .forEach(names::remove);
+            if (!names.isEmpty()) {
+                log.println(taskHelper.getMessage("warn.unused.services",
+                                                  toString(names)));
+            }
+
+            String msg = String.format("%n%s:", taskHelper.getMessage("suggested.providers.header"));
+            printProviders(log, msg, mrefs, uses);
+        }
+    }
+
+    private static String toString(Collection<String> collection) {
+        return collection.stream().sorted()
+                         .collect(Collectors.joining(","));
+    }
+
     private String getSaveOpts() {
         StringBuilder sb = new StringBuilder();
         sb.append('#').append(new Date()).append("\n");
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,7 +24,6 @@
  */
 package jdk.tools.jlink.internal;
 
-import java.lang.reflect.Layer;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -56,7 +55,7 @@
      * @return A provider or null if not found.
      */
     public static Plugin getPlugin(String name,
-            Layer pluginsLayer) {
+            ModuleLayer pluginsLayer) {
         return getPlugin(Plugin.class, name, pluginsLayer);
     }
 
@@ -69,7 +68,7 @@
      * @return A plugin or null if no plugin found.
      */
     public static Plugin newPlugin(Map<String, String> config, String name,
-            Layer pluginsLayer) {
+            ModuleLayer pluginsLayer) {
         Objects.requireNonNull(name);
         Objects.requireNonNull(pluginsLayer);
         Plugin plugin = getPlugin(name, pluginsLayer);
@@ -107,12 +106,12 @@
         registeredPlugins.remove(name);
     }
 
-    public static List<Plugin> getPlugins(Layer pluginsLayer) {
+    public static List<Plugin> getPlugins(ModuleLayer pluginsLayer) {
         return getPlugins(Plugin.class, pluginsLayer);
     }
 
     private static <T extends Plugin> T getPlugin(Class<T> clazz, String name,
-            Layer pluginsLayer) {
+            ModuleLayer pluginsLayer) {
         Objects.requireNonNull(name);
         Objects.requireNonNull(pluginsLayer);
         @SuppressWarnings("unchecked")
@@ -136,7 +135,7 @@
      * @param pluginsLayer
      * @return The list of plugins.
      */
-    private static <T extends Plugin> List<T> getPlugins(Class<T> clazz, Layer pluginsLayer) {
+    private static <T extends Plugin> List<T> getPlugins(Class<T> clazz, ModuleLayer pluginsLayer) {
         Objects.requireNonNull(pluginsLayer);
         List<T> factories = new ArrayList<>();
         try {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -29,7 +29,6 @@
 import java.io.PrintWriter;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -46,6 +45,7 @@
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 import java.util.Set;
+import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import jdk.tools.jlink.internal.plugins.ExcludeJmodSectionPlugin;
@@ -101,8 +101,15 @@
         final boolean hidden;
         final String name;
         final String shortname;
+        final boolean terminalOption;
 
-        public Option(boolean hasArg, Processing<T> processing, boolean hidden, String name, String shortname) {
+        public Option(boolean hasArg,
+                      Processing<T> processing,
+                      boolean hidden,
+                      String name,
+                      String shortname,
+                      boolean isTerminal)
+        {
             if (!name.startsWith("--")) {
                 throw new RuntimeException("option name missing --, " + name);
             }
@@ -115,24 +122,33 @@
             this.hidden = hidden;
             this.name = name;
             this.shortname = shortname;
+            this.terminalOption = isTerminal;
+        }
+
+        public Option(boolean hasArg, Processing<T> processing, String name, String shortname, boolean isTerminal) {
+            this(hasArg, processing, false, name, shortname, isTerminal);
         }
 
         public Option(boolean hasArg, Processing<T> processing, String name, String shortname) {
-            this(hasArg, processing, false, name, shortname);
+            this(hasArg, processing, false, name, shortname, false);
         }
 
         public Option(boolean hasArg, Processing<T> processing, boolean hidden, String name) {
-            this(hasArg, processing, hidden, name, "");
+            this(hasArg, processing, hidden, name, "", false);
         }
 
         public Option(boolean hasArg, Processing<T> processing, String name) {
-            this(hasArg, processing, false, name, "");
+            this(hasArg, processing, false, name, "", false);
         }
 
         public boolean isHidden() {
             return hidden;
         }
 
+        public boolean isTerminal() {
+            return terminalOption;
+        }
+
         public boolean matches(String opt) {
             return opt.equals(name) ||
                    opt.equals(shortname) ||
@@ -179,12 +195,12 @@
     private static class PluginOption extends Option<PluginsHelper> {
         public PluginOption(boolean hasArg,
                 Processing<PluginsHelper> processing, boolean hidden, String name, String shortname) {
-            super(hasArg, processing, hidden, name, shortname);
+            super(hasArg, processing, hidden, name, shortname, false);
         }
 
         public PluginOption(boolean hasArg,
                 Processing<PluginsHelper> processing, boolean hidden, String name) {
-            super(hasArg, processing, hidden, name, "");
+            super(hasArg, processing, hidden, name, "", false);
         }
 
         public String resourcePrefix() {
@@ -194,7 +210,7 @@
 
     private final class PluginsHelper {
 
-        private Layer pluginsLayer = Layer.boot();
+        private ModuleLayer pluginsLayer = ModuleLayer.boot();
         private final List<Plugin> plugins;
         private String lastSorter;
         private boolean listPlugins;
@@ -498,21 +514,13 @@
             return null;
         }
 
-        // used by jimage. Return unhandled arguments like "create", "describe".
+        /**
+         * Handles all options.  This method stops processing the argument
+         * at the first non-option argument i.e. not starts with `-`, or
+         * at the first terminal option and returns the remaining arguments,
+         * if any.
+         */
         public List<String> handleOptions(T task, String[] args) throws BadArgs {
-            return handleOptions(task, args, true);
-        }
-
-        // used by jlink. No unhandled arguments like "create", "describe".
-        void handleOptionsNoUnhandled(T task, String[] args) throws BadArgs {
-            handleOptions(task, args, false);
-        }
-
-        // shared code that handles options for both jlink and jimage. jimage uses arguments like
-        // "create", "describe" etc. as "task names". Those arguments are unhandled here and returned
-        // as "unhandled arguments list". jlink does not want such arguments. "collectUnhandled" flag
-        // tells whether to allow for unhandled arguments or not.
-        private List<String> handleOptions(T task, String[] args, boolean collectUnhandled) throws BadArgs {
             // findbugs warning, copy instead of keeping a reference.
             command = Arrays.copyOf(args, args.length);
 
@@ -521,7 +529,6 @@
             // Unit tests can call Task multiple time in same JVM.
             pluginOptions = new PluginsHelper(null);
 
-            List<String> rest = collectUnhandled? new ArrayList<>() : null;
             // process options
             for (int i = 0; i < args.length; i++) {
                 if (args[i].startsWith("-")) {
@@ -531,7 +538,6 @@
                     if (option == null) {
                         pluginOption = pluginOptions.getOption(name);
                         if (pluginOption == null) {
-
                             throw new BadArgs("err.unknown.option", name).
                                     showUsage(true);
                         }
@@ -556,20 +562,23 @@
                         pluginOption.process(pluginOptions, name, param);
                     } else {
                         option.process(task, name, param);
+                        if (option.isTerminal()) {
+                            return ++i < args.length
+                                        ? Stream.of(Arrays.copyOfRange(args, i, args.length))
+                                                .collect(Collectors.toList())
+                                        : Collections.emptyList();
+
+                        }
                     }
                     if (opt.ignoreRest()) {
                         i = args.length;
                     }
                 } else {
-                    if (collectUnhandled) {
-                        rest.add(args[i]);
-                    } else {
-                        throw new BadArgs("err.orphan.argument", args[i]).
-                            showUsage(true);
-                    }
+                    return Stream.of(Arrays.copyOfRange(args, i, args.length))
+                                 .collect(Collectors.toList());
                 }
             }
-            return rest;
+            return Collections.emptyList();
         }
 
         private Option<T> getOption(String name) {
@@ -645,7 +654,7 @@
             return defaults;
         }
 
-        public Layer getPluginsLayer() {
+        public ModuleLayer getPluginsLayer() {
             return pluginOptions.pluginsLayer;
         }
     }
@@ -715,18 +724,18 @@
         return System.getProperty("java.version");
     }
 
-    static Layer createPluginsLayer(List<Path> paths) {
+    static ModuleLayer createPluginsLayer(List<Path> paths) {
 
         Path[] dirs = paths.toArray(new Path[0]);
         ModuleFinder finder = ModulePath.of(Runtime.version(), true, dirs);
-        Configuration bootConfiguration = Layer.boot().configuration();
+        Configuration bootConfiguration = ModuleLayer.boot().configuration();
         try {
             Configuration cf = bootConfiguration
                 .resolveAndBind(ModuleFinder.of(),
                                 finder,
                                 Collections.emptySet());
             ClassLoader scl = ClassLoader.getSystemClassLoader();
-            return Layer.boot().defineModulesWithOneLoader(cf, scl);
+            return ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
         } catch (Exception ex) {
             // Malformed plugin modules (e.g.: same package in multiple modules).
             throw new PluginException("Invalid modules in the plugins path: " + ex);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,7 +24,6 @@
  */
 package jdk.tools.jlink.internal;
 
-import java.lang.reflect.Module;
 import java.net.URI;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.lang.module.ModuleFinder;
+import java.nio.ByteOrder;
 import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -93,9 +94,12 @@
 
     public void build() throws IOException {
         // jlink main arguments
-        Jlink.JlinkConfiguration jlinkConfig = new Jlink.JlinkConfiguration(
-            new File("").toPath(), // Unused
-            modulePath, addModules, limitModules);
+        Jlink.JlinkConfiguration jlinkConfig =
+            new Jlink.JlinkConfiguration(new File("").toPath(), // Unused
+                                         modulePath,
+                                         addModules,
+                                         limitModules,
+                                         ByteOrder.nativeOrder());
 
         // plugin configuration
         List<Plugin> plugins = new ArrayList<Plugin>();
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,6 +27,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.PrintWriter;
 import java.io.UncheckedIOException;
 import java.lang.module.ModuleDescriptor;
 import java.util.EnumSet;
@@ -43,8 +44,6 @@
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.ResourcePoolModule;
-import jdk.tools.jlink.plugin.Plugin.Category;
-import jdk.tools.jlink.plugin.Plugin.State;
 import jdk.tools.jlink.plugin.Plugin;
 
 /**
@@ -101,9 +100,9 @@
                 //     --release-info add:build_type=fastdebug,source=openjdk,java_version=9
                 // and put whatever value that was passed in command line.
 
-                config.keySet().stream().
-                    filter(s -> !NAME.equals(s)).
-                    forEach(s -> release.put(s, config.get(s)));
+                config.keySet().stream()
+                      .filter(s -> !NAME.equals(s))
+                      .forEach(s -> release.put(s, config.get(s)));
             }
             break;
 
@@ -148,8 +147,8 @@
 
         // put topological sorted module names separated by space
         release.put("MODULES",  new ModuleSorter(in.moduleView())
-                .sorted().map(ResourcePoolModule::name)
-                .collect(Collectors.joining(" ", "\"", "\"")));
+               .sorted().map(ResourcePoolModule::name)
+               .collect(Collectors.joining(" ", "\"", "\"")));
 
         // create a TOP level ResourcePoolEntry for "release" file.
         out.add(ResourcePoolEntry.create("/java.base/release",
@@ -160,11 +159,11 @@
     // 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).
-            version().
-            stream().
-            map(Object::toString).
-            collect(Collectors.joining("."));
+        return Runtime.Version.parse(str)
+                      .version()
+                      .stream()
+                      .map(Object::toString)
+                      .collect(Collectors.joining("."));
     }
 
     private static String quote(String str) {
@@ -172,14 +171,12 @@
     }
 
     private byte[] releaseFileContent() {
-        Properties props = new Properties();
-        props.putAll(release);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try {
-            props.store(baos, "");
-            return baos.toByteArray();
-        } catch (IOException ex) {
-            throw new UncheckedIOException(ex);
+        try (PrintWriter pw = new PrintWriter(baos)) {
+            release.entrySet().stream()
+                   .sorted(Map.Entry.comparingByKey())
+                   .forEach(e -> pw.format("%s=%s%n", e.getKey(), e.getValue()));
         }
+        return baos.toByteArray();
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -24,15 +24,12 @@
 #
 
 main.usage.summary=\
-Usage: {0} <options> --module-path <modulepath> --add-modules <mods> --output\n\
-\<path> use --help for a list of possible options
+Usage: {0} <options> --module-path <modulepath> --add-modules <module>[,<module>...]\n\
+\Use --help for a list of possible options
 
 main.usage=\
-Usage: {0} <options> --module-path <modulepath> --add-modules <mods> --output\n\
-\<path> Possible options include:
-
-error.prefix=Error:
-warn.prefix=Warning:
+Usage: {0} <options> --module-path <modulepath> --add-modules <module>[,<module>...]\n\
+\Possible options include:
 
 main.opt.help=\
 \  -h, --help                            Print this help message
@@ -54,9 +51,18 @@
 \      --output <path>                   Location of output path
 
 main.opt.launcher=\
-\      --launcher <command>=<module>     Launcher command name for the module\n\
-\      --launcher <command>=<module>/<main>\n\
-\                                        Launcher command name for the module and the main class
+\      --launcher <name>=<module>[/<mainclass>]\n\
+\                                        Add a launcher command of the given\n\
+\                                        name for the module and the main class\n\
+\                                        if specified  
+
+main.opt.bind-services=\
+\      --bind-services                   Do full service binding
+
+main.opt.suggest-providers=\
+\      --suggest-providers [<name>,...]  Suggest providers of services used by\n\
+\                                        the modules that would be linked, or\n\
+\                                        of the given service types
 
 main.command.files=\
 \      @<filename>                       Read options from file
@@ -75,6 +81,9 @@
 \                                        signed modular JARs are not copied to\n\
 \                                        the runtime image.
 
+main.opt.verbose=\
+\  -v, --verbose                         Enable verbose tracing
+
 main.msg.bug=\
 An exception has occurred in jlink. \
 Please file a bug at the Java Bug Database (http://bugreport.java.com/bugreport/) \
@@ -95,6 +104,9 @@
 \n\
 
 
+error.prefix=Error:
+warn.prefix=Warning:
+
 err.unknown.byte.order:unknown byte order {0}
 err.launcher.main.class.empty:launcher main class name cannot be empty: {0}
 err.launcher.module.name.empty:launcher module name cannot be empty: {0}
@@ -111,12 +123,12 @@
 err.dir.exists={0} already exists
 err.badpattern=bad pattern {0}
 err.unknown.option=unknown option: {0}
-err.orphan.argument=orphan argument: {0}
 err.missing.arg=no value given for {0}
 err.internal.error=internal error: {0} {1} {2}
 err.invalid.arg.for.option=invalid argument for option: {0}
 err.option.after.class=option must be specified before classes: {0}
 err.option.unsupported={0} not supported: {1}
+err.orphan.arguments=invalid argument: {0}
 err.config.defaults=property {0} is missing from configuration
 err.config.defaults.value=wrong value in defaults property: {0}
 err.bom.generation=bom file generation failed: {0}
@@ -126,3 +138,7 @@
 warn.signing=WARNING: signed modular JAR {0} is currently not supported
 warn.invalid.arg=invalid classname or pathname not exist: {0}
 warn.split.package=package {0} defined in {1} {2}
+warn.unused.services=Services specified in --suggest-providers not used: {0}
+no.suggested.providers=--bind-services option is specified. No additional providers suggested.
+suggested.providers.header=Suggested providers
+providers.header=Providers
--- a/jdk/src/jdk.jlink/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jlink/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Defines the Java linker tool, jlink.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.jlink {
     requires jdk.internal.opt;
     requires jdk.jdeps;
--- a/jdk/src/jdk.jsobject/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jsobject/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Defines the API for the JavaScript Object.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.jsobject {
     requires java.desktop;
     exports netscape.javascript;
--- a/jdk/src/jdk.jstatd/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.jstatd/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,13 @@
  * questions.
  */
 
+/**
+ * Defines the tool for starting a daemon for the jstat tool to monitor
+ * JVM statistics remotely.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.jstatd {
     requires java.rmi;
     requires jdk.internal.jvmstat;
@@ -32,4 +39,3 @@
 
     provides sun.jvmstat.monitor.MonitoredHostService with sun.jvmstat.perfdata.monitor.protocol.rmi.MonitoredHostRmiService;
 }
-
--- a/jdk/src/jdk.localedata/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.localedata/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Locale data provider for locales other than {@linkplain java.util.Locale#US US locale}.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.localedata {
     provides sun.util.locale.provider.LocaleDataMetaInfo with
         sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo,
--- a/jdk/src/jdk.management.agent/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.management.agent/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Define the JMX management agent.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.management.agent {
     requires java.management;
     requires java.management.rmi;
--- a/jdk/src/jdk.management/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.management/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Defines the JDK-specific Management Interfaces for JVM.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.management {
     requires transitive java.management;
 
--- a/jdk/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, 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
@@ -142,6 +142,7 @@
         resps = Collections.synchronizedMap(new HashMap<Integer, byte[]>());
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         close();
     }
--- a/jdk/src/jdk.naming.dns/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.naming.dns/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * DNS Java Naming provider.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.naming.dns {
     requires java.naming;
 
--- a/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -119,6 +119,7 @@
         reference = ctx.reference;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         close();
     }
@@ -593,6 +594,7 @@
         nextName = 0;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         ctx.close();
     }
@@ -633,6 +635,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void close () {
         finalize();
     }
--- a/jdk/src/jdk.naming.rmi/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.naming.rmi/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * RMI Java Naming provider.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.naming.rmi {
     requires java.naming;
     requires java.rmi;
--- a/jdk/src/jdk.net/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.net/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Defines the JDK-specific Networking API.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.net {
     exports jdk.net;
 }
--- a/jdk/src/jdk.sctp/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.sctp/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Defines the JDK-specific API for SCTP.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.sctp {
     exports com.sun.nio.sctp;
 }
--- a/jdk/src/jdk.security.auth/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.security.auth/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,6 +27,7 @@
  * Contains the implementation of the javax.security.auth.* interfaces and
  * various authentication modules.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.security.auth {
--- a/jdk/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -158,6 +158,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         dispose();
     }
--- a/jdk/src/jdk.security.jgss/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.security.jgss/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,6 +27,7 @@
  * Defines Java extensions to the GSS-API and an implementation of the SASL
  * GSSAPI mechanism.
  *
+ * @moduleGraph
  * @since 9
  */
 module jdk.security.jgss {
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Mon Apr 10 08:31:37 2017 -0700
@@ -936,6 +936,7 @@
         return zc.toString(name);
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws IOException {
         close();
     }
--- a/jdk/src/jdk.zipfs/share/classes/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/src/jdk.zipfs/share/classes/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Zip file system provider.
+ *
+ * @moduleGraph
+ * @since 9
+ */
 module jdk.zipfs {
     provides java.nio.file.spi.FileSystemProvider with jdk.nio.zipfs.ZipFileSystemProvider;
 }
--- a/jdk/test/ProblemList.txt	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/ProblemList.txt	Mon Apr 10 08:31:37 2017 -0700
@@ -180,8 +180,6 @@
 
 java/nio/channels/DatagramChannel/ChangingAddress.java          7141822 macosx-all
 
-java/nio/channels/Selector/OutOfBand.java                       7132677 macosx-all
-
 java/nio/file/WatchService/Basic.java                           7158947 solaris-all Solaris 11
 java/nio/file/WatchService/MayFlies.java                        7158947 solaris-all Solaris 11
 java/nio/file/WatchService/LotsOfEvents.java                    7158947 solaris-all Solaris 11
@@ -286,7 +284,6 @@
 
 java/util/BitSet/BitSetStreamTest.java                          8079538 generic-all
 
-
 ############################################################################
 
 # jdk_instrument
--- a/jdk/test/TEST.ROOT	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/TEST.ROOT	Mon Apr 10 08:31:37 2017 -0700
@@ -26,8 +26,8 @@
 # Allow querying of various System properties in @requires clauses
 requires.properties=sun.arch.data.model java.runtime.name
 
-# Tests using jtreg 4.2 b05 features
-requiredVersion=4.2 b05
+# Tests using jtreg 4.2 b07 features
+requiredVersion=4.2 b07
 
 # Path to libraries in the topmost test directory. This is needed so @library
 # does not need ../../ notation to reach them
--- a/jdk/test/TEST.groups	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/TEST.groups	Mon Apr 10 08:31:37 2017 -0700
@@ -70,9 +70,11 @@
     sun/reflect \
     jdk/internal/reflect \
     jdk/lambda \
+    jdk/internal/loader \
     jdk/internal/misc \
     jdk/internal/ref \
     jdk/internal/jimage \
+    jdk/internal/math \
     jdk/modules \
     vm
 
@@ -87,6 +89,7 @@
 jdk_util_other = \
     java/util \
     sun/util \
+    jdk/internal/util \
     -:jdk_collections \
     -:jdk_concurrent \
     -:jdk_stream
@@ -141,8 +144,7 @@
     java/util/stream
 
 jdk_math = \
-    java/math \
-    jdk/internal/math
+    java/math
 
 jdk_io = \
     java/io
@@ -177,6 +179,7 @@
 jdk_security3 = \
     javax/security  \
     -javax/security/auth/kerberos \
+    com/sun/jarsigner \
     com/sun/security \
     -com/sun/security/jgss \
     com/sun/org/apache/xml/internal/security \
@@ -207,7 +210,8 @@
 jdk_management = \
     java/lang/management \
     com/sun/management \
-    sun/management
+    sun/management \
+    jdk/internal/agent
 
 jdk_instrument = \
     java/lang/instrument
--- a/jdk/test/com/sun/jdi/AcceptTimeout.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/AcceptTimeout.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,8 +24,7 @@
 /* @test
  * @bug 6198277
  * @summary Test that each ListeningConnector that supports a "timeout" argument will
- *     timeout with TransportTimeoutException
- * @modules jdk.jdi
+ * timeout with TransportTimeoutException
  */
 import com.sun.jdi.Bootstrap;
 import com.sun.jdi.connect.Connector;
--- a/jdk/test/com/sun/jdi/AccessSpecifierTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/AccessSpecifierTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4359628
- *  @summary Test fix for JDI: methods Accessible.is...() lie about array types
+ * @test
+ * @bug 4359628
+ * @summary Test fix for JDI: methods Accessible.is...() lie about array types
+ * @author Tim Bell
  *
- *  @author Tim Bell
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g AccessSpecifierTest.java
- *  @run driver AccessSpecifierTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g AccessSpecifierTest.java
+ * @run driver AccessSpecifierTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/AfterThreadDeathTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/AfterThreadDeathTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4364671
- *  @summary Creating a StepRequest on a nonexistant thread fails
+ * @test
+ * @bug 4364671
+ * @summary Creating a StepRequest on a nonexistant thread fails
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g AfterThreadDeathTest.java
- *  @run driver AfterThreadDeathTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g AfterThreadDeathTest.java
+ * @run driver AfterThreadDeathTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/AllLineLocations.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/AllLineLocations.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 4248728
- *  @summary Test ReferenceType.allLineLocations
- *  @author Gordon Hirsch
+ * @test
+ * @bug 4248728
+ * @summary Test ReferenceType.allLineLocations
+ * @author Gordon Hirsch
  *
- *  @modules jdk.jdi
- *  @run build JDIScaffold VMConnection
- *  @run compile -g RefTypes.java
- *  @run build AllLineLocations
+ * @run build JDIScaffold VMConnection
+ * @run compile -g RefTypes.java
+ * @run build AllLineLocations
  *
- *  @run driver AllLineLocations RefTypes
+ * @run driver AllLineLocations RefTypes
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/ArgumentValuesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ArgumentValuesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,13 +1,38 @@
-/** hard coded linenumbers in other tests - DO NOT CHANGE
- *  @test/nodynamiccopyright/
- *  @bug 4490824
- *  @summary JDI: provide arguments when no debug attributes present
+/*
+ * 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
+ * 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.
  *
- *  @author jjh
+ * Please 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 TEST IS LINE NUMBER SENSITIVE
+
+/**
+ * @test
+ * @bug 4490824
+ * @summary JDI: provide arguments when no debug attributes present
  *
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile ArgumentValuesTest.java
- *  @run driver ArgumentValuesTest
+ * @author jjh
+ *
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile ArgumentValuesTest.java
+ * @run driver ArgumentValuesTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
@@ -35,26 +60,26 @@
     static List<Integer> intList;
 
     public static void noArgs() {
-        int index = 0;     // line 38
+        int index = 0;     // line NO_ARGS_LINE_1
     }
 
     public static void allArgs(char p_char, byte p_byte, short p_short,
                                int p_int, long p_long, float p_float,
                                double p_double, int p_iarray[], int p_marray[][],
                                String p_sarray1[], String p_string) {
-        int index = 0;      // line 45
+        int index = 0;      // line ALL_ARGS_LINE_1
     }
 
     public static void varArgs(String ... p1) {
-        int index = 0;     // line 49
+        int index = 0;     // line VAR_ARGS_LINE_1
     }
 
     public static void genericArgs(List<Integer> p1) {
-        int index = 0;     // line 53
+        int index = 0;     // line GENERIC_ARGS_LINE_1
     }
 
     public void instanceMethod(char p_char, byte p_byte) {
-        int index = 0;     // line 57
+        int index = 0;     // line INSTANCE_METHOD_LINE_1
     }
 
     public static void main(String[] args) {
@@ -81,6 +106,12 @@
  /********** test program **********/
 
 public class ArgumentValuesTest extends TestScaffold {
+    static final int NO_ARGS_LINE_1 = 63;
+    static final int ALL_ARGS_LINE_1 = 70;
+    static final int VAR_ARGS_LINE_1 = 74;
+    static final int GENERIC_ARGS_LINE_1 = 78;
+    static final int INSTANCE_METHOD_LINE_1 = 82;
+
     // Must be in same order as args to allArgs(....)
     String fieldNames[] = {"s_char1",   "s_byte1",   "s_short1",  "s_int1",
                            "s_long1",   "s_float1",  "s_double1", "s_iarray1",
@@ -118,7 +149,7 @@
 
         {
             System.out.println("----- Testing each type of arg");
-            bpe = resumeTo("ArgumentValuesTarg", 45);
+            bpe = resumeTo("ArgumentValuesTarg", ALL_ARGS_LINE_1);
             StackFrame frame = bpe.thread().frame(0);
 
             Method mmm = frame.location().method();
@@ -147,7 +178,7 @@
         // a method with no params
         {
             System.out.println("----- Testing no args");
-            bpe = resumeTo("ArgumentValuesTarg", 38);
+            bpe = resumeTo("ArgumentValuesTarg", NO_ARGS_LINE_1);
             StackFrame frame = bpe.thread().frame(0);
 
             Method mmm = frame.location().method();
@@ -165,7 +196,7 @@
         // as a String[3] in the method.
         {
             System.out.println("----- Testing var args");
-            bpe = resumeTo("ArgumentValuesTarg", 49);
+            bpe = resumeTo("ArgumentValuesTarg", VAR_ARGS_LINE_1);
             StackFrame frame = bpe.thread().frame(0);
 
             Method mmm = frame.location().method();
@@ -199,7 +230,7 @@
         // a method with with one generic param
         {
             System.out.println("----- Testing generic args");
-            bpe = resumeTo("ArgumentValuesTarg", 53);
+            bpe = resumeTo("ArgumentValuesTarg", GENERIC_ARGS_LINE_1);
             StackFrame frame = bpe.thread().frame(0);
 
             Method mmm = frame.location().method();
@@ -224,7 +255,7 @@
         // test instance method call
         {
             System.out.println("----- Testing instance method call");
-            bpe = resumeTo("ArgumentValuesTarg", 57);
+            bpe = resumeTo("ArgumentValuesTarg", INSTANCE_METHOD_LINE_1);
             StackFrame frame = bpe.thread().frame(0);
 
             Method mmm = frame.location().method();
--- a/jdk/test/com/sun/jdi/ArrayRangeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ArrayRangeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,18 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 4439631
- *  @bug 4448721
- *  @bug 4448603
- *  @summary Test access to ranges within ArrayReferences
+ * @test
+ * @bug 4439631
+ * @bug 4448721
+ * @bug 4448603
+ * @summary Test access to ranges within ArrayReferences
+ * @author Robert Field
  *
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g ArrayRangeTest.java
- *  @run driver ArrayRangeTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g ArrayRangeTest.java
+ * @run driver ArrayRangeTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/BacktraceFieldTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/BacktraceFieldTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4446677
- *  @bug 8158237
- *  @summary debuggee used to crash when debugging under jbuilder
+ * @test
+ * @bug 4446677
+ * @bug 8158237
+ * @summary debuggee used to crash when debugging under jbuilder
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g BacktraceFieldTest.java
- *  @run driver BacktraceFieldTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g BacktraceFieldTest.java
+ * @run driver BacktraceFieldTest
  */
 
 /*
--- a/jdk/test/com/sun/jdi/BreakpointTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/BreakpointTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,19 +21,20 @@
  * questions.
  */
 
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
 /**
- *  @test
- *  @bug 6496524
- *  @summary Setting breakpoint in jdb crashes Hotspot JVM
- *
- *  @author jjh
+ * @test
+ * @bug 6496524
+ * @key intermittent
+ * @summary Setting breakpoint in jdb crashes Hotspot JVM
+ * @author jjh
  *
- *  @key intermittent
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g BreakpointTest.java
- *  @run driver BreakpointTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g BreakpointTest.java
+ * @run driver BreakpointTest
  */
+
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
 import com.sun.jdi.request.*;
@@ -47,7 +48,6 @@
 
 class BreakpointTarg {
     public final static int BKPT_LINE = 56;
-            // LINE NUMBER SENSITIVE
 
     public static long count;
     static void doit() {
--- a/jdk/test/com/sun/jdi/ClassLoaderClassesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ClassLoaderClassesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,10 +27,8 @@
  *  @summary Test ClassLoaderReference.visibleClasses() which is
  *  a direct pass-through of the JVMDI function GetClassLoaderClasses
  *  for inclusion of primitive arrays.
- *
  *  @author Robert Field
  *
- *  @modules jdk.jdi
  *  @run build TestScaffold VMConnection TargetListener TargetAdapter
  *  @run compile -g ClassLoaderClassesTest.java
  *  @run driver ClassLoaderClassesTest
--- a/jdk/test/com/sun/jdi/ClassesByName.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ClassesByName.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,16 +24,14 @@
 /**
  *  @test
  *  @bug 4287992
+ *  @summary ClassesByName verifies that all the classes in the
+ *  loaded class list can be found with classesByName..
  *  @author Robert Field
  *
- *  @modules jdk.jdi
  *  @run build JDIScaffold VMConnection
  *  @run compile -g HelloWorld.java
  *  @run build ClassesByName
  *
- *  @summary ClassesByName verifies that all the classes in the
- *  loaded class list can be found with classesByName..
- *
  *  @run driver ClassesByName HelloWorld
  */
 import com.sun.jdi.*;
--- a/jdk/test/com/sun/jdi/ClassesByName2Test.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ClassesByName2Test.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,17 @@
  */
 
 /**
- *  @test
- *  @bug 4406439 4925740
- *  @summary ClassesByName2 verifies that all the classes in the loaded class list can be found with classesByName..
+ * @test
+ * @bug 4406439 4925740
+ * @summary ClassesByName2 verifies that all the classes in the loaded class list can be found with classesByName..
+ * @author Tim Bell (based on ClassesByName by Robert Field)
  *
- *  @author Tim Bell (based on ClassesByName by Robert Field)
+ * @modules jdk.jdi
+ *          java.desktop
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g ClassesByName2Test.java
- *  @run driver ClassesByName2Test
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g ClassesByName2Test.java
+ * @run driver ClassesByName2Test
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/CompatibleConnectors.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/CompatibleConnectors.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  *
  * This test checks that VirtualMachineManager creates Connectors that
  * are "compatible" those created by 1.4 or earilier releases.
- * @modules jdk.jdi
  */
 
 import com.sun.jdi.*;
--- a/jdk/test/com/sun/jdi/ConnectedVMs.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ConnectedVMs.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,20 +22,18 @@
  */
 
 /**
- *  @test
- *  @bug 4329140
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g InstTarg.java
- *  @run driver ConnectedVMs Kill
- *  @run driver ConnectedVMs Resume-to-exit
- *  @run driver ConnectedVMs dispose()
- *  @run driver ConnectedVMs exit()
- *
+ * @test
+ * @bug 4329140
  * @summary ConnectedVMs checks the method
  * VirtualMachineManager.connectedVirtualMachines()
+ * @author Robert Field
+ *
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g InstTarg.java
+ * @run driver ConnectedVMs Kill
+ * @run driver ConnectedVMs Resume-to-exit
+ * @run driver ConnectedVMs dispose()
+ * @run driver ConnectedVMs exit()
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/ConstantPoolInfo.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ConstantPoolInfo.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 5024104
- *  @summary Test ReferenceType.majorVersion(), minorVersion, constantPoolCount and ConstantPool apis.
+ * @test
+ * @bug 5024104
+ * @summary Test ReferenceType.majorVersion(), minorVersion, constantPoolCount and ConstantPool apis.
+ * @author Swamy Venkataramanappa
  *
- *  @author Swamy Venkataramanappa
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection
- *  @run compile -g ConstantPoolInfo.java
- *  @run driver ConstantPoolInfo
+ * @run build TestScaffold VMConnection
+ * @run compile -g ConstantPoolInfo.java
+ * @run driver ConstantPoolInfo
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/ConstantPoolInfoGC.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ConstantPoolInfoGC.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,16 @@
  */
 
 /*
- *  @test
- *  @bug 6822627
- *  @summary Test that ReferenceType.constantPool does not produce an NPE
+ * @test
+ * @bug 6822627
+ * @summary Test that ReferenceType.constantPool does not produce an NPE
+ * @author Egor Ushakov
  *
- *  @author Egor Ushakov
+ * @modules jdk.jdi/com.sun.tools.jdi:+open
  *
- *  @modules jdk.jdi/com.sun.tools.jdi:+open
- *  @run build TestScaffold VMConnection
- *  @run compile -g ConstantPoolInfoGC.java
- *  @run main/othervm ConstantPoolInfoGC
+ * @run build TestScaffold VMConnection
+ * @run compile -g ConstantPoolInfoGC.java
+ * @run main/othervm ConstantPoolInfoGC
  */
 
 import com.sun.jdi.ReferenceType;
--- a/jdk/test/com/sun/jdi/CountEvent.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/CountEvent.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4315352
- *  @summary disabling EventRequest expired with addCountFilter() throws
- *   InternalException.
+ * @test
+ * @bug 4315352
+ * @summary disabling EventRequest expired with addCountFilter() throws
+ * InternalException.
+ * @author Robert Field
  *
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetAdapter TargetListener
- *  @run compile -g CountEvent.java
- *  @run driver CountEvent
+ * @run build TestScaffold VMConnection TargetAdapter TargetListener
+ * @run compile -g CountEvent.java
+ * @run driver CountEvent
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/CountFilterTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/CountFilterTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4321339
- *  @summary Check correct processing of filters after a count filter
+ * @test
+ * @bug 4321339
+ * @summary Check correct processing of filters after a count filter
+ * @author Robert Field
  *
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g CountFilterTest.java
- *  @run driver CountFilterTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g CountFilterTest.java
+ * @run driver CountFilterTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/DebuggerThreadTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/DebuggerThreadTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4513488
- *  @summary Test for JDI: Internal JDI helper threads should setDaemon(true)
+ * @test
+ * @bug 4513488
+ * @summary Test for JDI: Internal JDI helper threads should setDaemon(true)
+ * @author Tim Bell
  *
- *  @author Tim Bell
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g DebuggerThreadTest.java
- *  @run driver DebuggerThreadTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g DebuggerThreadTest.java
+ * @run driver DebuggerThreadTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/DeleteAllBkptsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/DeleteAllBkptsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 4528948
- *  @summary Unable to finish a debugging in NetBeans IDE
- *
- *  @author jjh
+ * @test
+ * @bug 4528948
+ * @summary Unable to finish a debugging in NetBeans IDE
+ * @author jjh
  *
- *  @library ..
- *  @modules jdk.jdi
- *  @run build  TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g DeleteAllBkptsTest.java
- *  @run driver DeleteAllBkptsTest
+ * @library ..
+ *
+ * @run build  TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g DeleteAllBkptsTest.java
+ * @run driver DeleteAllBkptsTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/DeleteEventRequestsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/DeleteEventRequestsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4331872
- *  @summary erm.deleteEventRequests(erm.breakpointRequests()) throws exception
+ * @test
+ * @bug 4331872
+ * @summary erm.deleteEventRequests(erm.breakpointRequests()) throws exception
+ * @author Robert Field
  *
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g DeleteEventRequestsTest.java
- *  @run driver DeleteEventRequestsTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g DeleteEventRequestsTest.java
+ * @run driver DeleteEventRequestsTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/EarlyReturnNegativeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/EarlyReturnNegativeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,15 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 6431735
- *  @summary Unexpected ClassCastException in ThreadReference.forceEarlyReturn
- *  @author Jim Holmlund
+ * @test
+ * @bug 6431735
+ * @summary Unexpected ClassCastException in ThreadReference.forceEarlyReturn
+ * @author Jim Holmlund
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g EarlyReturnNegativeTest.java
- *  @run driver EarlyReturnNegativeTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g EarlyReturnNegativeTest.java
+ * @run driver EarlyReturnNegativeTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/EarlyReturnTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/EarlyReturnTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,22 +22,21 @@
  */
 
 /*
- *  @test
- *  @bug 6175634
- *  @summary Allow early return from methods
+ * @test
+ * @bug 6175634
+ * @summary Allow early return from methods
  *
- *  @bug 6431720
- *  @summary Unexpected InvalidTypeException when call ThreadReference.forceEarlyReturn with VoidValue
+ * @bug 6431720
+ * @summary Unexpected InvalidTypeException when call ThreadReference.forceEarlyReturn with VoidValue
  *
- *  @bug 6432855
- *  @summary Need a way to create JDI VoidValue for use in ThreadReference.forceEarlyReturn
- *
- *  @author Tim Bell (based on MethodExitReturnValuesTest by Jim Holmlund)
+ * @bug 6432855
+ * @summary Need a way to create JDI VoidValue for use in ThreadReference.forceEarlyReturn
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g EarlyReturnTest.java
- *  @run driver EarlyReturnTest
+ * @author Tim Bell (based on MethodExitReturnValuesTest by Jim Holmlund)
+ *
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g EarlyReturnTest.java
+ * @run driver EarlyReturnTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/EnumTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/EnumTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4728816
- *  @summary JPDA: Add support for enums
+ * @test
+ * @bug 4728816
+ * @summary JPDA: Add support for enums
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g EnumTest.java
- *  @run driver EnumTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g EnumTest.java
+ * @run driver EnumTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/EventQueueDisconnectTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/EventQueueDisconnectTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,21 +22,20 @@
  */
 
 /**
- *  @test
- *  @bug 4425852
- *  @author Robert Field
+ * @test
+ * @bug 4425852
+ * @author Robert Field
  *
- *  @modules jdk.jdi
- *  @run build VMConnection
- *  @run compile -g EventQueueDisconnectTest.java
- *  @run driver EventQueueDisconnectTest
- *
- *  @summary EventQueueDisconnectTest checks to see that
- *  VMDisconnectedException is never thrown before VMDisconnectEvent.
+ * @summary EventQueueDisconnectTest checks to see that
+ * VMDisconnectedException is never thrown before VMDisconnectEvent.
  *
  * Failure mode for this test is throwing VMDisconnectedException
  * on vm.eventQueue().remove();
  * Does not use a scaffold since we don't want that hiding the exception.
+ *
+ * @run build VMConnection
+ * @run compile -g EventQueueDisconnectTest.java
+ * @run driver EventQueueDisconnectTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/ExceptionEvents.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ExceptionEvents.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,43 +22,41 @@
  */
 
 /**
- *  @test
- *  @bug 4407397
- *  @summary Test the requesting of exception events
- *
- *  @author Robert Field
+ * @test
+ * @bug 4407397
+ * @key intermittent
+ * @summary Test the requesting of exception events
+ * @author Robert Field
  *
- *  @key intermittent
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection
- *  @run compile -g ExceptionEvents.java
+ * @run build TestScaffold VMConnection
+ * @run compile -g ExceptionEvents.java
  *
- *  @run driver ExceptionEvents N A StackOverflowCaughtTarg java.lang.Exception
- *  @run driver ExceptionEvents C A StackOverflowCaughtTarg null
- *  @run driver ExceptionEvents C A StackOverflowCaughtTarg java.lang.Error
- *  @run driver ExceptionEvents C A StackOverflowCaughtTarg java.lang.StackOverflowError
- *  @run driver ExceptionEvents N A StackOverflowCaughtTarg java.lang.NullPointerException
+ * @run driver ExceptionEvents N A StackOverflowCaughtTarg java.lang.Exception
+ * @run driver ExceptionEvents C A StackOverflowCaughtTarg null
+ * @run driver ExceptionEvents C A StackOverflowCaughtTarg java.lang.Error
+ * @run driver ExceptionEvents C A StackOverflowCaughtTarg java.lang.StackOverflowError
+ * @run driver ExceptionEvents N A StackOverflowCaughtTarg java.lang.NullPointerException
 
- *  @run driver ExceptionEvents N T StackOverflowCaughtTarg java.lang.Exception
- *  @run driver ExceptionEvents C T StackOverflowCaughtTarg null
- *  @run driver ExceptionEvents C T StackOverflowCaughtTarg java.lang.Error
- *  @run driver ExceptionEvents C T StackOverflowCaughtTarg java.lang.StackOverflowError
- *  @run driver ExceptionEvents N T StackOverflowCaughtTarg java.lang.NullPointerException
+ * @run driver ExceptionEvents N T StackOverflowCaughtTarg java.lang.Exception
+ * @run driver ExceptionEvents C T StackOverflowCaughtTarg null
+ * @run driver ExceptionEvents C T StackOverflowCaughtTarg java.lang.Error
+ * @run driver ExceptionEvents C T StackOverflowCaughtTarg java.lang.StackOverflowError
+ * @run driver ExceptionEvents N T StackOverflowCaughtTarg java.lang.NullPointerException
 
- *  @run driver ExceptionEvents N N StackOverflowCaughtTarg java.lang.Exception
- *  @run driver ExceptionEvents C N StackOverflowCaughtTarg null
- *  @run driver ExceptionEvents C N StackOverflowCaughtTarg java.lang.Error
- *  @run driver ExceptionEvents C N StackOverflowCaughtTarg java.lang.StackOverflowError
- *  @run driver ExceptionEvents N N StackOverflowCaughtTarg java.lang.NullPointerException
+ * @run driver ExceptionEvents N N StackOverflowCaughtTarg java.lang.Exception
+ * @run driver ExceptionEvents C N StackOverflowCaughtTarg null
+ * @run driver ExceptionEvents C N StackOverflowCaughtTarg java.lang.Error
+ * @run driver ExceptionEvents C N StackOverflowCaughtTarg java.lang.StackOverflowError
+ * @run driver ExceptionEvents N N StackOverflowCaughtTarg java.lang.NullPointerException
 
- *  @run driver ExceptionEvents N A StackOverflowUncaughtTarg java.lang.Exception
- *  @run driver ExceptionEvents U A StackOverflowUncaughtTarg null
- *  @run driver ExceptionEvents U A StackOverflowUncaughtTarg java.lang.Error
- *  @run driver ExceptionEvents U A StackOverflowUncaughtTarg java.lang.StackOverflowError
- *  @run driver ExceptionEvents N A StackOverflowUncaughtTarg java.lang.NullPointerException
+ * @run driver ExceptionEvents N A StackOverflowUncaughtTarg java.lang.Exception
+ * @run driver ExceptionEvents U A StackOverflowUncaughtTarg null
+ * @run driver ExceptionEvents U A StackOverflowUncaughtTarg java.lang.Error
+ * @run driver ExceptionEvents U A StackOverflowUncaughtTarg java.lang.StackOverflowError
+ * @run driver ExceptionEvents N A StackOverflowUncaughtTarg java.lang.NullPointerException
 
- *  @run driver ExceptionEvents N T StackOverflowUncaughtTarg java.lang.NullPointerException
- *  @run driver ExceptionEvents N N StackOverflowUncaughtTarg java.lang.NullPointerException
+ * @run driver ExceptionEvents N T StackOverflowUncaughtTarg java.lang.NullPointerException
+ * @run driver ExceptionEvents N N StackOverflowUncaughtTarg java.lang.NullPointerException
 
  */
 import com.sun.jdi.*;
--- a/jdk/test/com/sun/jdi/ExpiredRequestDeletionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ExpiredRequestDeletionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 4453310
- *  @summary Test the deletion of event requests that are expired
- *     by virtue of addCountFilter.
+ * @test
+ * @bug 4453310
+ * @summary Test the deletion of event requests that are expired
+ * by virtue of addCountFilter.
  *
- *  @author Robert Field
+ * @author Robert Field
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g ExpiredRequestDeletionTest.java
- *  @run driver ExpiredRequestDeletionTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g ExpiredRequestDeletionTest.java
+ * @run driver ExpiredRequestDeletionTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/FetchLocals.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/FetchLocals.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,13 +1,37 @@
-/** hard coded linenumbers in test - DO NOT CHANGE
- *  @test/nodynamiccopyright/
- *  @bug 4386002 4429245
- *  @summary Test fix for: Incorrect values reported for some locals of type long
+/*
+ * 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
+ * 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).
  *
- *  @author Tim Bell
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g FetchLocals.java
- *  @run driver FetchLocals
+ * Please 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 TEST IS LINE NUMBER SENSITIVE
+
+/**
+ * @test
+ * @bug 4386002 4429245
+ * @summary Test fix for: Incorrect values reported for some locals of type long
+ * @author Tim Bell
+ *
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g FetchLocals.java
+ * @run driver FetchLocals
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
@@ -59,7 +83,7 @@
         System.out.println(f);
         System.out.print("d is: ");
         System.out.println(d);
-        System.out.println();   // Thie is Line 63...
+        System.out.println();   // This is FetchLocals::LINE
         if (w == 0xde00ad00be00ef00L) {
           System.out.print  ("The debugger was here.  w modified to: 0x");
           System.out.println(Long.toHexString(w));
@@ -87,6 +111,7 @@
 }
 
 public class FetchLocals extends TestScaffold {
+    static final int LINE = 86;
 
     FetchLocals (String args[]) {
         super(args);
@@ -355,7 +380,7 @@
          * Get to the bottom of testMethod():
          */
         try {
-            BreakpointEvent bpe = resumeTo("FetchLocalsDebugee", 63);
+            BreakpointEvent bpe = resumeTo("FetchLocalsDebugee", LINE);
             /*
              * Fetch values from fields; what did we get?
              */
--- a/jdk/test/com/sun/jdi/FieldWatchpoints.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/FieldWatchpoints.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4408582
- *  @summary Test fix for: JDWP: WatchpointEvents outside of class filtered out
+ * @test
+ * @bug 4408582
+ * @summary Test fix for: JDWP: WatchpointEvents outside of class filtered out
+ * @author Tim Bell
  *
- *  @author Tim Bell
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g FieldWatchpoints.java
- *  @run driver FieldWatchpoints
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g FieldWatchpoints.java
+ * @run driver FieldWatchpoints
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/FilterMatch.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/FilterMatch.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4331522
- *  @summary addClassFilter("Foo") acts like "Foo*"
+ * @test
+ * @bug 4331522
+ * @summary addClassFilter("Foo") acts like "Foo*"
+ * @author Robert Field/Jim Holmlund
  *
- *  @author Robert Field/Jim Holmlund
- *
- *  @modules jdk.jdi
- *  @run build JDIScaffold VMConnection
- *  @run compile -g HelloWorld.java
- *  @run driver FilterMatch
+ * @run build JDIScaffold VMConnection
+ * @run compile -g HelloWorld.java
+ * @run driver FilterMatch
  */
 
 /* Look at patternMatch in JDK file:
--- a/jdk/test/com/sun/jdi/FilterNoMatch.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/FilterNoMatch.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4331522
- *  @summary addClassFilter("Foo") acts like "Foo*"
+ * @test
+ * @bug 4331522
+ * @summary addClassFilter("Foo") acts like "Foo*"
+ * @author Robert Field/Jim Holmlund
  *
- *  @author Robert Field/Jim Holmlund
- *
- *  @modules jdk.jdi
- *  @run build JDIScaffold VMConnection
- *  @run compile -g HelloWorld.java
- *  @run driver FilterNoMatch
+ * @run build JDIScaffold VMConnection
+ * @run compile -g HelloWorld.java
+ * @run driver FilterNoMatch
  */
 
 /* This tests the patternMatch function in JDK file:
--- a/jdk/test/com/sun/jdi/FinalLocalsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/FinalLocalsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,18 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 4326648 4768329
- *  @summary Test to verify that table entries are generated for all final
- *           locals when a class is built for debug, even if they could be
- *           inlined otherwise.
+ * @test
+ * @bug 4326648 4768329
+ * @summary Test to verify that table entries are generated for all final
+ *          locals when a class is built for debug, even if they could be
+ *          inlined otherwise.
+ * @author Tim Bell
  *
- *  @author Tim Bell
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g FinalLocalsTest.java
- *  @run driver FinalLocalsTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g FinalLocalsTest.java
+ * @run driver FinalLocalsTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/FinalizerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/FinalizerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4272800 4274208 4392010
- *  @summary Test debugger operations in finalize() methods
- *  @author Gordon Hirsch  (modified for HotSpot by tbell & rfield)
+ * @test
+ * @bug 4272800 4274208 4392010
+ * @summary Test debugger operations in finalize() methods
+ * @author Gordon Hirsch  (modified for HotSpot by tbell & rfield)
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g FinalizerTest.java
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g FinalizerTest.java
  *
- *  @run driver FinalizerTest
+ * @run driver FinalizerTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/FramesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/FramesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4434232
- *  @summary Test ThreadReference.frames(int,int)
+ * @test
+ * @bug 4434232
+ * @summary Test ThreadReference.frames(int,int)
+ * @author Robert Field
  *
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g FramesTest.java
- *  @run driver FramesTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g FramesTest.java
+ * @run driver FramesTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/GenericsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/GenericsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4421040
- *  @summary  JPDA: Add support for JSR-014 Generics
+ * @test
+ * @bug 4421040
+ * @summary  JPDA: Add support for JSR-014 Generics
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g GenericsTest.java
- *  @run driver GenericsTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g GenericsTest.java
+ * @run driver GenericsTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/GetLocalVariables.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/GetLocalVariables.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,14 +1,39 @@
-/** hard coded linenumbers in this test - DO NOT CHANGE
- *  @test/nodynamiccopyright/
- *  @bug 4359312 4450091
- *  @summary Test PTR 1421 JVM exceptions making a call to LocalVariable.type().name()
+/*
+ * 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
+ * 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.
  *
- *  @author Tim Bell (based on the PTR 1421 report submitted by IBM).
+ * Please 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 TEST IS LINE NUMBER SENSITIVE
+
+/**
+ * @test
+ * @bug 4359312 4450091
+ * @summary Test PTR 1421 JVM exceptions making a call to LocalVariable.type().name()
+ * @author Tim Bell (based on the PTR 1421 report submitted by IBM).
  *
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g GetLocalVariables.java
- *  @run driver GetLocalVariables
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g GetLocalVariables.java
+ * @run driver GetLocalVariables
  */
+
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
 import com.sun.jdi.request.*;
@@ -194,7 +219,7 @@
                                      l_long, l_float, l_double, l_iarray,
                                      l_marray, l_string);
 
-        e1.test_1();            // <-- this is line 197
+        e1.test_1();            // RESUME_TO_LINE
         e3.test_1();
         e4.test_1();
         e5.test_1();
@@ -231,6 +256,7 @@
  /********** test program **********/
 
 public class GetLocalVariables extends TestScaffold {
+    static final int RESUME_TO_LINE = 222;
     ReferenceType targetClass;
     ThreadReference mainThread;
 
@@ -257,7 +283,7 @@
         mainThread = bpe.thread();
         EventRequestManager erm = vm().eventRequestManager();
 
-        bpe = resumeTo("GetLocalVariablesTarg", 197);
+        bpe = resumeTo("GetLocalVariablesTarg", RESUME_TO_LINE);
         /*
          * We've arrived.  Look around at some variables.
          */
--- a/jdk/test/com/sun/jdi/GetLocalVariables2Test.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/GetLocalVariables2Test.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4349534 4690242 4695338
- *  @summary regression - bad LocalVariableTable attribute when no initialization needed
+ * @test
+ * @bug 4349534 4690242 4695338
+ * @summary regression - bad LocalVariableTable attribute when no initialization needed
+ * @author Tim Bell
  *
- *  @author Tim Bell
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g GetLocalVariables2Test.java
- *  @run driver GetLocalVariables2Test
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g GetLocalVariables2Test.java
+ * @run driver GetLocalVariables2Test
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/GetSetLocalTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/GetSetLocalTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,13 +1,37 @@
-/** hard coded linenumbers in other tests - DO NOT CHANGE
- *  @test/nodynamiccopyright/
- *  @bug 4300412
- *  @summary Test GetLocal* and SetLocal* functions
+/*
+ * 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
+ * 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).
  *
- *  @author Serguei Spitsyn
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g GetSetLocalTest.java
- *  @run driver GetSetLocalTest
+ * Please 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 TEST IS LINE NUMBER SENSITIVE
+
+/**
+ * @test
+ * @bug 4300412
+ * @summary Test GetLocal* and SetLocal* functions
+ * @author Serguei Spitsyn
+ *
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g GetSetLocalTest.java
+ * @run driver GetSetLocalTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
@@ -35,7 +59,7 @@
         int result;
         {
              { boolean bool_1 = false;
-               intArg++;
+               intArg++; // START_LINE
              }
 
              boolean bool_2 = true;
@@ -111,7 +135,7 @@
              }
 
              Object obj_2 = new Object();
-             intArg++;  // <-- Last stop is at this point.
+             intArg++;  // STOP_LINE. Last stop is at this point.
                         //     Only obj_2 and intArg are valid
                         // Note: even result is not valid here!
         }
@@ -125,6 +149,8 @@
     /********** test program **********/
 
 public class GetSetLocalTest extends TestScaffold {
+    static final int START_LINE = 62;
+    static final int STOP_LINE = 138;
     ReferenceType targetClass;
     ThreadReference mainThread;
 
@@ -635,7 +661,7 @@
         println("EventRequestManager");
         StackFrame frame = null;
 
-        for (int line = 38; line < 118; line += 4) {
+        for (int line = START_LINE; line <= STOP_LINE; line += 4) {
             println("\n resumeTo(GetSetLocalTarg, " + line + ")");
             bpe = resumeTo("GetSetLocalTarg", line);
             frame = bpe.thread().frame(0);
--- a/jdk/test/com/sun/jdi/GetUninitializedStringValue.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/GetUninitializedStringValue.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 8021897
- *  @summary Test getting the value for an uninitialized String object
+ * @test
+ * @bug 8021897
+ * @summary Test getting the value for an uninitialized String object
+ * @author Staffan Larsen
  *
- *  @author Staffan Larsen
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g GetUninitializedStringValue.java
- *  @run driver GetUninitializedStringValue
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g GetUninitializedStringValue.java
+ * @run driver GetUninitializedStringValue
  */
 import com.sun.jdi.ReferenceType;
 import com.sun.jdi.StackFrame;
--- a/jdk/test/com/sun/jdi/HomeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/HomeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4446294
- *  @summary JDI spec/impl: default "home" for CommandLineLaunch isn't java.home
+ * @test
+ * @bug 4446294
+ * @summary JDI spec/impl: default "home" for CommandLineLaunch isn't java.home
+ * @author Tim Bell (based on "HomeTest.java" by Eugene I. Latkin)
  *
- *  @author Tim Bell (based on "HomeTest.java" by Eugene I. Latkin)
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g HomeTest.java
- *  @run driver HomeTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g HomeTest.java
+ * @run driver HomeTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.connect.*;
--- a/jdk/test/com/sun/jdi/ImmutableResourceTest.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ImmutableResourceTest.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -21,13 +21,15 @@
 # questions.
 #
 
-#   @test
-#   @bug        6287579
-#   @summary    SubClasses of ListResourceBundle should fix getContents()
-#   @author     Tim Bell
 #
-#   @run shell ImmutableResourceTest.sh
+# @test
+# @bug        6287579
+# @summary    SubClasses of ListResourceBundle should fix getContents()
+# @author     Tim Bell
 #
+# @modules jdk.jdi/com.sun.tools.example.debug.tty
+#
+# @run shell ImmutableResourceTest.sh
 #
 
 # Beginning of subroutines:
--- a/jdk/test/com/sun/jdi/InstanceFilter.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/InstanceFilter.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4312961
- *  @summary Verify that an instance filter on a MethodEntryRequest works
- *   properly.
+ * @test
+ * @bug 4312961
+ * @summary Verify that an instance filter on a MethodEntryRequest works
+ *  properly.
+ * @author Robert Field/Jim Holmlund
  *
- *  @author Robert Field/Jim Holmlund
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetAdapter TargetListener
- *  @run compile -g InstanceFilter.java
- *  @run driver InstanceFilter
+ * @run build TestScaffold VMConnection TargetAdapter TargetListener
+ * @run compile -g InstanceFilter.java
+ * @run driver InstanceFilter
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/InstancesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/InstancesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,15 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 5024119
- *  @summary Add ReferenceType.getAllInstances () method to JDI.
- *  @author jjh
+ * @test
+ * @bug 5024119
+ * @summary Add ReferenceType.getAllInstances () method to JDI.
+ * @author jjh
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g InstancesTest.java
- *  @run driver InstancesTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g InstancesTest.java
+ * @run driver InstancesTest
  */
 
 /*
--- a/jdk/test/com/sun/jdi/InterfaceMethodsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/InterfaceMethodsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 8031195
- *  @bug 8071657
- *  @bug 8165827
- *  @summary  JDI: Add support for static, private and default methods in interfaces
+ * @test
+ * @bug 8031195
+ * @bug 8071657
+ * @bug 8165827
+ * @summary  JDI: Add support for static, private and default methods in interfaces
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run build InterfaceMethodsTest
- *  @run driver InterfaceMethodsTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run build InterfaceMethodsTest
+ * @run driver InterfaceMethodsTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/InterruptHangTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/InterruptHangTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,16 +26,14 @@
 import com.sun.jdi.request.*;
 
 /**
- *  @test
- *  @bug 6459476
- *  @summary Debuggee is blocked,  looks like running
+ * @test
+ * @bug 6459476
+ * @summary Debuggee is blocked,  looks like running
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g InterruptHangTest.java
- *  @run driver InterruptHangTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g InterruptHangTest.java
+ * @run driver InterruptHangTest
  */
 
 /**
--- a/jdk/test/com/sun/jdi/InvokeHangTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/InvokeHangTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,18 @@
  */
 
 /**
- *  @test
- *  @bug 6293795
- *  @summary  Backend hangs when invokeMethod is called from a JDI eventHandler
- *
- *  @author jjh
+ * @test
+ * @bug 6293795
+ * @summary  Backend hangs when invokeMethod is called from a JDI eventHandler
+ * @author jjh
  *
- *  @modules jdk.jdi
- *  @library /test/lib
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g InvokeHangTest.java
- *  @run driver InvokeHangTest
+ * @library /test/lib
+ * @modules java.management
+ *          jdk.jdi
+ *
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g InvokeHangTest.java
+ * @run driver InvokeHangTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/InvokeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/InvokeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 4451941 4527072
- *  @summary Test argument types for invoke
- *
- *  @author Robert Field
+ * @test
+ * @bug 4451941 4527072
+ * @summary Test argument types for invoke
+ * @author Robert Field
  *
- *  @library ..
- *  @modules jdk.jdi
- *  @run build  TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g InvokeTest.java
- *  @run driver InvokeTest
+ * @library ..
+ *
+ * @run build  TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g InvokeTest.java
+ * @run driver InvokeTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/JITDebug.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/JITDebug.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -24,17 +24,16 @@
 #
 
 #
-#   @test       JITDebug.sh 1.7 03/09/05
-#   @bug        4291701 4376819 4422312 4522770 4913748
-#   @summary    Test JIT debugging - assure that launching on
-#               uncaught exception works
-#   @author     Tim Bell
-#   Based on test/java/awt/TEMPLATE/AutomaticShellTest.sh
+# @test       JITDebug.sh 1.7 03/09/05
+# @bug        4291701 4376819 4422312 4522770 4913748
+# @summary    Test JIT debugging - assure that launching on
+#             uncaught exception works
+# @author     Tim Bell
+# Based on test/java/awt/TEMPLATE/AutomaticShellTest.sh
 #
-#   @modules jdk.jdi
-#   @run build TestScaffold VMConnection TargetListener TargetAdapter
-#   @run compile -g JITDebug.java
-#   @run shell JITDebug.sh
+# @run build TestScaffold VMConnection TargetListener TargetAdapter
+# @run compile -g JITDebug.java
+# @run shell JITDebug.sh
 
 # Beginning of subroutines:
 status=1
--- a/jdk/test/com/sun/jdi/Java_gTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/Java_gTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4500906 4433599 4740097
- *  @summary vmexec= debug java fails for SunCommandLineLauncher
+ * @test
+ * @bug 4500906 4433599 4740097
+ * @summary vmexec= debug java fails for SunCommandLineLauncher
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g Java_gTest.java
- *  @run driver Java_gTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g Java_gTest.java
+ * @run driver Java_gTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/LambdaBreakpointTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/LambdaBreakpointTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,19 +21,18 @@
  * questions.
  */
 
-/********** LINE NUMBER SENSITIVE! *****************************************************************/
+//    THIS TEST IS LINE NUMBER SENSITIVE
 
 /**
- *  @test
- *  @summary Test setting breakpoints on lambda calls
- *
- *  @author Staffan Larsen
+ * @test
+ * @summary Test setting breakpoints on lambda calls
+ * @author Staffan Larsen
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g LambdaBreakpointTest.java
- *  @run driver LambdaBreakpointTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g LambdaBreakpointTest.java
+ * @run driver LambdaBreakpointTest
  */
+
 import java.util.List;
 
 import com.sun.jdi.LocalVariable;
@@ -50,22 +49,17 @@
  /********** target program **********/
 
 class LambdaBreakpointTestTarg {
-
-    static int[] breakpointLines = {
-            63, 67, 64, 65, 66, 68
-    };
-
     public static void main(String[] args) {
         test();
     }
 
     private static void test() {
-        Runnable r = () -> {                          // B1: L62
-            String from = "lambda";                   // B3: L63
-            System.out.println("Hello from " + from); // B4: L64
-        };                                            // B5: L65
-        r.run();                                      // B2: L66
-        System.out.println("Goodbye.");               // B6: L67
+        Runnable r = () -> {                          // LambdaBreakpointTest::TEST_LINE_1, BKPT_LINES[0]
+            String from = "lambda";                   // LambdaBreakpointTest::TEST_LINE_2, BKPT_LINES[2]
+            System.out.println("Hello from " + from); // LambdaBreakpointTest::TEST_LINE_3, BKPT_LINES[3]
+        };                                            // LambdaBreakpointTest::TEST_LINE_4, BKPT_LINES[4]
+        r.run();                                      // LambdaBreakpointTest::TEST_LINE_5, BKPT_LINES[1]
+        System.out.println("Goodbye.");               // LambdaBreakpointTest::TEST_LINE_6, BKPT_LINES[5]
     }
 }
 
@@ -73,6 +67,21 @@
  /********** test program **********/
 
 public class LambdaBreakpointTest extends TestScaffold {
+    private static final int TEST_LINE_1 = 57;
+    private static final int TEST_LINE_2 = TEST_LINE_1 + 1;
+    private static final int TEST_LINE_3 = TEST_LINE_1 + 2;
+    private static final int TEST_LINE_4 = TEST_LINE_1 + 3;
+    private static final int TEST_LINE_5 = TEST_LINE_1 + 4;
+    private static final int TEST_LINE_6 = TEST_LINE_1 + 5;
+
+    private static final int[] BKPT_LINES = {
+        TEST_LINE_1,
+        TEST_LINE_5,
+        TEST_LINE_2,
+        TEST_LINE_3,
+        TEST_LINE_4,
+        TEST_LINE_6,
+    };
 
     LambdaBreakpointTest (String args[]) {
         super(args);
@@ -92,7 +101,7 @@
         startToMain("LambdaBreakpointTestTarg");
 
         // Put a breakpoint on each location in the order they should happen
-        for (int line : LambdaBreakpointTestTarg.breakpointLines) {
+        for (int line : BKPT_LINES) {
             System.out.println("Running to line: " + line);
             BreakpointEvent be = resumeTo("LambdaBreakpointTestTarg", line);
             int stoppedAt = be.location().lineNumber();
--- a/jdk/test/com/sun/jdi/LambdaStepTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/LambdaStepTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,15 +22,13 @@
  */
 
 /**
- *  @test
- *  @summary Test stepping through lambdas
- *
- *  @author Staffan Larsen
+ * @test
+ * @summary Test stepping through lambdas
+ * @author Staffan Larsen
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g LambdaStepTest.java
- *  @run driver LambdaStepTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g LambdaStepTest.java
+ * @run driver LambdaStepTest
  */
 import com.sun.jdi.LocalVariable;
 import com.sun.jdi.ObjectReference;
--- a/jdk/test/com/sun/jdi/LaunchCommandLine.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/LaunchCommandLine.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 4245011
- *  @summary Test launcher command line construction
- *  @author Gordon Hirsch
+ * @test
+ * @bug 4245011
+ * @summary Test launcher command line construction
+ * @author Gordon Hirsch
  *
- *  @modules jdk.jdi
- *  @run build JDIScaffold VMConnection
- *  @run compile -g HelloWorld.java
- *  @run build LaunchCommandLine
+ * @run build JDIScaffold VMConnection
+ * @run compile -g HelloWorld.java
+ * @run build LaunchCommandLine
  *
- *  @run driver LaunchCommandLine
+ * @run driver LaunchCommandLine
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/LineNumberInfo.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/LineNumberInfo.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  *  @summary Test javac regressions in the generation of line number info
  *  @author Gordon Hirsch
  *
- *  @modules jdk.jdi
  *  @run build TestScaffold VMConnection TargetListener TargetAdapter
  *  @run compile -XDstringConcat=inline -g LineNumberInfo.java ControlFlow.java
  *
--- a/jdk/test/com/sun/jdi/LineNumberOnBraceTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/LineNumberOnBraceTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,13 +1,37 @@
-/**
- *  @test/nodynamiccopyright/
- *  @bug 4952629 4870514
- *  @summary REGRESSION: javac generates a spurious line number entry on } else {
+/*
+ * 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
+ * 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).
  *
- *  @author jjh
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- *  @run build VMConnection TargetListener TargetAdapter
- *  @run compile -g LineNumberOnBraceTest.java
- *  @run driver LineNumberOnBraceTest
+ * Please 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 TEST IS LINE NUMBER SENSITIVE
+
+/**
+ * @test
+ * @bug 4952629 4870514
+ * @summary REGRESSION: javac generates a spurious line number entry on } else {
+ * @author jjh
+ *
+ * @run build VMConnection TargetListener TargetAdapter
+ * @run compile -g LineNumberOnBraceTest.java
+ * @run driver LineNumberOnBraceTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
@@ -15,29 +39,27 @@
 
 import java.util.*;
 
-    /********** LINE NUMBER SENSITIVE! *****************************************************************/
 class LineNumberOnBraceTarg {
 
-    public final static int stopLine = 29;   // THIS MUST BE THE LINE NUMBER OF THE // stopline LINE
-    public final static int stopLine2 = 35;  // THIS MUST BE THE LINE NUMBER OF THE // stopline2 LINE
-
+    public final static int STOP_LINE = 50;    // THIS MUST BE THE LINE NUMBER OF // STOP_LINE LINE
+    public final static int STOP_LINE_2 = 56;  // THIS MUST BE THE LINE NUMBER OF // STOP_LINE_2 LINE
 
     public static void main(String[] args){
         System.out.println("Howdy!");
         if (args.length == 0) {
-            System.out.println("No args to debuggee");             // stopLine
+            System.out.println("No args to debuggee");             // STOP_LINE
         } else {
             System.out.println("Some args to debuggee");
         }
-        if (args.length == 0) {
+        if (args.length == 0) {                                    // STOP_LINE + 4
             boolean b1 = false;
-            if (b1) {                                              // stopLine2
+            if (b1) {                                              // STOP_LINE_2
                 System.out.println("In 2nd else");                 // bug 4870514 is that we stop here.
             }
         } else {
             System.out.println("In 2nd else");
         }
-        System.out.println("Goodbye from LineNumberOnBraceTarg!");  // stopLine2 + 6
+        System.out.println("Goodbye from LineNumberOnBraceTarg!");
     }
 
     // This isn't part of the test; it is just here
@@ -78,7 +100,7 @@
         targetClass = bpe.location().declaringType();
         mainThread = bpe.thread();
 
-        resumeTo("LineNumberOnBraceTarg", LineNumberOnBraceTarg.stopLine);
+        resumeTo("LineNumberOnBraceTarg", LineNumberOnBraceTarg.STOP_LINE);
         StepEvent stepev = stepOverLine(mainThread);       // step to 2nd if (args.length
 
         // Bug 4952629 is that javac outputs a line number
@@ -87,24 +109,23 @@
 
         int ln = stepev.location().lineNumber();
         System.out.println("Debuggee is stopped at line " + ln);
-        if (ln != LineNumberOnBraceTarg.stopLine + 4) {
+        if (ln != LineNumberOnBraceTarg.STOP_LINE + 4) {
             failure("FAIL: Bug 4952629: Should be at line " +
-                    (LineNumberOnBraceTarg.stopLine + 4) +
+                    (LineNumberOnBraceTarg.STOP_LINE + 4) +
                     ", am at " + ln);
         } else {
             System.out.println("Passed test for 4952629");
         }
 
         // Test for bug 4870514
-        System.out.println("Resuming to " + LineNumberOnBraceTarg.stopLine2);
-        resumeTo("LineNumberOnBraceTarg", LineNumberOnBraceTarg.stopLine2);
-        System.out.println("Stopped at " + LineNumberOnBraceTarg.stopLine2);
+        System.out.println("Resuming to " + LineNumberOnBraceTarg.STOP_LINE_2);
+        resumeTo("LineNumberOnBraceTarg", LineNumberOnBraceTarg.STOP_LINE_2);
+        System.out.println("Stopped at " + LineNumberOnBraceTarg.STOP_LINE_2);
         stepev = stepOverLine(mainThread);
         ln = stepev.location().lineNumber();
         System.out.println("Debuggee is stopped at line " + ln);
-        if (ln == LineNumberOnBraceTarg.stopLine2 + 1) {
-            failure("FAIL: bug 4870514: Incorrectly stopped at " +
-                    (LineNumberOnBraceTarg.stopLine2 + 1));
+        if (ln <= LineNumberOnBraceTarg.STOP_LINE_2 + 1) {
+            failure("FAIL: bug 4870514: Incorrectly stopped at " + ln);
         } else {
             System.out.println("Passed test for 4870514");
         }
--- a/jdk/test/com/sun/jdi/ListenAddress.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ListenAddress.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @summary Test that startListening(Map) method of the com.sun.jdi.SocketListen
  *          Connector returns an address that is usable for the address option on
  *          remove debuggees.
- * @modules jdk.jdi
  */
 import java.net.InetAddress;
 import java.net.Inet4Address;
--- a/jdk/test/com/sun/jdi/LocalVariableEqual.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/LocalVariableEqual.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4916263
- *  @summary Test
+ * @test
+ * @bug 4916263
+ * @summary Test
+ * @author Serguei Spitsyn
  *
- *  @author Serguei Spitsyn
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g LocalVariableEqual.java
- *  @run driver LocalVariableEqual
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g LocalVariableEqual.java
+ * @run driver LocalVariableEqual
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/LocationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/LocationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4419453
- *  @summary Test that Method.location() returns the right values
+ * @test
+ * @bug 4419453
+ * @summary Test that Method.location() returns the right values
+ * @author Robert Field
  *
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g LocationTest.java
- *  @run driver LocationTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g LocationTest.java
+ * @run driver LocationTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/MethodEntryExitEvents.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/MethodEntryExitEvents.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 4409241 4432820
- *  @summary Test the bug fix for: MethodExitEvents disappear when Object-Methods are called from main
- *  @author Tim Bell
+ * @test
+ * @bug 4409241 4432820
+ * @summary Test the bug fix for: MethodExitEvents disappear when Object-Methods are called from main
+ * @author Tim Bell
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g MethodEntryExitEvents.java
- *  @run driver MethodEntryExitEvents SUSPEND_EVENT_THREAD MethodEntryExitEventsDebugee
- *  @run driver MethodEntryExitEvents SUSPEND_NONE MethodEntryExitEventsDebugee
- *  @run driver MethodEntryExitEvents SUSPEND_ALL MethodEntryExitEventsDebugee
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g MethodEntryExitEvents.java
+ * @run driver MethodEntryExitEvents SUSPEND_EVENT_THREAD MethodEntryExitEventsDebugee
+ * @run driver MethodEntryExitEvents SUSPEND_NONE MethodEntryExitEventsDebugee
+ * @run driver MethodEntryExitEvents SUSPEND_ALL MethodEntryExitEventsDebugee
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/MethodExitReturnValuesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/MethodExitReturnValuesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,15 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4195445 6204179
- *  @summary JDWP, JDI: Add return value to Method Exit Event
- *  @author Jim Holmlund
+ * @test
+ * @bug 4195445 6204179
+ * @summary JDWP, JDI: Add return value to Method Exit Event
+ * @author Jim Holmlund
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g MethodExitReturnValuesTest.java
- *  @run driver MethodExitReturnValuesTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g MethodExitReturnValuesTest.java
+ * @run driver MethodExitReturnValuesTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/MixedSuspendTest.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/MixedSuspendTest.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -23,16 +23,14 @@
 # questions.
 #
 
-#  @test
-#  @bug 6224859
-#  @summary JDWP: Mixing application suspends and debugger suspends can cause hangs
-# 
-#  @author Jim Holmlund
-# 
-#  @key intermittent
-#  @modules jdk.jdi
-#  @run build TestScaffold VMConnection TargetListener TargetAdapter
-#  @run shell MixedSuspendTest.sh
+# @test
+# @bug 6224859
+# @key intermittent
+# @summary JDWP: Mixing application suspends and debugger suspends can cause hangs
+# @author Jim Holmlund
+#
+# @run build TestScaffold VMConnection TargetListener TargetAdapter
+# @run shell MixedSuspendTest.sh
 
 classname=MixedSuspendTarg
 
@@ -84,7 +82,7 @@
                 int i = 0;
             }
         }
-            
+
         System.out.println("Debuggee: end of thread");
     }
 
@@ -113,7 +111,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
--- a/jdk/test/com/sun/jdi/ModificationWatchpoints.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ModificationWatchpoints.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4409582
- *  @summary Test all info returned by modification watchpoints
+ * @test
+ * @bug 4409582
+ * @summary Test all info returned by modification watchpoints
+ * @author Daniel Prusa (or someone in the FFJ group)
+ * @author Robert Field (modified to JDIScaffold)
  *
- *  @author Daniel Prusa (or someone in the FFJ group)
- *  @author Robert Field (modified to JDIScaffold)
- *
- *  @modules jdk.jdi
- *  @run build JDIScaffold VMConnection
- *  @run compile -g ModificationWatchpoints.java
- *  @run driver ModificationWatchpoints
+ * @run build JDIScaffold VMConnection
+ * @run compile -g ModificationWatchpoints.java
+ * @run driver ModificationWatchpoints
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/ModulesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ModulesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,14 +22,13 @@
  */
 
 /**
- *  @test
- *  @bug 8049365
- *  @summary Tests the JDI and JDWP update for modules
+ * @test
+ * @bug 8049365
+ * @summary Tests the JDI and JDWP update for modules
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g ModulesTest.java
- *  @run driver ModulesTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g ModulesTest.java
+ * @run driver ModulesTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/MonitorEventTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/MonitorEventTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4401399
- *  @summary Simple basic test of jdi Monitor request and event.
+ * @test
+ * @bug 4401399
+ * @summary Simple basic test of jdi Monitor request and event.
+ * @author Swamy Venkataramanappa
  *
- *  @author Swamy Venkataramanappa
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g MonitorEventTest.java
- *  @run driver MonitorEventTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g MonitorEventTest.java
+ * @run driver MonitorEventTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/MonitorFrameInfo.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/MonitorFrameInfo.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 6230699
- *  @summary Test ThreadReference.ownedMonitorsAndFrames()
- *  @bug 6701700
- *  @summary MonitorInfo objects aren't invalidated when the owning thread is resumed
- *  @author Swamy Venkataramanappa
+ * @test
+ * @bug 6230699
+ * @summary Test ThreadReference.ownedMonitorsAndFrames()
+ * @bug 6701700
+ * @summary MonitorInfo objects aren't invalidated when the owning thread is resumed
+ * @author Swamy Venkataramanappa
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g MonitorFrameInfo.java
- *  @run driver MonitorFrameInfo
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g MonitorFrameInfo.java
+ * @run driver MonitorFrameInfo
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/MultiBreakpointsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/MultiBreakpointsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,16 +23,14 @@
 
 
 /**
- *  @test
- *  @bug 4359247
- *  @summary Breakpoints on multiple threads have problems.
+ * @test
+ * @bug 4359247
+ * @summary Breakpoints on multiple threads have problems.
+ * @author tbell, jjh
  *
- *  @author tbell, jjh
- *
- *  @modules jdk.jdi
- *  @build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g MultiBreakpointsTest.java
- *  @run driver MultiBreakpointsTest
+ * @build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g MultiBreakpointsTest.java
+ * @run driver MultiBreakpointsTest
  */
 
 /*
--- a/jdk/test/com/sun/jdi/NativeInstanceFilter.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/NativeInstanceFilter.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 6426034
- *  @summary Instance filter doesn't filter event if it occurs in native method
+ * @test
+ * @bug 6426034
+ * @summary Instance filter doesn't filter event if it occurs in native method
+ * @author Keith McGuigan
  *
- *  @author Keith McGuigan
- *
- *  @modules jdk.jdi
- *  @run build JDIScaffold VMConnection
- *  @compile -XDignore.symbol.file NativeInstanceFilterTarg.java
- *  @run driver NativeInstanceFilter
+ * @run build JDIScaffold VMConnection
+ * @compile -XDignore.symbol.file NativeInstanceFilterTarg.java
+ * @run driver NativeInstanceFilter
  */
 
 /*
--- a/jdk/test/com/sun/jdi/NewInstanceTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/NewInstanceTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4419450
- *  @summary Test newInstance() for arrays - currently covers
- *  only reference type arrays (see bug #4450091).
+ * @test
+ * @bug 4419450
+ * @summary Test newInstance() for arrays - currently covers
+ * only reference type arrays (see bug #4450091).
+ * @author Robert Field
  *
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g NewInstanceTest.java
- *  @run driver NewInstanceTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g NewInstanceTest.java
+ * @run driver NewInstanceTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/NoLaunchOptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/NoLaunchOptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,8 +30,9 @@
  * @bug        4554734 4724714
  * @summary    Test for -Xrunjdwp:[onthrow,onuncaught] suboptions require launch suboption
  * @author     Tim Bell
+ *
  * @library /lib/testlibrary
- * @modules jdk.jdi
+ *
  * @run compile -g NoLaunchOptionTest.java
  * @build jdk.testlibrary.* VMConnection
  * @run driver NoLaunchOptionTest
--- a/jdk/test/com/sun/jdi/NoLocInfoTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/NoLocInfoTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4642611
- *  @summary Test that method.allLineLocations() should
- *           throw AbsentInformationException exception
+ * @test
+ * @bug 4642611
+ * @summary Test that method.allLineLocations() should
+ *          throw AbsentInformationException exception
+ * @author Serguei Spitsyn
  *
- *  @author Serguei Spitsyn
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g:none NoLocInfoTest.java
- *  @run driver NoLocInfoTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g:none NoLocInfoTest.java
+ * @run driver NoLocInfoTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,13 +22,12 @@
  */
 
 /**
- *  @test
- *  @bug 7105883
- *  @summary Ensure that JDWP doesn't crash with a null thread group name
+ * @test
+ * @bug 7105883
+ * @summary Ensure that JDWP doesn't crash with a null thread group name
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run driver NullThreadGroupNameTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run driver NullThreadGroupNameTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.connect.*;
--- a/jdk/test/com/sun/jdi/OnThrowTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/OnThrowTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,15 @@
  */
 
 /*
- *   @test       OnThrowTest.java
- *   @bug        6263814
- *   @summary    Test for -agentlib::[onthrow,launch]
- *   @author     Kelly O'Hair
+ * @test       OnThrowTest.java
+ * @bug        6263814
+ * @summary    Test for -agentlib::[onthrow,launch]
+ * @author     Kelly O'Hair
  *
- *  @modules jdk.jdi
- *  @run compile -g OnThrowTest.java
- *  @run compile -g OnThrowTarget.java
- *  @run compile -g VMConnection.java
- *  @run driver OnThrowTest
+ * @run compile -g OnThrowTest.java
+ * @run compile -g OnThrowTarget.java
+ * @run compile -g VMConnection.java
+ * @run driver OnThrowTest
  */
 
 import java.io.File;
--- a/jdk/test/com/sun/jdi/OptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/OptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,15 @@
  */
 
 /*
- *   @test       OptionTest
- *   @bug        5095072
- *   @summary    Test for misc jdwp options, just that the option is parsed
- *   @author     Kelly O'Hair (copied from Tim Bell's NoLaunchOptionTest)
+ * @test       OptionTest
+ * @bug        5095072
+ * @summary    Test for misc jdwp options, just that the option is parsed
+ * @author     Kelly O'Hair (copied from Tim Bell's NoLaunchOptionTest)
  *
- *  @modules jdk.jdi
- *  @run compile -g OptionTest.java
- *  @run compile -g HelloWorld.java
- *  @run compile -g VMConnection.java
- *  @run driver OptionTest
+ * @run compile -g OptionTest.java
+ * @run compile -g HelloWorld.java
+ * @run compile -g VMConnection.java
+ * @run driver OptionTest
  */
 
 import java.net.ServerSocket;
--- a/jdk/test/com/sun/jdi/PopAndInvokeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/PopAndInvokeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 6517249
- *  @modules jdk.jdi
- *  @ignore 6951287
- *  @summary JDWP: Cannot do an invokeMethod after a popFrames operation
+ * @test
+ * @bug 6517249
+ * @summary JDWP: Cannot do an invokeMethod after a popFrames operation
+ * @author jjh
  *
- *  @author jjh
+ * @ignore 6951287
  *
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g PopAndInvokeTest.java
- *  @run driver PopAndInvokeTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g PopAndInvokeTest.java
+ * @run driver PopAndInvokeTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/PopAndStepTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/PopAndStepTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,17 +1,39 @@
-/* /nodynamiccopyright/ */  // DO NOT DELETE ANY LINES!!!!
-//    THIS TEST IS LINE NUMBER SENSITIVE
-/**
- *  @test
- *  @bug 4530424
- *  @summary Hin says that doing a step over after a popframe acts like a resume.
+/*
+ * 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
+ * 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.
  *
- *  @author jjh
+ * Please 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 TEST IS LINE NUMBER SENSITIVE
+
+/**
+ * @test
+ * @bug 4530424
+ * @summary Hin says that doing a step over after a popframe acts like a resume.
+ * @author jjh
  *
- *  @library ..
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g PopAndStepTest.java
- *  @run driver PopAndStepTest
+ * @library ..
+ *
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g PopAndStepTest.java
+ * @run driver PopAndStepTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
@@ -19,25 +41,23 @@
 
 import java.util.*;
 
-    /********** LINE NUMBER SENSITIVE! *****************************************************************/
-
 class PopAndStepTarg {
     public void B() {
-        System.out.println("debuggee: in B");
-        System.out.println("debuggee: in B, back to A");   // add line breakpoint here line 27 !!!
+        System.out.println("debuggee: in B");             // B_LINE_1
+        System.out.println("debuggee: in B, back to A");  // B_LINE_2
     }
 
     public void A() {
-        System.out.println("debuggee: in A, about to call B");  // line 31
-        B();
-        System.out.println("debuggee: in A, back from B");      // line 33
-        throw new RuntimeException("debuggee: Got to line 34");
+        System.out.println("debuggee: in A, about to call B");  // A_LINE_1
+        B();                                                    // A_LINE_2
+        System.out.println("debuggee: in A, back from B");      // A_LINE_3
+        throw new RuntimeException("debuggee: Got to line A_LINE_4:" + PopAndStepTest.A_LINE_4); // A_LINE_4
     }
 
     public static void main(String[] args) {
-        System.out.println("debuggee: Howdy!");      // line 38
-        PopAndStepTarg xxx = new PopAndStepTarg();   // line 40
-        xxx.A();                                     // line 41
+        System.out.println("debuggee: Howdy!");      // MAIN_LINE_1
+        PopAndStepTarg xxx = new PopAndStepTarg();   // MAIN_LINE_2
+        xxx.A();                                     // MAIN_LINE_3
         System.out.println("debugee: Goodbye from PopAndStepTarg!");
     }
 }
@@ -46,6 +66,18 @@
     /********** test program **********/
 
 public class PopAndStepTest extends TestScaffold {
+    static final int B_LINE_1 = 46;
+    static final int B_LINE_2 = B_LINE_1 + 1;
+
+    static final int A_LINE_1 = 51;
+    static final int A_LINE_2 = A_LINE_1 + 1;
+    static final int A_LINE_3 = A_LINE_1 + 2;
+    static final int A_LINE_4 = A_LINE_1 + 3;
+
+    static final int MAIN_LINE_1 = 58;
+    static final int MAIN_LINE_2 = MAIN_LINE_1 + 1;
+    static final int MAIN_LINE_3 = MAIN_LINE_1 + 2;
+
     ReferenceType targetClass;
     ThreadReference mainThread;
 
@@ -116,10 +148,10 @@
         BreakpointEvent bpe = startToMain("PopAndStepTarg");
         targetClass = bpe.location().declaringType();
         mainThread = bpe.thread();
-        getDebuggeeLineNum(38);
+        getDebuggeeLineNum(MAIN_LINE_1);
 
-        println("Resuming to line 27");
-        bpe = resumeTo("PopAndStepTarg", 27); getDebuggeeLineNum(27);
+        println("Resuming to line B_LINE_2 : " + B_LINE_2);
+        bpe = resumeTo("PopAndStepTarg", B_LINE_2); getDebuggeeLineNum(B_LINE_2);
 
         // The failure is this:
         //   create step request
@@ -141,21 +173,21 @@
         srInto.enable(); // This fails
         mainThread.popFrames(frameFor("A"));
         //srInto.enable();   // if the enable is moved here, it passes
-        println("Popped back to line 41 in main, the call to A()");
-        println("Stepping into line 31");
-        waitForRequestedEvent(srInto);   // println
+        println("Popped back to line MAIN_LINE_3(" + MAIN_LINE_3 + ") in main, the call to A()");
+        println("Stepping into line A_LINE_1:" + A_LINE_1);
+        waitForRequestedEvent(srInto);  // println
         srInto.disable();
 
-        getDebuggeeLineNum(31);
+        getDebuggeeLineNum(A_LINE_1);
 
         // The failure occurs here.
-        println("Stepping over to line 32");
-        stepOverLine(mainThread);   // println
-        getDebuggeeLineNum(32);
+        println("Stepping over to line A_LINE_2:" + A_LINE_2);
+        stepOverLine(mainThread);       // println
+        getDebuggeeLineNum(A_LINE_2);
 
-        println("Stepping over to line 33");
-        stepOverLine(mainThread);        // call to B()
-        getDebuggeeLineNum(33);
+        println("Stepping over to line A_LINE_3:" + A_LINE_3);
+        stepOverLine(mainThread);       // call to B()
+        getDebuggeeLineNum(A_LINE_3);
 
         vm().exit(0);
 
--- a/jdk/test/com/sun/jdi/PopAsynchronousTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/PopAsynchronousTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4467564
- *  @summary Test the popping of frames in an asynchronous context
- *           (that is, when suspended by the debugger at random points)
+ * @test
+ * @bug 4467564
+ * @summary Test the popping of frames in an asynchronous context
+ *          (that is, when suspended by the debugger at random points)
+ * @author Robert Field
  *
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g PopAsynchronousTest.java
- *  @run driver PopAsynchronousTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g PopAsynchronousTest.java
+ * @run driver PopAsynchronousTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/PopSynchronousTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/PopSynchronousTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4467564
- *  @summary Test the popping of frames in synchronous context
- *           (that is, when stopped at an event)
+ * @test
+ * @bug 4467564
+ * @summary Test the popping of frames in synchronous context
+ *          (that is, when stopped at an event)
+ * @author Robert Field
  *
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g PopSynchronousTest.java
- *  @run driver PopSynchronousTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g PopSynchronousTest.java
+ * @run driver PopSynchronousTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/RedefineCrossEvent.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/RedefineCrossEvent.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,52 +22,52 @@
  */
 
 /**
- *  @test
- *  @bug 4628726
- *  @summary Test class redefinition at each event cross tested with other tests
+ * @test
+ * @bug 4628726
+ * @summary Test class redefinition at each event cross tested with other tests
+ * @author Robert Field
  *
- *  @author Robert Field
+ * @modules java.corba
+ *          jdk.jdi
  *
- *  @modules java.corba
- *           jdk.jdi
- *  @run build TestScaffold VMConnection TargetAdapter TargetListener
- *  @run compile -g AccessSpecifierTest.java
- *  @run compile -g AfterThreadDeathTest.java
- *  @run compile -g ArrayRangeTest.java
- *  @run compile -g BacktraceFieldTest.java
- *  @run compile -g ClassesByName2Test.java
- *  @run compile -g DebuggerThreadTest.java
- *  @run compile -g DeleteEventRequestsTest.java
- *  @run compile -g ExceptionEvents.java
- *  @run compile -g ExpiredRequestDeletionTest.java
- *  @run compile -g FieldWatchpoints.java
- *  @run build InstanceFilter
- *  @run compile -g LocationTest.java
- *  @run compile -g NewInstanceTest.java
- *  @run compile -g PopSynchronousTest.java
- *  @run compile -g RepStepTarg.java
- *  @run compile -g RequestReflectionTest.java
+ * @run build TestScaffold VMConnection TargetAdapter TargetListener
+ * @run compile -g AccessSpecifierTest.java
+ * @run compile -g AfterThreadDeathTest.java
+ * @run compile -g ArrayRangeTest.java
+ * @run compile -g BacktraceFieldTest.java
+ * @run compile -g ClassesByName2Test.java
+ * @run compile -g DebuggerThreadTest.java
+ * @run compile -g DeleteEventRequestsTest.java
+ * @run compile -g ExceptionEvents.java
+ * @run compile -g ExpiredRequestDeletionTest.java
+ * @run compile -g FieldWatchpoints.java
+ * @run build InstanceFilter
+ * @run compile -g LocationTest.java
+ * @run compile -g NewInstanceTest.java
+ * @run compile -g PopSynchronousTest.java
+ * @run compile -g RepStepTarg.java
+ * @run compile -g RequestReflectionTest.java
  *
- *  @run driver AccessSpecifierTest -redefstart -redefevent
- *  @run driver AfterThreadDeathTest -redefstart -redefevent
- *  @run driver ArrayRangeTest -redefstart -redefevent
- *  @run driver BacktraceFieldTest -redefstart -redefevent
- *  @run driver ClassesByName2Test -redefstart -redefevent
- *  @run driver DebuggerThreadTest -redefstart -redefevent
- *  @run driver DeleteEventRequestsTest -redefstart -redefevent
- *  @run driver ExceptionEvents -redefstart -redefevent N A StackOverflowCaughtTarg java.lang.Exception
- *  @run driver ExceptionEvents -redefstart -redefevent C A StackOverflowCaughtTarg null
- *  @run driver ExceptionEvents -redefstart -redefevent C A StackOverflowCaughtTarg java.lang.StackOverflowError
- *  @run driver ExceptionEvents -redefstart -redefevent N A StackOverflowCaughtTarg java.lang.NullPointerException
- *  @run driver ExceptionEvents -redefstart -redefevent C T StackOverflowCaughtTarg java.lang.Error
- *  @run driver ExceptionEvents -redefstart -redefevent N T StackOverflowCaughtTarg java.lang.NullPointerException
- *  @run driver ExceptionEvents -redefstart -redefevent N N StackOverflowCaughtTarg java.lang.Exception
- *  @run driver ExceptionEvents -redefstart -redefevent C N StackOverflowCaughtTarg java.lang.Error
- *  @run driver ExceptionEvents -redefstart -redefevent N A StackOverflowUncaughtTarg java.lang.Exception
- *  @run driver ExpiredRequestDeletionTest -redefstart -redefevent
- *  @run driver FieldWatchpoints -redefstart -redefevent
- *  @run driver InstanceFilter -redefstart -redefevent
- *  @run driver LocationTest -redefstart -redefevent
- *  @run driver NewInstanceTest -redefstart -redefevent
- *  @run driver RequestReflectionTest -redefstart -redefevent
+ * @run driver AccessSpecifierTest -redefstart -redefevent
+ * @run driver AfterThreadDeathTest -redefstart -redefevent
+ * @run driver ArrayRangeTest -redefstart -redefevent
+ * @run driver BacktraceFieldTest -redefstart -redefevent
+ * @run driver ClassesByName2Test -redefstart -redefevent
+ * @run driver DebuggerThreadTest -redefstart -redefevent
+ * @run driver DeleteEventRequestsTest -redefstart -redefevent
+ * @run driver ExceptionEvents -redefstart -redefevent N A StackOverflowCaughtTarg java.lang.Exception
+ * @run driver ExceptionEvents -redefstart -redefevent C A StackOverflowCaughtTarg null
+ * @run driver ExceptionEvents -redefstart -redefevent C A StackOverflowCaughtTarg java.lang.StackOverflowError
+ * @run driver ExceptionEvents -redefstart -redefevent N A StackOverflowCaughtTarg java.lang.NullPointerException
+ * @run driver ExceptionEvents -redefstart -redefevent C T StackOverflowCaughtTarg java.lang.Error
+ * @run driver ExceptionEvents -redefstart -redefevent N T StackOverflowCaughtTarg java.lang.NullPointerException
+ * @run driver ExceptionEvents -redefstart -redefevent N N StackOverflowCaughtTarg java.lang.Exception
+ * @run driver ExceptionEvents -redefstart -redefevent C N StackOverflowCaughtTarg java.lang.Error
+ * @run driver ExceptionEvents -redefstart -redefevent N A StackOverflowUncaughtTarg java.lang.Exception
+ * @run driver ExpiredRequestDeletionTest -redefstart -redefevent
+ * @run driver FieldWatchpoints -redefstart -redefevent
+ * @run driver InstanceFilter -redefstart -redefevent
+ * @run driver LocationTest -redefstart -redefevent
+ * @run driver NewInstanceTest -redefstart -redefevent
+ * @run driver RequestReflectionTest -redefstart -redefevent
  */
--- a/jdk/test/com/sun/jdi/RedefineCrossStart.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/RedefineCrossStart.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,29 +22,28 @@
  */
 
 /**
- *  @test
- *  @bug 4628726
- *  @summary Test class redefinition at start only (they use breakpoint
- *  or resumeTo()) cross tested with other tests.
- *  ExceptionEvents/StackOverflowUncaughtTarg are here because they hit
- *  an unrelated crash in event testing.
+ * @test
+ * @bug 4628726
+ * @summary Test class redefinition at start only (they use breakpoint
+ * or resumeTo()) cross tested with other tests.
+ * ExceptionEvents/StackOverflowUncaughtTarg are here because they hit
+ * an unrelated crash in event testing.
  *
- *  @author Robert Field
+ * @author Robert Field
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g CountEvent.java
- *  @run compile -g CountFilterTest.java
- *  @run compile -g FramesTest.java
- *  @run compile -g InvokeTest.java
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g CountEvent.java
+ * @run compile -g CountFilterTest.java
+ * @run compile -g FramesTest.java
+ * @run compile -g InvokeTest.java
  *
- *  @run driver CountEvent -redefstart
- *  @run driver CountFilterTest -redefstart
- *  @run driver FramesTest -redefstart
- *  @run driver InvokeTest -redefstart
+ * @run driver CountEvent -redefstart
+ * @run driver CountFilterTest -redefstart
+ * @run driver FramesTest -redefstart
+ * @run driver InvokeTest -redefstart
  *
- *  @run driver ExceptionEvents -redefstart U A StackOverflowUncaughtTarg null
- *  @run driver ExceptionEvents -redefstart U A StackOverflowUncaughtTarg java.lang.Error
- *  @run driver ExceptionEvents -redefstart U A StackOverflowUncaughtTarg java.lang.StackOverflowError
- *  @run driver PopSynchronousTest -redefstart
+ * @run driver ExceptionEvents -redefstart U A StackOverflowUncaughtTarg null
+ * @run driver ExceptionEvents -redefstart U A StackOverflowUncaughtTarg java.lang.Error
+ * @run driver ExceptionEvents -redefstart U A StackOverflowUncaughtTarg java.lang.StackOverflowError
+ * @run driver PopSynchronousTest -redefstart
  */
--- a/jdk/test/com/sun/jdi/ReferrersTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ReferrersTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,15 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 5089849
- *  @summary Add support for backtracking reference graph.
- *  @author jjh
+ * @test
+ * @bug 5089849
+ * @summary Add support for backtracking reference graph.
+ * @author jjh
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g ReferrersTest.java
- *  @run driver ReferrersTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g ReferrersTest.java
+ * @run driver ReferrersTest
  */
 
 /*
--- a/jdk/test/com/sun/jdi/RepStep.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/RepStep.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,18 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 4334008
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run compile -g RepStepTarg.java
- *  @run build VMConnection RepStep
- *
- *  @run driver RepStep
- *
+ * @test
+ * @bug 4334008
  * @summary RepStep detects missed step events due to lack of
  * frame pop events (in back-end).
+ * @author Robert Field
+ *
+ * @run compile -g RepStepTarg.java
+ * @run build VMConnection RepStep
+ *
+ * @run driver RepStep
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/RequestReflectionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/RequestReflectionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4425840
- *  @author Robert Field
+ * @test
+ * @bug 4425840
+ * @summary RequestReflectionTest checks to see that reflective
+ * accessors on EventRequests return what they are given.
+ * @author Robert Field
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g RequestReflectionTest.java
- *  @run driver RequestReflectionTest
- *
- *  @summary RequestReflectionTest checks to see that reflective
- *  accessors on EventRequests return what they are given.
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g RequestReflectionTest.java
+ * @run driver RequestReflectionTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/ResumeOneThreadTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ResumeOneThreadTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 6700889
- *  @summary  Thread resume invalidates all stack frames, even from other threads
+ * @test
+ * @bug 6700889
+ * @summary  Thread resume invalidates all stack frames, even from other threads
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g ResumeOneThreadTest.java
- *  @run driver ResumeOneThreadTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g ResumeOneThreadTest.java
+ * @run driver ResumeOneThreadTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/SDENullTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/SDENullTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4621289
- *  @summary vm.setDefaultStratum(null) causes a Null Ptr exception
+ * @test
+ * @bug 4621289
+ * @summary vm.setDefaultStratum(null) causes a Null Ptr exception
  *
- *  @author jjh
+ * @author jjh
  *
- *  @modules jdk.jdi
- *  @run build  TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g SDENullTest.java
- *  @run driver SDENullTest
+ * @run build  TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g SDENullTest.java
+ * @run driver SDENullTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/SimulResumerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/SimulResumerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 6751643
- *  @summary  ThreadReference.ownedMonitors() can return null
- *
- *  @author jjh
+ * @test
+ * @bug 6751643
+ * @key intermittent
+ * @summary ThreadReference.ownedMonitors() can return null
+ * @author jjh
  *
- *  @key intermittent
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g SimulResumerTest.java
- *  @run driver SimulResumerTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g SimulResumerTest.java
+ * @run driver SimulResumerTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/SourceNameFilterTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/SourceNameFilterTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,18 +22,16 @@
  */
 
 /**
- *  @test
- *  @bug 4836939 6646613
- *  @summary JDI add addSourceNameFilter to ClassPrepareRequest
- *
- *  @author jjh
+ * @test
+ * @bug 4836939 6646613
+ * @summary JDI add addSourceNameFilter to ClassPrepareRequest
+ * @author jjh
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g SourceNameFilterTest.java
- *  @run driver SourceNameFilterTest
- *  @run compile -g:none SourceNameFilterTest.java
- *  @run driver SourceNameFilterTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g SourceNameFilterTest.java
+ * @run driver SourceNameFilterTest
+ * @run compile -g:none SourceNameFilterTest.java
+ * @run driver SourceNameFilterTest
  */
 // The compile -g:none suppresses the lineNumber table to trigger bug 6646613.
 
--- a/jdk/test/com/sun/jdi/StepTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/StepTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4270488 4787861
- *  @author Gordon Hirsch
+ * @test
+ * @bug 4270488 4787861
+ * @author Gordon Hirsch
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetAdapter TargetListener
- *  @run compile -g MethodCalls.java
- *  @run compile -g MethodCallsReflection.java
- *  @run compile -g ControlFlow.java
- *  @run build StepTest
+ * @run build TestScaffold VMConnection TargetAdapter TargetListener
+ * @run compile -g MethodCalls.java
+ * @run compile -g MethodCallsReflection.java
+ * @run compile -g ControlFlow.java
+ * @run build StepTest
  *
  * @summary StepTest starts at a method named "go()" in the debuggee and
  * repetitively steps. It will do a step into until the maximum
@@ -46,21 +45,21 @@
  * for the debuggee files- MethodCalls.java, ...
  * See LineNumberInfo.java for more info.
  *
- *                     +--- maximum stack depth in debuggee
- *                     |  +--- step granularity: "line" or "min"
- *                     |  |    +---Expected number of steps
- *                     |  |    |  +--- Debuggee command Line
- *                     V  V    V  V      Workaround-----+
- *                                                      V
- *  @run driver StepTest 2 line  2 MethodCalls
- *  @run driver StepTest 3 line 14 MethodCalls
+ *                      +--- maximum stack depth in debuggee
+ *                      |  +--- step granularity: "line" or "min"
+ *                      |  |    +---Expected number of steps
+ *                      |  |    |  +--- Debuggee command Line
+ *                      V  V    V  V      Workaround-----+
+ *                                                       V
+ * @run driver StepTest 2 line  2 MethodCalls
+ * @run driver StepTest 3 line 14 MethodCalls
  *
- *  @run driver StepTest 2 line 18 MethodCallsReflection  12
+ * @run driver StepTest 2 line 18 MethodCallsReflection  12
  *
- *  @run driver StepTest 2 min   4 MethodCalls
- *  @run driver StepTest 3 min  43 MethodCalls
+ * @run driver StepTest 2 min   4 MethodCalls
+ * @run driver StepTest 3 min  43 MethodCalls
  *
- *  @run driver StepTest 2 line 65 ControlFlow            64
+ * @run driver StepTest 2 line 65 ControlFlow            64
  */
 
 /*
--- a/jdk/test/com/sun/jdi/SuspendThreadTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/SuspendThreadTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 6485605
- *  @summary com.sun.jdi.InternalException: Inconsistent suspend policy in internal event handler
+ * @test
+ * @bug 6485605
+ * @summary com.sun.jdi.InternalException: Inconsistent suspend policy in internal event handler
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g SuspendThreadTest.java
- *  @run driver SuspendThreadTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g SuspendThreadTest.java
+ * @run driver SuspendThreadTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = jdk.jdi
+
--- a/jdk/test/com/sun/jdi/TemplateTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/TemplateTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,16 +25,14 @@
 // TEMPLATE: change bug number and fill out <SUMMARY> and <AUTHOR>
 // TEMPLATE: delete TEMPLATE lines
 /**
- *  @test
- *  @bug 0000000
- *  @summary <SUMMARY>
+ * @test
+ * @bug 0000000
+ * @summary <SUMMARY>
+ * @author <AUTHOR>
  *
- *  @author <AUTHOR>
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g TemplateTest.java
- *  @run driver TemplateTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g TemplateTest.java
+ * @run driver TemplateTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/ThreadGroupTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/ThreadGroupTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4893530
- *  @summary If JDI is initially started from a thread group that is subsequently
- *           destroyed this should not impact subsequent thread creation by
- *           the virtual machine manager.
+ * @test
+ * @bug 4893530
+ * @summary If JDI is initially started from a thread group that is subsequently
+ *          destroyed this should not impact subsequent thread creation by
+ *          the virtual machine manager.
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile ThreadGroupTest.java
- *  @run driver ThreadGroupTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile ThreadGroupTest.java
+ * @run driver ThreadGroupTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.connect.*;
--- a/jdk/test/com/sun/jdi/TwoThreadsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/TwoThreadsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 6296125
- *  @summary  JDI: Disabling an EventRequest can cause a multi-threaded debuggee to hang
+ * @test
+ * @bug 6296125
+ * @summary  JDI: Disabling an EventRequest can cause a multi-threaded debuggee to hang
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g TwoThreadsTest.java
- *  @run driver TwoThreadsTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g TwoThreadsTest.java
+ * @run driver TwoThreadsTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/UTF8Test.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/UTF8Test.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 5033550
- *  @summary  JDWP back end uses modified UTF-8
+ * @test
+ * @bug 5033550
+ * @summary  JDWP back end uses modified UTF-8
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g UTF8Test.java
- *  @run driver UTF8Test
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g UTF8Test.java
+ * @run driver UTF8Test
  */
 
 /*
--- a/jdk/test/com/sun/jdi/UnpreparedByName.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/UnpreparedByName.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,18 +22,17 @@
  */
 
 /**
- *  @test
- *  @bug 4368402
- *  @summary UnpreparedByName verifies that unprepared classes
- *  won't be returned by classesByName.
- *  @author Robert Field
+ * @test
+ * @bug 4368402
+ * @summary UnpreparedByName verifies that unprepared classes
+ * won't be returned by classesByName.
+ * @author Robert Field
  *
- *  @modules jdk.jdi
- *  @run build JDIScaffold VMConnection
- *  @run compile -g InnerTarg.java
- *  @run build UnpreparedByName
+ * @run build JDIScaffold VMConnection
+ * @run compile -g InnerTarg.java
+ * @run build UnpreparedByName
  *
- *  @run driver UnpreparedByName InnerTarg
+ * @run driver UnpreparedByName InnerTarg
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/UnpreparedClasses.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/UnpreparedClasses.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,18 +22,17 @@
  */
 
 /**
- *  @test
- *  @bug 4368402
- *  @summary UnpreparedClasses verifies that all the classes in the
- *  loaded class list are prepared classes.
- *  @author Robert Field
+ * @test
+ * @bug 4368402
+ * @summary UnpreparedClasses verifies that all the classes in the
+ * loaded class list are prepared classes.
+ * @author Robert Field
  *
- *  @modules jdk.jdi
- *  @run build JDIScaffold VMConnection
- *  @run compile -g InnerTarg.java
- *  @run build UnpreparedClasses
+ * @run build JDIScaffold VMConnection
+ * @run compile -g InnerTarg.java
+ * @run build UnpreparedClasses
  *
- *  @run driver UnpreparedClasses InnerTarg
+ * @run driver UnpreparedClasses InnerTarg
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/VMDeathLastTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/VMDeathLastTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,17 +22,15 @@
  */
 
 /**
- *  @test
- *  @bug 4420844 4449394
- *  @summary Checks that no events are sent after VMDeath, and test vm.canBeModified
- *
- *  @author Robert Field
+ * @test
+ * @bug 4420844 4449394
+ * @summary Checks that no events are sent after VMDeath, and test vm.canBeModified
+ * @author Robert Field
  *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g HelloWorld.java
- *  @run build VMDeathLastTest
- *  @run driver VMDeathLastTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g HelloWorld.java
+ * @run build VMDeathLastTest
+ * @run driver VMDeathLastTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/VMDeathRequestTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/VMDeathRequestTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,22 +22,20 @@
  */
 
 /**
- *  @test
- *  @bug 4419314
- *  @author Robert Field
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g HelloWorld.java
- *  @run build VMDeathRequestTest
- *  @run driver VMDeathRequestTest
- *
+ * @test
+ * @bug 4419314
  * @summary VMDeathRequestTest checks to see that
  * VMDisconnectedException is never thrown before VMDisconnectEvent.
  *
  * Failure mode for this test is throwing VMDisconnectedException
  * on vm.eventQueue().remove();
  * Does not use a scaffold since we don't want that hiding the exception.
+ * @author Robert Field
+ *
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g HelloWorld.java
+ * @run build VMDeathRequestTest
+ * @run driver VMDeathRequestTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/VarargsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/VarargsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @bug 4870984
- *  @summary  JPDA: Add support for RFE 4856541 - varargs
+ * @test
+ * @bug 4870984
+ * @summary  JPDA: Add support for RFE 4856541 - varargs
+ * @author jjh
  *
- *  @author jjh
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g VarargsTest.java
- *  @run driver VarargsTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g VarargsTest.java
+ * @run driver VarargsTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/Vars.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/Vars.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,15 +22,13 @@
  */
 
 /**
- *  @test
- *  @summary Test Method.variables() and the like.
- *
- *  @author Robert Field
+ * @test
+ * @summary Test Method.variables() and the like.
+ * @author Robert Field
  *
- *  @modules jdk.jdi
- *  @run build JDIScaffold VMConnection
- *  @run compile -g Vars.java
- *  @run driver Vars
+ * @run build JDIScaffold VMConnection
+ * @run compile -g Vars.java
+ * @run driver Vars
  */
 
 import com.sun.jdi.*;
--- a/jdk/test/com/sun/jdi/VisibleMethods.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/VisibleMethods.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,16 +22,14 @@
  */
 
 /**
- *  @test
- *  @summary Test ReferenceType.visibleMethods
- *  @bug 8028430
+ * @test
+ * @summary Test ReferenceType.visibleMethods
+ * @bug 8028430
+ * @author Staffan Larsen
  *
- *  @author Staffan Larsen
- *
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g VisibleMethods.java
- *  @run driver VisibleMethods
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g VisibleMethods.java
+ * @run driver VisibleMethods
  */
 import com.sun.jdi.Method;
 import com.sun.jdi.ReferenceType;
--- a/jdk/test/com/sun/jdi/connect/spi/GeneratedConnectors.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/connect/spi/GeneratedConnectors.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,7 +30,6 @@
  * to encapsulate the transport. This tests that the connectors are
  * created and that they have an "address" argument.
  *
- * @modules jdk.jdi/com.sun.tools.jdi
  * @build GeneratedConnectors NullTransportService SimpleLaunchingConnector
  * @run main/othervm GeneratedConnectors
  */
--- a/jdk/test/com/sun/jdi/redefine/RedefineTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/redefine/RedefineTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,20 +22,20 @@
  */
 
 /**
- *  @test
- *  @bug 4287595
- *  @bug 4462989
- *  @bug 4531511
- *  @summary Test class redefinition
+ * @test
+ * @bug 4287595
+ * @bug 4462989
+ * @bug 4531511
+ * @summary Test class redefinition
  *
- *  @author Robert Field
+ * @author Robert Field
+ *
+ * @library ..
  *
- *  @library ..
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g RedefineTest.java
- *  @run shell RedefineSetUp.sh
- *  @run driver RedefineTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g RedefineTest.java
+ * @run shell RedefineSetUp.sh
+ * @run driver RedefineTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/redefineMethod/RedefineTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/redefineMethod/RedefineTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,19 +22,18 @@
  */
 
 /**
- *  @test
- *  @bug 4628726
- *  @summary Test class redefinition - method data line numbers and local vars,
- *
- *  @author Robert Field
+ * @test
+ * @bug 4628726
+ * @summary Test class redefinition - method data line numbers and local vars,
+ * @author Robert Field
  *
- *  @library ..
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter
- *  @run compile -g RedefineTest.java
- *  @run shell RedefineSetUp.sh
- *  @run driver RedefineTest -repeat 3
- *  @run driver RedefineTest
+ * @library ..
+ *
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g RedefineTest.java
+ * @run shell RedefineSetUp.sh
+ * @run driver RedefineTest -repeat 3
+ * @run driver RedefineTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/sde/FilterMangleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/sde/FilterMangleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,31 +1,30 @@
 /**
- *  @test
- *  @bug 4836939
- *  @summary JDI add addSourceNameFilter to ClassPrepareRequest
+ * @test
+ * @bug 4836939
+ * @key intermittent
+ * @summary JDI add addSourceNameFilter to ClassPrepareRequest
+ * @author Robert Field / Jim Holmlund
  *
- *  @author Robert Field / Jim Holmlund
+ * @library ..
  *
- *  @key intermittent
- *  @library ..
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
- *  @run compile FilterMangleTest.java
- *  @run compile -g onion/pickle/Mangle.java
- *  @run driver FilterMangleTest
- *  @run driver FilterMangleTest SDE-pMangle.java*
- *  @run driver FilterMangleTest SDE-pMangle.jav*
- *  @run driver FilterMangleTest SDE-pMangle.j*
- *  @run driver FilterMangleTest SDE-p*Mangle.java
- *  @run driver FilterMangleTest SDE-p*angle.java
- *  @run driver FilterMangleTest SDE-p*java
- *  @run driver FilterMangleTest SDE-pMangle.xyz
- *  @run driver FilterMangleTest SDE-pIncl.rats*
- *  @run driver FilterMangleTest SDE-pIncl.rat*
- *  @run driver FilterMangleTest SDE-p*angle.rats
- *  @run driver FilterMangleTest SDE-f*Incl.rat
- *  @run driver FilterMangleTest SDE-ffred
- *  @run driver FilterMangleTest SDE-f*ratsx
- *  @run driver FilterMangleTest SDE-fMangle.javax*
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
+ * @run compile FilterMangleTest.java
+ * @run compile -g onion/pickle/Mangle.java
+ * @run driver FilterMangleTest
+ * @run driver FilterMangleTest SDE-pMangle.java*
+ * @run driver FilterMangleTest SDE-pMangle.jav*
+ * @run driver FilterMangleTest SDE-pMangle.j*
+ * @run driver FilterMangleTest SDE-p*Mangle.java
+ * @run driver FilterMangleTest SDE-p*angle.java
+ * @run driver FilterMangleTest SDE-p*java
+ * @run driver FilterMangleTest SDE-pMangle.xyz
+ * @run driver FilterMangleTest SDE-pIncl.rats*
+ * @run driver FilterMangleTest SDE-pIncl.rat*
+ * @run driver FilterMangleTest SDE-p*angle.rats
+ * @run driver FilterMangleTest SDE-f*Incl.rat
+ * @run driver FilterMangleTest SDE-ffred
+ * @run driver FilterMangleTest SDE-f*ratsx
+ * @run driver FilterMangleTest SDE-fMangle.javax*
  */
 
 /*
--- a/jdk/test/com/sun/jdi/sde/MangleStepTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/sde/MangleStepTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,21 +1,20 @@
 /**
- *  @test
- *  @bug 4390869
- *  @bug 4460328
- *  @summary Test Stepping in the new SourceDebugExtension facility
+ * @test
+ * @bug 4390869
+ * @bug 4460328
+ * @summary Test Stepping in the new SourceDebugExtension facility
+ * @author Robert Field
  *
- *  @author Robert Field
+ * @library ..
  *
- *  @library ..
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
- *  @run compile MangleStepTest.java
- *  @run compile -g  onion/pickle/Mangle.java
- *  @run driver MangleStepTest unset
- *  @run driver MangleStepTest Java
- *  @run driver MangleStepTest XYZ
- *  @run driver MangleStepTest Rats
- *  @run driver MangleStepTest bogus
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
+ * @run compile MangleStepTest.java
+ * @run compile -g  onion/pickle/Mangle.java
+ * @run driver MangleStepTest unset
+ * @run driver MangleStepTest Java
+ * @run driver MangleStepTest XYZ
+ * @run driver MangleStepTest Rats
+ * @run driver MangleStepTest bogus
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/sde/MangleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/sde/MangleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,17 +1,16 @@
 /**
- *  @test
- *  @bug 4390869
- *  @bug 4460328
- *  @summary Test the new SourceDebugExtension facility
+ * @test
+ * @bug 4390869
+ * @bug 4460328
+ * @summary Test the new SourceDebugExtension facility
+ * @author Robert Field
  *
- *  @author Robert Field
+ * @library ..
  *
- *  @library ..
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
- *  @run compile MangleTest.java
- *  @run compile -g onion/pickle/Mangle.java
- *  @run driver MangleTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
+ * @run compile MangleTest.java
+ * @run compile -g onion/pickle/Mangle.java
+ * @run driver MangleTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/sde/SourceDebugExtensionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/sde/SourceDebugExtensionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,17 +1,16 @@
 /**
- *  @test
- *  @bug 4390869
- *  @bug 4460328
- *  @summary Test the new SourceDebugExtension facility
+ * @test
+ * @bug 4390869
+ * @bug 4460328
+ * @summary Test the new SourceDebugExtension facility
+ * @author Robert Field
  *
- *  @author Robert Field
+ * @library ..
  *
- *  @library ..
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
- *  @run compile SourceDebugExtensionTest.java
- *  @run compile -g SourceDebugExtensionTarg.java
- *  @run driver SourceDebugExtensionTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
+ * @run compile SourceDebugExtensionTest.java
+ * @run compile -g SourceDebugExtensionTarg.java
+ * @run driver SourceDebugExtensionTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/sde/TemperatureTableTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/jdi/sde/TemperatureTableTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,17 +1,16 @@
 /**
- *  @test
- *  @bug 4390869
- *  @bug 4460328
- *  @summary Test the new SourceDebugExtension facility
+ * @test
+ * @bug 4390869
+ * @bug 4460328
+ * @summary Test the new SourceDebugExtension facility
+ * @author Robert Field
  *
- *  @author Robert Field
+ * @library ..
  *
- *  @library ..
- *  @modules jdk.jdi
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE HelloWorld
- *  @run compile TemperatureTableTest.java
- *  @run compile -g TemperatureTableServlet.java
- *  @run driver TemperatureTableTest
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE HelloWorld
+ * @run compile TemperatureTableTest.java
+ * @run compile -g TemperatureTableServlet.java
+ * @run driver TemperatureTableTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanDoubleInvocationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanDoubleInvocationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Basic Test for the DiagnosticCommandMBean
  * @author  Frederic Parain, Shanliang JIANG
  *
- * @modules jdk.management
  * @run main/othervm DcmdMBeanDoubleInvocationTest
  */
 
--- a/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanInvocationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanInvocationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Basic Test for the DiagnosticCommandMBean
  * @author  Frederic Parain, Shanliang JIANG
  *
- * @modules jdk.management
  * @run main/othervm DcmdMBeanInvocationTest
  */
 
--- a/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,9 @@
  * @summary Permissions Tests for the DiagnosticCommandMBean
  * @author  Frederic Parain
  *
- * @modules jdk.management
+ * @modules java.logging
+ *          java.management
+ *
  * @run main/othervm DcmdMBeanPermissionsTest
  */
 
--- a/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Basic Test for the DiagnosticCommandMBean
  * @author  Frederic Parain, Shanliang JIANG
  *
- * @modules jdk.management
  * @run main/othervm DcmdMBeanTest
  */
 
--- a/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Sanity Test for GarbageCollectorMXBean.getLastGcInfo().
  * @author  Mandy Chung
  *
- * @modules jdk.management
  * @run main/othervm -XX:-ExplicitGCInvokesConcurrent LastGCInfo
  */
 // Passing "-XX:-ExplicitGCInvokesConcurrent" to force System.gc()
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetDiagnosticOptions.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetDiagnosticOptions.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Basic Test for HotSpotDiagnosticMXBean.getDiagnosticOptions()
  * @author  Daniel Fuchs
  *
- * @modules jdk.management
  * @run main GetDiagnosticOptions
  */
 
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetDoubleVMOption.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetDoubleVMOption.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Basic Test for HotSpotDiagnosticMXBean.getVMOption() and double values
  * @author  Jaroslav Bachorik
  *
- * @modules jdk.management
  * @run main/othervm -XX:CompileThresholdScaling=0.14 GetDoubleVMOption
  */
 
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Basic Test for HotSpotDiagnosticMXBean.getVMOption()
  * @author  Mandy Chung
  *
- * @modules jdk.management
  * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError GetVMOption
  */
 
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetAllVMOptions.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetAllVMOptions.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Basic Test for HotSpotDiagnosticMXBean.setVMOption()
  * @author  Tomas Hurka, Daniel Fuchs
  *
- * @modules jdk.management
  * @run main SetAllVMOptions
  */
 
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,6 @@
  * @author  Mandy Chung
  * @author  Jaroslav Bachorik
  *
- * @modules jdk.management
  * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError SetVMOption
  */
 
--- a/jdk/test/com/sun/management/OperatingSystemMXBean/GetCommittedVirtualMemorySize.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/OperatingSystemMXBean/GetCommittedVirtualMemorySize.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     4858522 6191542
  * @summary Basic unit test of OperatingSystemMXBean.getCommittedVirtualMemorySize()
  * @author  Steve Bohne
- * @modules jdk.management
  */
 
 /*
--- a/jdk/test/com/sun/management/OperatingSystemMXBean/GetFreePhysicalMemorySize.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/OperatingSystemMXBean/GetFreePhysicalMemorySize.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     4858522
  * @summary Basic unit test of OperatingSystemMXBean.getFreePhysicalMemorySize()
  * @author  Steve Bohne
- * @modules jdk.management
  */
 
 /*
--- a/jdk/test/com/sun/management/OperatingSystemMXBean/GetFreeSwapSpaceSize.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/OperatingSystemMXBean/GetFreeSwapSpaceSize.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     4858522
  * @summary Basic unit test of OperatingSystemMXBean.getFreeSwapSpaceSize()
  * @author  Steve Bohne
- * @modules jdk.management
  */
 
 /*
--- a/jdk/test/com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     7028071
  * @summary Basic unit test of OperatingSystemMXBean.getProcessCpuLoad()
  *
- * @modules jdk.management
  * @run main GetProcessCpuLoad
  */
 
--- a/jdk/test/com/sun/management/OperatingSystemMXBean/GetProcessCpuTime.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/OperatingSystemMXBean/GetProcessCpuTime.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     4858522
  * @summary Basic unit test of OperatingSystemMXBean.getProcessCpuTime()
  * @author  Steve Bohne
- * @modules jdk.management
  */
 
 /*
--- a/jdk/test/com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     7028071
  * @summary Basic unit test of OperatingSystemMXBean.getProcessCpuLoad()
  *
- * @modules jdk.management
  * @run main GetSystemCpuLoad
  */
 
--- a/jdk/test/com/sun/management/OperatingSystemMXBean/GetTotalPhysicalMemorySize.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/OperatingSystemMXBean/GetTotalPhysicalMemorySize.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     4858522
  * @summary Basic unit test of OperatingSystemMXBean.getTotalPhysicalMemorySize()
  * @author  Steve Bohne
- * @modules jdk.management
  */
 
 /*
--- a/jdk/test/com/sun/management/OperatingSystemMXBean/MemoryStatusOverflow.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/OperatingSystemMXBean/MemoryStatusOverflow.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,6 @@
  *      the GlobalMemoryStatus function can return incorrect information,
  *      reporting a value of -1 to indicate an overflow.
  *
- * @modules jdk.management
  * @run main MemoryStatusOverflow
  */
 
--- a/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,14 +25,13 @@
  * @test
  * @bug     4858522
  * @summary Basic unit test of OperatingSystemMXBean.getTotalSwapSpaceSize()
+ * @author  Steve Bohne
+ * @author  Jaroslav Bachorik
  *
  * @library /lib/testlibrary
- * @modules jdk.management
+ *
  * @build TestTotalSwap jdk.testlibrary.*
  * @run main TestTotalSwap
- *
- * @author  Steve Bohne
- * @author  Jaroslav Bachorik
  */
 
 /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/management/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = jdk.management
+
--- a/jdk/test/com/sun/management/ThreadMXBean/ThreadAllocatedMemory.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/ThreadMXBean/ThreadAllocatedMemory.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     6173675
  * @summary Basic test of ThreadMXBean.getThreadAllocatedBytes
  * @author  Paul Hohensee
- * @modules jdk.management
  */
 
 import java.lang.management.*;
--- a/jdk/test/com/sun/management/ThreadMXBean/ThreadAllocatedMemoryArray.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/ThreadMXBean/ThreadAllocatedMemoryArray.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     6173675
  * @summary Basic test of ThreadMXBean.getThreadAllocatedBytes(long[])
  * @author  Paul Hohensee
- * @modules jdk.management
  */
 
 import java.lang.management.*;
--- a/jdk/test/com/sun/management/ThreadMXBean/ThreadCpuTimeArray.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/ThreadMXBean/ThreadCpuTimeArray.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,11 +24,10 @@
 /*
  * @test
  * @bug     6173675
+ * @key randomness
  * @summary Basic test of ThreadMXBean.getThreadCpuTime(long[]) and
  *          getThreadUserTime(long[]).
  * @author  Paul Hohensee
- * @key randomness
- * @modules jdk.management
  */
 
 import java.lang.management.*;
--- a/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetMaxFileDescriptorCount.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetMaxFileDescriptorCount.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -24,10 +24,9 @@
 #
 # @test
 # @bug     4858522
-# @summary 
+# @summary
 # @author  Steve Bohne
 #
-# @modules jdk.management
 # @run shell GetMaxFileDescriptorCount.sh
 #
 
@@ -40,7 +39,7 @@
 fi
 
 runOne()
-{ 
+{
    echo "runOne $@"
    $COMPILEJAVA/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d $TESTCLASSES \
        $TESTSRC/$@.java || exit 2
--- a/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetOpenFileDescriptorCount.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetOpenFileDescriptorCount.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -24,10 +24,9 @@
 #
 # @test
 # @bug     4858522
-# @summary 
+# @summary
 # @author  Steve Bohne
 #
-# @modules jdk.management
 # @run shell GetOpenFileDescriptorCount.sh
 #
 
@@ -39,7 +38,7 @@
     COMPILEJAVA="${TESTJAVA}"
 fi
 runOne()
-{ 
+{
    echo "runOne $@"
    $COMPILEJAVA/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d $TESTCLASSES \
        $TESTSRC/$@.java || exit 2
--- a/jdk/test/com/sun/management/VMOptionOpenDataTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/management/VMOptionOpenDataTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -38,7 +38,6 @@
  * @test
  * @bug     8042901
  * @summary Check that MappedMXBeanType.toOpenTypeData supports VMOption
- * @modules jdk.management/com.sun.management
  * @author  Shanliang Jiang
  */
 public class VMOptionOpenDataTest {
--- a/jdk/test/com/sun/tools/attach/BasicTests.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java	Mon Apr 10 08:31:37 2017 -0700
@@ -40,16 +40,17 @@
 /*
  * @test
  * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
- * @summary Basic unit tests for the VM attach mechanism.
  * @key intermittent
+ * @summary Basic unit tests for the VM attach mechanism. This test will perform
+ * a number of basic attach tests.
+ *
  * @library /lib/testlibrary
  * @modules java.instrument
- *          java.management
+ *          jdk.attach
  *          jdk.jartool/sun.tools.jar
+ *
  * @run build jdk.testlibrary.* Agent BadAgent RedefineAgent Application RedefineDummy RunnerUtil
  * @run main BasicTests
- *
- * This test will perform a number of basic attach tests.
  */
 public class BasicTests {
 
--- a/jdk/test/com/sun/tools/attach/PermissionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/tools/attach/PermissionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,17 +31,15 @@
 /*
  * @test
  * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
- * @summary Basic unit tests for the VM attach mechanism.
- * @modules jdk.jartool/sun.tools.jar
+ * @summary Basic unit tests for the VM attach mechanism. Unit test for Attach
+ * API - this checks that a SecurityException is thrown as expected.
+ *
  * @library /lib/testlibrary
- * @modules java.management
- *          jdk.attach
+ * @modules jdk.attach
  *          jdk.jartool/sun.tools.jar
+ *
  * @run build jdk.testlibrary.* Application
  * @run main PermissionTest
- *
- * Unit test for Attach API -
- * this checks that a SecurityException is thrown as expected.
  */
 public class PermissionTest {
 
--- a/jdk/test/com/sun/tools/attach/ProviderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/tools/attach/ProviderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,16 +31,15 @@
 /*
  * @test
  * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
- * @summary Basic unit tests for the VM attach mechanism.
- * @modules jdk.jartool/sun.tools.jar
+ * @summary Basic unit tests for the VM attach mechanism. The test will attach
+ * and detach to/from the running Application.
+ *
  * @library /lib/testlibrary
- * @modules java.management
- *          jdk.attach
+ * @modules jdk.attach
  *          jdk.jartool/sun.tools.jar
+ *
  * @run build jdk.testlibrary.* SimpleProvider
  * @run main ProviderTest
- *
- * The test will attach and detach to/from the running Application.
  */
 public class ProviderTest {
 
--- a/jdk/test/com/sun/tools/attach/StartManagementAgent.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/tools/attach/StartManagementAgent.java	Mon Apr 10 08:31:37 2017 -0700
@@ -39,11 +39,12 @@
 /*
  * @test
  * @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent
- * @modules jdk.jartool/sun.tools.jar
+ *
  * @library /lib/testlibrary
- * @modules jdk.management.agent
+ * @modules java.management
  *          jdk.attach
  *          jdk.jartool/sun.tools.jar
+ *
  * @run build Application SimpleProvider jdk.testlibrary.*
  * @run main/timeout=300 StartManagementAgent
  */
--- a/jdk/test/com/sun/tools/attach/TempDirTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -37,10 +37,11 @@
  * @test
  * @bug 8033104
  * @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
- * @modules jdk.jartool/sun.tools.jar
+ *
  * @library /lib/testlibrary
- * @modules java.management
+ * @modules jdk.attach
  *          jdk.jartool/sun.tools.jar
+ *
  * @run build jdk.testlibrary.* Application RunnerUtil
  * @run main/timeout=200 TempDirTest
  */
--- a/jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java	Mon Apr 10 08:31:37 2017 -0700
@@ -81,7 +81,7 @@
             try {
                 // sun.lwawt.macosx.CTrayIcon
                 Field f_peer = getField( java.awt.TrayIcon.class, "peer");
-                Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.reflect.Module.class);
+                Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.Module.class);
                 m_addExports.invoke(null, "sun.lwawt.macosx", robot.getClass().getModule());
 
 
@@ -105,7 +105,7 @@
         } else {
             try {
                 // sun.awt.X11.XTrayIconPeer
-                Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.reflect.Module.class);
+                Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.Module.class);
                 m_addExports.invoke(null, "sun.awt.X11", robot.getClass().getModule());
 
                 Field f_peer = getField(java.awt.TrayIcon.class, "peer");
--- a/jdk/test/java/awt/patchlib/java.desktop/java/awt/Helper.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/awt/patchlib/java.desktop/java/awt/Helper.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,7 +22,6 @@
  */
 
 package java.awt;
-import java.lang.reflect.Module;
 public class Helper {
     private Helper() { }
     public static void addExports(String pn, Module target) {
--- a/jdk/test/java/awt/regtesthelpers/Util.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/awt/regtesthelpers/Util.java	Mon Apr 10 08:31:37 2017 -0700
@@ -445,7 +445,7 @@
 
         try {
             final Class _clazz = clazz;
-            Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.reflect.Module.class);
+            Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.Module.class);
             // No MToolkit anymore: nothing to do about it.
             // We may be called from non-X11 system, and this permission cannot be delegated to a test.
             m_addExports.invoke(null, "sun.awt.X11", Util.class.getModule());
--- a/jdk/test/java/lang/Class/GetModuleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/Class/GetModuleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,7 +31,6 @@
  */
 
 import java.awt.Component;
-import java.lang.reflect.Module;
 
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import static jdk.internal.org.objectweb.asm.Opcodes.*;
--- a/jdk/test/java/lang/Class/forName/modules/TestLayer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/Class/forName/modules/TestLayer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,9 +23,7 @@
 
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.nio.file.Path;
@@ -45,13 +43,13 @@
 
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
 
-        Configuration parent = Layer.boot().configuration();
+        Configuration parent = ModuleLayer.boot().configuration();
         Configuration cf = parent.resolveAndBind(ModuleFinder.of(),
                                                  finder,
                                                  modules);
 
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl);
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl);
 
         Module m1 = layer.findModule("m1").get();
         Module m2 = layer.findModule("m2").get();
--- a/jdk/test/java/lang/Class/forName/modules/TestMain.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/Class/forName/modules/TestMain.java	Mon Apr 10 08:31:37 2017 -0700
@@ -21,13 +21,11 @@
  * questions.
  */
 
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 
 public class TestMain {
     public static void main(String[] args) throws Exception {
-        Layer boot = Layer.boot();
+        ModuleLayer boot = ModuleLayer.boot();
         Module m1 = boot.findModule("m1").get();
         Module m2 = boot.findModule("m2").get();
 
--- a/jdk/test/java/lang/Class/forName/modules/src/m2/p2/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/Class/forName/modules/src/m2/p2/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,12 +23,9 @@
 
 package p2.test;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
-
 public class Main {
     public static void main(String... args) throws Exception {
-        Layer boot = Layer.boot();
+        ModuleLayer boot = ModuleLayer.boot();
         Module m1 = boot.findModule("m1").get();
         Module m2 = Main.class.getModule();
 
--- a/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoAccess.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoAccess.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,8 +26,6 @@
 import java.io.FilePermission;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.security.AccessControlException;
@@ -47,7 +45,7 @@
 
         ModuleFinder finder = ModuleFinder.of(Paths.get("mods1"), Paths.get("mods2"));
 
-        Layer bootLayer = Layer.boot();
+        ModuleLayer bootLayer = ModuleLayer.boot();
         Configuration parent = bootLayer.configuration();
 
         Configuration cf = parent.resolveAndBind(finder,
@@ -55,7 +53,7 @@
                                                  Set.of("m1", "m2"));
 
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = bootLayer.defineModulesWithManyLoaders(cf, scl);
+        ModuleLayer layer = bootLayer.defineModulesWithManyLoaders(cf, scl);
 
         if (sm != null) {
             System.setSecurityManager(sm);
--- a/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoGetClassLoaderAccess.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoGetClassLoaderAccess.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,8 +23,6 @@
 
 package p3;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.security.AccessControlException;
 import java.security.Permission;
 
@@ -37,7 +35,7 @@
     private static final Permission GET_CLASSLOADER_PERMISSION = new RuntimePermission("getClassLoader");
 
     public static void main(String[] args) throws Exception {
-        Layer boot = Layer.boot();
+        ModuleLayer boot = ModuleLayer.boot();
 
         System.setSecurityManager(new SecurityManager());
         Module m1 = boot.findModule("m1").get();
--- a/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,10 +26,8 @@
 import java.io.UncheckedIOException;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Field;
-import java.lang.reflect.Module;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.InaccessibleObjectException;
-import java.lang.reflect.Layer;
 import java.lang.reflect.ReflectPermission;
 import java.net.URI;
 import java.nio.file.FileSystem;
@@ -269,7 +267,7 @@
             try {
                 return Files.walk(root)
                         .filter(p -> p.getNameCount() > 2)
-                        .filter(p -> Layer.boot().findModule(p.getName(1).toString()).isPresent())
+                        .filter(p -> ModuleLayer.boot().findModule(p.getName(1).toString()).isPresent())
                         .map(p -> p.subpath(2, p.getNameCount()))
                         .map(p -> p.toString())
                         .filter(s -> s.endsWith(".class") && !s.endsWith("module-info.class"))
--- a/jdk/test/java/lang/Class/getResource/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/Class/getResource/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 import java.lang.module.Configuration;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -256,7 +255,7 @@
      * Returns the directory for the given module (by name).
      */
     static Path directoryFor(String name) {
-        Configuration cf = Layer.boot().configuration();
+        Configuration cf = ModuleLayer.boot().configuration();
         ResolvedModule resolvedModule = cf.findModule(name).orElse(null);
         if (resolvedModule == null)
             throw new RuntimeException("not found: " + name);
--- a/jdk/test/java/lang/ClassLoader/getResource/automaticmodules/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/ClassLoader/getResource/automaticmodules/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
 import java.lang.module.ModuleReader;
 import java.lang.module.ModuleReference;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
 import java.net.URL;
 import java.util.Enumeration;
 
@@ -74,7 +73,7 @@
     public static void main(String[] args) throws Exception {
         String mn = args[0];
 
-        ModuleReference mref = Layer.boot()
+        ModuleReference mref = ModuleLayer.boot()
                 .configuration()
                 .findModule(mn)
                 .map(ResolvedModule::reference)
--- a/jdk/test/java/lang/ClassLoader/getResource/modules/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/ClassLoader/getResource/modules/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,7 +24,6 @@
 import java.io.InputStream;
 import java.lang.module.Configuration;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
 import java.io.IOException;
 import java.net.URL;
 import java.nio.file.Files;
@@ -309,7 +308,7 @@
      * Returns the directory for the given module (by name).
      */
     static Path directoryFor(String mn) {
-        Configuration cf = Layer.boot().configuration();
+        Configuration cf = ModuleLayer.boot().configuration();
         ResolvedModule resolvedModule = cf.findModule(mn).orElse(null);
         if (resolvedModule == null)
             throw new RuntimeException("not found: " + mn);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/BasicLayerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,1213 @@
+/*
+ * 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
+ * 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
+ * @modules java.base/jdk.internal.misc
+ * @build BasicLayerTest ModuleUtils
+ * @compile layertest/Test.java
+ * @run testng BasicLayerTest
+ * @summary Basic tests for java.lang.ModuleLayer
+ */
+
+import java.lang.module.Configuration;
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleDescriptor.Requires;
+import java.lang.module.ModuleFinder;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import jdk.internal.misc.SharedSecrets;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class BasicLayerTest {
+
+    /**
+     * Creates a "non-strict" builder for building a module. This allows the
+     * test the create ModuleDescriptor objects that do not require java.base.
+     */
+    private static ModuleDescriptor.Builder newBuilder(String mn) {
+        return SharedSecrets.getJavaLangModuleAccess()
+                .newModuleBuilder(mn, false, Set.of());
+    }
+
+    /**
+     * Exercise ModuleLayer.empty()
+     */
+    public void testEmpty() {
+        ModuleLayer emptyLayer = ModuleLayer.empty();
+
+        assertTrue(emptyLayer.parents().isEmpty());
+
+        assertTrue(emptyLayer.configuration() == Configuration.empty());
+
+        assertTrue(emptyLayer.modules().isEmpty());
+
+        assertFalse(emptyLayer.findModule("java.base").isPresent());
+
+        try {
+            emptyLayer.findLoader("java.base");
+            assertTrue(false);
+        } catch (IllegalArgumentException expected) { }
+    }
+
+
+    /**
+     * Exercise ModuleLayer.boot()
+     */
+    public void testBoot() {
+        ModuleLayer bootLayer = ModuleLayer.boot();
+
+        // configuration
+        Configuration cf = bootLayer.configuration();
+        assertTrue(cf.findModule("java.base").get()
+                .reference()
+                .descriptor()
+                .exports()
+                .stream().anyMatch(e -> (e.source().equals("java.lang")
+                                         && !e.isQualified())));
+
+        // modules
+        Set<Module> modules = bootLayer.modules();
+        assertTrue(modules.contains(Object.class.getModule()));
+        int count = (int) modules.stream().map(Module::getName).count();
+        assertEquals(count, modules.size()); // module names are unique
+
+        // findModule
+        Module base = Object.class.getModule();
+        assertTrue(bootLayer.findModule("java.base").get() == base);
+        assertTrue(base.getLayer() == bootLayer);
+
+        // findLoader
+        assertTrue(bootLayer.findLoader("java.base") == null);
+
+        // parents
+        assertTrue(bootLayer.parents().size() == 1);
+        assertTrue(bootLayer.parents().get(0) == ModuleLayer.empty());
+    }
+
+
+    /**
+     * Exercise defineModules, created with empty layer as parent
+     */
+    public void testLayerOnEmpty() {
+        ModuleDescriptor descriptor1 = newBuilder("m1")
+                .requires("m2")
+                .exports("p1")
+                .build();
+
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .requires("m3")
+                .build();
+
+        ModuleDescriptor descriptor3 = newBuilder("m3")
+                .build();
+
+        ModuleFinder finder
+            = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3);
+
+        Configuration cf = resolve(finder, "m1");
+
+        // map each module to its own class loader for this test
+        ClassLoader loader1 = new ClassLoader() { };
+        ClassLoader loader2 = new ClassLoader() { };
+        ClassLoader loader3 = new ClassLoader() { };
+        Map<String, ClassLoader> map = new HashMap<>();
+        map.put("m1", loader1);
+        map.put("m2", loader2);
+        map.put("m3", loader3);
+
+        ModuleLayer layer = ModuleLayer.empty().defineModules(cf, map::get);
+
+        // configuration
+        assertTrue(layer.configuration() == cf);
+        assertTrue(layer.configuration().modules().size() == 3);
+
+        // modules
+        Set<Module> modules = layer.modules();
+        assertTrue(modules.size() == 3);
+        Set<String> names = modules.stream()
+            .map(Module::getName)
+            .collect(Collectors.toSet());
+        assertTrue(names.contains("m1"));
+        assertTrue(names.contains("m2"));
+        assertTrue(names.contains("m3"));
+
+        // findModule
+        Module m1 = layer.findModule("m1").get();
+        Module m2 = layer.findModule("m2").get();
+        Module m3 = layer.findModule("m3").get();
+        assertEquals(m1.getName(), "m1");
+        assertEquals(m2.getName(), "m2");
+        assertEquals(m3.getName(), "m3");
+        assertTrue(m1.getDescriptor() == descriptor1);
+        assertTrue(m2.getDescriptor() == descriptor2);
+        assertTrue(m3.getDescriptor() == descriptor3);
+        assertTrue(m1.getLayer() == layer);
+        assertTrue(m2.getLayer() == layer);
+        assertTrue(m3.getLayer() == layer);
+        assertTrue(modules.contains(m1));
+        assertTrue(modules.contains(m2));
+        assertTrue(modules.contains(m3));
+        assertFalse(layer.findModule("godot").isPresent());
+
+        // findLoader
+        assertTrue(layer.findLoader("m1") == loader1);
+        assertTrue(layer.findLoader("m2") == loader2);
+        assertTrue(layer.findLoader("m3") == loader3);
+        try {
+            ClassLoader loader = layer.findLoader("godot");
+            assertTrue(false);
+        } catch (IllegalArgumentException ignore) { }
+
+        // parents
+        assertTrue(layer.parents().size() == 1);
+        assertTrue(layer.parents().get(0) == ModuleLayer.empty());
+    }
+
+
+    /**
+     * Exercise defineModules, created with boot layer as parent
+     */
+    public void testLayerOnBoot() {
+        ModuleDescriptor descriptor1 = newBuilder("m1")
+                .requires("m2")
+                .requires("java.base")
+                .exports("p1")
+                .build();
+
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .requires("java.base")
+                .build();
+
+        ModuleFinder finder
+            = ModuleUtils.finderOf(descriptor1, descriptor2);
+
+        Configuration parent = ModuleLayer.boot().configuration();
+        Configuration cf = resolve(parent, finder, "m1");
+
+        ClassLoader loader = new ClassLoader() { };
+
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, mn -> loader);
+
+        // configuration
+        assertTrue(layer.configuration() == cf);
+        assertTrue(layer.configuration().modules().size() == 2);
+
+        // modules
+        Set<Module> modules = layer.modules();
+        assertTrue(modules.size() == 2);
+        Set<String> names = modules.stream()
+            .map(Module::getName)
+            .collect(Collectors.toSet());
+        assertTrue(names.contains("m1"));
+        assertTrue(names.contains("m2"));
+
+        // findModule
+        Module m1 = layer.findModule("m1").get();
+        Module m2 = layer.findModule("m2").get();
+        assertEquals(m1.getName(), "m1");
+        assertEquals(m2.getName(), "m2");
+        assertTrue(m1.getDescriptor() == descriptor1);
+        assertTrue(m2.getDescriptor() == descriptor2);
+        assertTrue(m1.getLayer() == layer);
+        assertTrue(m2.getLayer() == layer);
+        assertTrue(modules.contains(m1));
+        assertTrue(modules.contains(m2));
+        assertTrue(layer.findModule("java.base").get() == Object.class.getModule());
+        assertFalse(layer.findModule("godot").isPresent());
+
+        // findLoader
+        assertTrue(layer.findLoader("m1") == loader);
+        assertTrue(layer.findLoader("m2") == loader);
+        assertTrue(layer.findLoader("java.base") == null);
+
+        // parents
+        assertTrue(layer.parents().size() == 1);
+        assertTrue(layer.parents().get(0) == ModuleLayer.boot());
+    }
+
+
+    /**
+     * Exercise defineModules with a configuration of two modules that
+     * have the same module-private package.
+     */
+    public void testPackageContainedInSelfAndOther() {
+        ModuleDescriptor descriptor1 =  newBuilder("m1")
+                .requires("m2")
+                .packages(Set.of("p"))
+                .build();
+
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .packages(Set.of("p"))
+                .build();
+
+        ModuleFinder finder
+            = ModuleUtils.finderOf(descriptor1, descriptor2);
+
+        Configuration cf = resolve(finder, "m1");
+        assertTrue(cf.modules().size() == 2);
+
+        // one loader per module, should be okay
+        ModuleLayer.empty().defineModules(cf, mn -> new ClassLoader() { });
+
+        // same class loader
+        try {
+            ClassLoader loader = new ClassLoader() { };
+            ModuleLayer.empty().defineModules(cf, mn -> loader);
+            assertTrue(false);
+        } catch (LayerInstantiationException expected) { }
+    }
+
+
+    /**
+     * Exercise defineModules with a configuration that is a partitioned
+     * graph. The same package is exported in both partitions.
+     */
+    public void testSameExportInPartitionedGraph() {
+
+        // m1 reads m2, m2 exports p to m1
+        ModuleDescriptor descriptor1 =  newBuilder("m1")
+                .requires("m2")
+                .build();
+        ModuleDescriptor descriptor2 =  newBuilder("m2")
+                .exports("p", Set.of("m1"))
+                .build();
+
+        // m3 reads m4, m4 exports p to m3
+        ModuleDescriptor descriptor3 = newBuilder("m3")
+                .requires("m4")
+                .build();
+        ModuleDescriptor descriptor4 = newBuilder("m4")
+                .exports("p", Set.of("m3"))
+                .build();
+
+        ModuleFinder finder
+            = ModuleUtils.finderOf(descriptor1,
+                                   descriptor2,
+                                   descriptor3,
+                                   descriptor4);
+
+        Configuration cf = resolve(finder, "m1", "m3");
+        assertTrue(cf.modules().size() == 4);
+
+        // one loader per module
+        ModuleLayer.empty().defineModules(cf, mn -> new ClassLoader() { });
+
+        // m1 & m2 in one loader, m3 & m4 in another loader
+        ClassLoader loader1 = new ClassLoader() { };
+        ClassLoader loader2 = new ClassLoader() { };
+        Map<String, ClassLoader> map = new HashMap<>();
+        map.put("m1", loader1);
+        map.put("m2", loader1);
+        map.put("m3", loader2);
+        map.put("m4", loader2);
+        ModuleLayer.empty().defineModules(cf, map::get);
+
+        // same loader
+        try {
+            ClassLoader loader = new ClassLoader() { };
+            ModuleLayer.empty().defineModules(cf, mn -> loader);
+            assertTrue(false);
+        } catch (LayerInstantiationException expected) { }
+    }
+
+
+    /**
+     * Exercise defineModules with a configuration with a module that
+     * contains a package that is the same name as a non-exported package in
+     * a parent layer.
+     */
+    public void testContainsSamePackageAsBootLayer() {
+
+        // check assumption that java.base contains sun.launcher
+        ModuleDescriptor base = Object.class.getModule().getDescriptor();
+        assertTrue(base.packages().contains("sun.launcher"));
+
+        ModuleDescriptor descriptor = newBuilder("m1")
+               .requires("java.base")
+               .packages(Set.of("sun.launcher"))
+               .build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(descriptor);
+
+        Configuration parent = ModuleLayer.boot().configuration();
+        Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m1"));
+        assertTrue(cf.modules().size() == 1);
+
+        ClassLoader loader = new ClassLoader() { };
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, mn -> loader);
+        assertTrue(layer.modules().size() == 1);
+   }
+
+
+    /**
+     * Test layers with implied readability.
+     *
+     * The test consists of three configurations:
+     * - Configuration/layer1: m1, m2 requires transitive m1
+     * - Configuration/layer2: m3 requires m1
+     */
+    public void testImpliedReadabilityWithLayers1() {
+
+        // cf1: m1 and m2, m2 requires transitive m1
+
+        ModuleDescriptor descriptor1 = newBuilder("m1")
+                .build();
+
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m1")
+                .build();
+
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
+
+        Configuration cf1 = resolve(finder1, "m2");
+
+        ClassLoader cl1 = new ClassLoader() { };
+        ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1);
+
+
+        // cf2: m3, m3 requires m2
+
+        ModuleDescriptor descriptor3 = newBuilder("m3")
+                .requires("m2")
+                .build();
+
+        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor3);
+
+        Configuration cf2 = resolve(cf1, finder2, "m3");
+
+        ClassLoader cl2 = new ClassLoader() { };
+        ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2);
+
+        assertTrue(layer1.parents().size() == 1);
+        assertTrue(layer1.parents().get(0) == ModuleLayer.empty());
+
+        assertTrue(layer2.parents().size() == 1);
+        assertTrue(layer2.parents().get(0) == layer1);
+
+        Module m1 = layer2.findModule("m1").get();
+        Module m2 = layer2.findModule("m2").get();
+        Module m3 = layer2.findModule("m3").get();
+
+        assertTrue(m1.getLayer() == layer1);
+        assertTrue(m2.getLayer() == layer1);
+        assertTrue(m3.getLayer() == layer2);
+
+        assertTrue(m1.getClassLoader() == cl1);
+        assertTrue(m2.getClassLoader() == cl1);
+        assertTrue(m3.getClassLoader() == cl2);
+
+        assertTrue(m1.canRead(m1));
+        assertFalse(m1.canRead(m2));
+        assertFalse(m1.canRead(m3));
+
+        assertTrue(m2.canRead(m1));
+        assertTrue(m2.canRead(m2));
+        assertFalse(m2.canRead(m3));
+
+        assertTrue(m3.canRead(m1));
+        assertTrue(m3.canRead(m2));
+        assertTrue(m3.canRead(m3));
+    }
+
+
+    /**
+     * Test layers with implied readability.
+     *
+     * The test consists of three configurations:
+     * - Configuration/layer1: m1
+     * - Configuration/layer2: m2 requires transitive m3, m3 requires m2
+     */
+    public void testImpliedReadabilityWithLayers2() {
+
+        // cf1: m1
+
+        ModuleDescriptor descriptor1 = newBuilder("m1").build();
+
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
+
+        Configuration cf1 = resolve(finder1, "m1");
+
+        ClassLoader cl1 = new ClassLoader() { };
+        ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1);
+
+
+        // cf2: m2, m3: m2 requires transitive m1, m3 requires m2
+
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m1")
+                .build();
+
+        ModuleDescriptor descriptor3 = newBuilder("m3")
+                .requires("m2")
+                .build();
+
+        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2, descriptor3);
+
+        Configuration cf2 = resolve(cf1, finder2, "m3");
+
+        ClassLoader cl2 = new ClassLoader() { };
+        ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2);
+
+        assertTrue(layer1.parents().size() == 1);
+        assertTrue(layer1.parents().get(0) == ModuleLayer.empty());
+
+        assertTrue(layer2.parents().size() == 1);
+        assertTrue(layer2.parents().get(0) == layer1);
+
+        Module m1 = layer2.findModule("m1").get();
+        Module m2 = layer2.findModule("m2").get();
+        Module m3 = layer2.findModule("m3").get();
+
+        assertTrue(m1.getLayer() == layer1);
+        assertTrue(m2.getLayer() == layer2);
+        assertTrue(m3.getLayer() == layer2);
+
+        assertTrue(m1.canRead(m1));
+        assertFalse(m1.canRead(m2));
+        assertFalse(m1.canRead(m3));
+
+        assertTrue(m2.canRead(m1));
+        assertTrue(m2.canRead(m2));
+        assertFalse(m2.canRead(m3));
+
+        assertTrue(m3.canRead(m1));
+        assertTrue(m3.canRead(m2));
+        assertTrue(m3.canRead(m3));
+    }
+
+
+    /**
+     * Test layers with implied readability.
+     *
+     * The test consists of three configurations:
+     * - Configuration/layer1: m1
+     * - Configuration/layer2: m2 requires transitive m1
+     * - Configuration/layer3: m3 requires m1
+     */
+    public void testImpliedReadabilityWithLayers3() {
+
+        // cf1: m1
+
+        ModuleDescriptor descriptor1 = newBuilder("m1").build();
+
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
+
+        Configuration cf1 = resolve(finder1, "m1");
+
+        ClassLoader cl1 = new ClassLoader() { };
+        ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1);
+
+
+        // cf2: m2 requires transitive m1
+
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m1")
+                .build();
+
+        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2);
+
+        Configuration cf2 = resolve(cf1, finder2, "m2");
+
+        ClassLoader cl2 = new ClassLoader() { };
+        ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2);
+
+
+        // cf3: m3 requires m2
+
+        ModuleDescriptor descriptor3 = newBuilder("m3")
+                .requires("m2")
+                .build();
+
+        ModuleFinder finder3 = ModuleUtils.finderOf(descriptor3);
+
+        Configuration cf3 = resolve(cf2, finder3, "m3");
+
+        ClassLoader cl3 = new ClassLoader() { };
+        ModuleLayer layer3 = layer2.defineModules(cf3, mn -> cl3);
+
+        assertTrue(layer1.parents().size() == 1);
+        assertTrue(layer1.parents().get(0) == ModuleLayer.empty());
+
+        assertTrue(layer2.parents().size() == 1);
+        assertTrue(layer2.parents().get(0) == layer1);
+
+        assertTrue(layer3.parents().size() == 1);
+        assertTrue(layer3.parents().get(0) == layer2);
+
+        Module m1 = layer3.findModule("m1").get();
+        Module m2 = layer3.findModule("m2").get();
+        Module m3 = layer3.findModule("m3").get();
+
+        assertTrue(m1.getLayer() == layer1);
+        assertTrue(m2.getLayer() == layer2);
+        assertTrue(m3.getLayer() == layer3);
+
+        assertTrue(m1.canRead(m1));
+        assertFalse(m1.canRead(m2));
+        assertFalse(m1.canRead(m3));
+
+        assertTrue(m2.canRead(m1));
+        assertTrue(m2.canRead(m2));
+        assertFalse(m2.canRead(m3));
+
+        assertTrue(m3.canRead(m1));
+        assertTrue(m3.canRead(m2));
+        assertTrue(m3.canRead(m3));
+    }
+
+
+    /**
+     * Test layers with implied readability.
+     *
+     * The test consists of two configurations:
+     * - Configuration/layer1: m1, m2 requires transitive m1
+     * - Configuration/layer2: m3 requires transitive m2, m4 requires m3
+     */
+    public void testImpliedReadabilityWithLayers4() {
+
+        // cf1: m1, m2 requires transitive m1
+
+        ModuleDescriptor descriptor1 = newBuilder("m1")
+                .build();
+
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m1")
+                .build();
+
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
+
+        Configuration cf1 = resolve(finder1, "m2");
+
+        ClassLoader cl1 = new ClassLoader() { };
+        ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1);
+
+
+        // cf2: m3 requires transitive m2, m4 requires m3
+
+        ModuleDescriptor descriptor3 = newBuilder("m3")
+                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m2")
+                .build();
+
+        ModuleDescriptor descriptor4 = newBuilder("m4")
+                .requires("m3")
+                .build();
+
+
+        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor3, descriptor4);
+
+        Configuration cf2 = resolve(cf1, finder2, "m3", "m4");
+
+        ClassLoader cl2 = new ClassLoader() { };
+        ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2);
+
+        assertTrue(layer1.parents().size() == 1);
+        assertTrue(layer1.parents().get(0) == ModuleLayer.empty());
+
+        assertTrue(layer2.parents().size() == 1);
+        assertTrue(layer2.parents().get(0) == layer1);
+
+        Module m1 = layer2.findModule("m1").get();
+        Module m2 = layer2.findModule("m2").get();
+        Module m3 = layer2.findModule("m3").get();
+        Module m4 = layer2.findModule("m4").get();
+
+        assertTrue(m1.getLayer() == layer1);
+        assertTrue(m2.getLayer() == layer1);
+        assertTrue(m3.getLayer() == layer2);
+        assertTrue(m4.getLayer() == layer2);
+
+        assertTrue(m1.canRead(m1));
+        assertFalse(m1.canRead(m2));
+        assertFalse(m1.canRead(m3));
+        assertFalse(m1.canRead(m4));
+
+        assertTrue(m2.canRead(m1));
+        assertTrue(m2.canRead(m2));
+        assertFalse(m1.canRead(m3));
+        assertFalse(m1.canRead(m4));
+
+        assertTrue(m3.canRead(m1));
+        assertTrue(m3.canRead(m2));
+        assertTrue(m3.canRead(m3));
+        assertFalse(m3.canRead(m4));
+
+        assertTrue(m4.canRead(m1));
+        assertTrue(m4.canRead(m2));
+        assertTrue(m4.canRead(m3));
+        assertTrue(m4.canRead(m4));
+    }
+
+
+    /**
+     * Test layers with a qualified export. The module exporting the package
+     * does not read the target module.
+     *
+     * m1 { exports p to m2 }
+     * m2 { }
+     */
+    public void testQualifiedExports1() {
+        ModuleDescriptor descriptor1 = newBuilder("m1").
+                exports("p", Set.of("m2"))
+                .build();
+
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .build();
+
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
+
+        Configuration cf = resolve(finder1, "m1", "m2");
+
+        ClassLoader cl = new ClassLoader() { };
+        ModuleLayer layer = ModuleLayer.empty().defineModules(cf, mn -> cl);
+        assertTrue(layer.modules().size() == 2);
+
+        Module m1 = layer.findModule("m1").get();
+        Module m2 = layer.findModule("m2").get();
+
+        // check m1 exports p to m2
+        assertFalse(m1.isExported("p"));
+        assertTrue(m1.isExported("p", m2));
+        assertFalse(m1.isOpen("p", m2));
+    }
+
+
+    /**
+     * Test layers with a qualified export. The module exporting the package
+     * reads the target module.
+     *
+     * m1 { exports p to m2; }
+     * m2 { requires m1; }
+     */
+    public void testQualifiedExports2() {
+        ModuleDescriptor descriptor1 = newBuilder("m1")
+                .exports("p", Set.of("m2"))
+                .build();
+
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .requires("m1")
+                .build();
+
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
+
+        Configuration cf = resolve(finder1, "m2");
+        ClassLoader cl = new ClassLoader() { };
+        ModuleLayer layer = ModuleLayer.empty().defineModules(cf, mn -> cl);
+        assertTrue(layer.modules().size() == 2);
+
+        Module m1 = layer.findModule("m1").get();
+        Module m2 = layer.findModule("m2").get();
+
+        // check m1 exports p to m2
+        assertFalse(m1.isExported("p"));
+        assertTrue(m1.isExported("p", m2));
+        assertFalse(m1.isOpen("p", m2));
+    }
+
+
+    /**
+     * Test layers with a qualified export. The module exporting the package
+     * does not read the target module in the parent layer.
+     *
+     * - Configuration/layer1: m1 { }
+     * - Configuration/layer2: m2 { exports p to m1; }
+     */
+    public void testQualifiedExports3() {
+        // create layer1 with m1
+        ModuleDescriptor descriptor1 = newBuilder("m1").build();
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
+        Configuration cf1 = resolve(finder1, "m1");
+        ClassLoader cl1 = new ClassLoader() { };
+        ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1);
+        assertTrue(layer1.modules().size() == 1);
+
+        // create layer2 with m2
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .exports("p", Set.of("m1"))
+                .build();
+        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2);
+        Configuration cf2 = resolve(cf1, finder2, "m2");
+        ClassLoader cl2 = new ClassLoader() { };
+        ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2);
+        assertTrue(layer2.modules().size() == 1);
+
+        Module m1 = layer1.findModule("m1").get();
+        Module m2 = layer2.findModule("m2").get();
+
+        // check m2 exports p to layer1/m1
+        assertFalse(m2.isExported("p"));
+        assertTrue(m2.isExported("p", m1));
+        assertFalse(m2.isOpen("p", m1));
+    }
+
+
+    /**
+     * Test layers with a qualified export. The module exporting the package
+     * reads the target module in the parent layer.
+     *
+     * - Configuration/layer1: m1 { }
+     * - Configuration/layer2: m2 { requires m1; exports p to m1; }
+     */
+    public void testQualifiedExports4() {
+        // create layer1 with m1
+        ModuleDescriptor descriptor1 = newBuilder("m1").build();
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
+        Configuration cf1 = resolve(finder1, "m1");
+        ClassLoader cl1 = new ClassLoader() { };
+        ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1);
+        assertTrue(layer1.modules().size() == 1);
+
+        // create layer2 with m2
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .requires("m1")
+                .exports("p", Set.of("m1"))
+                .build();
+        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2);
+        Configuration cf2 = resolve(cf1, finder2, "m2");
+        ClassLoader cl2 = new ClassLoader() { };
+        ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2);
+        assertTrue(layer2.modules().size() == 1);
+
+        Module m1 = layer1.findModule("m1").get();
+        Module m2 = layer2.findModule("m2").get();
+
+        // check m2 exports p to layer1/m1
+        assertFalse(m2.isExported("p"));
+        assertTrue(m2.isExported("p", m1));
+        assertFalse(m2.isOpen("p", m1));
+    }
+
+    /**
+     * Test layers with a qualified export. The module exporting the package
+     * does not read the target module.
+     *
+     * - Configuration/layer1: m1
+     * - Configuration/layer2: m1, m2 { exports p to m1; }
+     */
+    public void testQualifiedExports5() {
+        // create layer1 with m1
+        ModuleDescriptor descriptor1 = newBuilder("m1").build();
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
+        Configuration cf1 = resolve(finder1, "m1");
+        ClassLoader cl1 = new ClassLoader() { };
+        ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1);
+        assertTrue(layer1.modules().size() == 1);
+
+        // create layer2 with m1 and m2
+        ModuleDescriptor descriptor2 = newBuilder("m2").exports("p", Set.of("m1")).build();
+        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor1, descriptor2);
+        Configuration cf2 = resolve(cf1, finder2, "m1", "m2");
+        ClassLoader cl2 = new ClassLoader() { };
+        ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2);
+        assertTrue(layer2.modules().size() == 2);
+
+        Module m1_v1 = layer1.findModule("m1").get();
+        Module m1_v2 = layer2.findModule("m1").get();
+        Module m2 = layer2.findModule("m2").get();
+
+        // check m2 exports p to layer2/m2
+        assertFalse(m2.isExported("p"));
+        assertTrue(m2.isExported("p", m1_v2));
+        assertFalse(m2.isExported("p", m1_v1));
+    }
+
+
+    /**
+     * Test layers with a qualified export. The module exporting the package
+     * reads the target module in the parent layer (due to requires transitive).
+     *
+     * - Configuration/layer1: m1, m2 { requires transitive m1; }
+     * - Configuration/layer2: m1, m3 { requires m2; exports p to m1; }
+     */
+    public void testQualifiedExports6() {
+        // create layer1 with m1 and m2
+        ModuleDescriptor descriptor1 = newBuilder("m1").build();
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m1")
+                .build();
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
+        Configuration cf1 = resolve(finder1, "m2");
+        ClassLoader loader1 = new ClassLoader() { };
+        ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> loader1);
+        assertTrue(layer1.modules().size() == 2);
+
+        // create layer2 with m1 and m3
+        ModuleDescriptor descriptor3 = newBuilder("m3")
+                .requires("m2")
+                .exports("p", Set.of("m1"))
+                .build();
+        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor1, descriptor3);
+        Configuration cf2 = resolve(cf1, finder2, "m1", "m3");
+        ClassLoader loader2 = new ClassLoader() { };
+        ModuleLayer layer2 = layer1.defineModules(cf2, mn -> loader2);
+        assertTrue(layer2.modules().size() == 2);
+
+        Module m1_v1 = layer1.findModule("m1").get();
+        Module m2 = layer1.findModule("m2").get();
+
+        Module m1_v2 = layer2.findModule("m1").get();
+        Module m3 = layer2.findModule("m3").get();
+
+        assertTrue(m3.canRead(m1_v1));
+        assertFalse(m3.canRead(m1_v2));
+
+        assertFalse(m3.isExported("p"));
+        assertTrue(m3.isExported("p", m1_v1));
+        assertFalse(m3.isExported("p", m1_v2));
+        assertFalse(m3.isExported("p", m2));
+    }
+
+
+    /**
+     * Test layers with a qualified export. The target module is not in any layer.
+     *
+     * - Configuration/layer1: m1 { }
+     * - Configuration/layer2: m2 { exports p to m3; }
+     */
+    public void testQualifiedExports7() {
+        // create layer1 with m1
+        ModuleDescriptor descriptor1 = newBuilder("m1").build();
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
+        Configuration cf1 = resolve(finder1, "m1");
+        ClassLoader cl1 = new ClassLoader() { };
+        ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1);
+        assertTrue(layer1.modules().size() == 1);
+
+        // create layer2 with m2
+        ModuleDescriptor descriptor2 = newBuilder("m2")
+                .exports("p", Set.of("m3"))
+                .build();
+        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2);
+        Configuration cf2 = resolve(cf1, finder2, "m2");
+        ClassLoader cl2 = new ClassLoader() { };
+        ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2);
+        assertTrue(layer2.modules().size() == 1);
+
+        Module m1 = layer1.findModule("m1").get();
+        Module m2 = layer2.findModule("m2").get();
+
+        // check m2 does not export p to anyone
+        assertFalse(m2.isExported("p"));
+        assertFalse(m2.isExported("p", m1));
+    }
+
+    /**
+     * Attempt to use defineModules to create a layer with a module defined
+     * to a class loader that already has a module of the same name defined
+     * to the class loader.
+     */
+    @Test(expectedExceptions = { LayerInstantiationException.class })
+    public void testModuleAlreadyDefinedToLoader() {
+
+        ModuleDescriptor md = newBuilder("m")
+                .requires("java.base")
+                .build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(md);
+
+        Configuration parent = ModuleLayer.boot().configuration();
+
+        Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m"));
+
+        ClassLoader loader = new ClassLoader() { };
+
+        ModuleLayer.boot().defineModules(cf, mn -> loader);
+
+        // should throw LayerInstantiationException as m1 already defined to loader
+        ModuleLayer.boot().defineModules(cf, mn -> loader);
+
+    }
+
+
+    /**
+     * Attempt to use defineModules to create a layer with a module containing
+     * package {@code p} where the class loader already has a module defined
+     * to it containing package {@code p}.
+     */
+    @Test(expectedExceptions = { LayerInstantiationException.class })
+    public void testPackageAlreadyInNamedModule() {
+
+        ModuleDescriptor md1 = newBuilder("m1")
+                .packages(Set.of("p"))
+                .requires("java.base")
+                .build();
+
+        ModuleDescriptor md2 = newBuilder("m2")
+                .packages(Set.of("p"))
+                .requires("java.base")
+                .build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(md1, md2);
+
+        ClassLoader loader = new ClassLoader() { };
+
+        // define m1 containing package p to class loader
+
+        Configuration parent = ModuleLayer.boot().configuration();
+
+        Configuration cf1 = parent.resolve(finder, ModuleFinder.of(), Set.of("m1"));
+
+        ModuleLayer layer1 = ModuleLayer.boot().defineModules(cf1, mn -> loader);
+
+        // attempt to define m2 containing package p to class loader
+
+        Configuration cf2 = parent.resolve(finder, ModuleFinder.of(), Set.of("m2"));
+
+        // should throw exception because p already in m1
+        ModuleLayer layer2 = ModuleLayer.boot().defineModules(cf2, mn -> loader);
+
+    }
+
+
+    /**
+     * Attempt to use defineModules to create a layer with a module
+     * containing a package in which a type is already loaded by the class
+     * loader.
+     */
+    @Test(expectedExceptions = { LayerInstantiationException.class })
+    public void testPackageAlreadyInUnnamedModule() throws Exception {
+
+        Class<?> c = layertest.Test.class;
+        assertFalse(c.getModule().isNamed());  // in unnamed module
+
+        ModuleDescriptor md = newBuilder("m")
+                .packages(Set.of(c.getPackageName()))
+                .requires("java.base")
+                .build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(md);
+
+        Configuration parent = ModuleLayer.boot().configuration();
+        Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m"));
+
+        ModuleLayer.boot().defineModules(cf, mn -> c.getClassLoader());
+    }
+
+
+    /**
+     * Attempt to create a layer with a module named "java.base".
+     */
+    public void testLayerWithJavaBase() {
+        ModuleDescriptor descriptor = newBuilder("java.base")
+                .exports("java.lang")
+                .build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(descriptor);
+
+        Configuration cf = ModuleLayer.boot()
+            .configuration()
+            .resolve(finder, ModuleFinder.of(), Set.of("java.base"));
+        assertTrue(cf.modules().size() == 1);
+
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        try {
+            ModuleLayer.boot().defineModules(cf, mn -> new ClassLoader() { });
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        try {
+            ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        try {
+            ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl);
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+    }
+
+
+    @DataProvider(name = "javaPackages")
+    public Object[][] javaPackages() {
+        return new Object[][] { { "m1", "java" }, { "m2", "java.x" } };
+    }
+
+    /**
+     * Attempt to create a layer with a module containing a "java" package.
+     * This should only be allowed when the module is defined to the platform
+     * class loader.
+     */
+    @Test(dataProvider = "javaPackages")
+    public void testLayerWithJavaPackage(String mn, String pn) {
+        ModuleDescriptor descriptor = newBuilder(mn).packages(Set.of(pn)).build();
+        ModuleFinder finder = ModuleUtils.finderOf(descriptor);
+
+        Configuration cf = ModuleLayer.boot()
+                .configuration()
+                .resolve(finder, ModuleFinder.of(), Set.of(mn));
+        assertTrue(cf.modules().size() == 1);
+
+        ClassLoader pcl = ClassLoader.getPlatformClassLoader();
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        try {
+            ModuleLayer.boot().defineModules(cf, _mn -> new ClassLoader() { });
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        try {
+            ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        try {
+            ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl);
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        // create layer with module defined to platform class loader
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, _mn -> pcl);
+        Optional<Module> om = layer.findModule(mn);
+        assertTrue(om.isPresent());
+        Module foo = om.get();
+        assertTrue(foo.getClassLoader() == pcl);
+        assertTrue(foo.getPackages().size() == 1);
+        assertTrue(foo.getPackages().iterator().next().equals(pn));
+    }
+
+
+    /**
+     * Attempt to create a layer with a module defined to the boot loader
+     */
+    @Test(expectedExceptions = { LayerInstantiationException.class })
+    public void testLayerWithBootLoader() {
+        ModuleDescriptor descriptor = newBuilder("m1")
+                .build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(descriptor);
+
+        Configuration cf = ModuleLayer.boot()
+            .configuration()
+            .resolve(finder, ModuleFinder.of(), Set.of("m1"));
+        assertTrue(cf.modules().size() == 1);
+
+        ModuleLayer.boot().defineModules(cf, mn -> null );
+    }
+
+
+    /**
+     * Parent of configuration != configuration of parent layer
+     */
+    @Test(expectedExceptions = { IllegalArgumentException.class })
+    public void testIncorrectParent1() {
+        ModuleDescriptor descriptor1 = newBuilder("m1")
+                .requires("java.base")
+                .build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(descriptor1);
+
+        Configuration parent = ModuleLayer.boot().configuration();
+        Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m1"));
+
+        ClassLoader loader = new ClassLoader() { };
+        ModuleLayer.empty().defineModules(cf, mn -> loader);
+    }
+
+
+    /**
+     * Parent of configuration != configuration of parent layer
+     */
+    @Test(expectedExceptions = { IllegalArgumentException.class })
+    public void testIncorrectParent2() {
+        ModuleDescriptor descriptor1 = newBuilder("m1").build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(descriptor1);
+
+        Configuration cf = resolve(finder, "m1");
+
+        ClassLoader loader = new ClassLoader() { };
+        ModuleLayer.boot().defineModules(cf, mn -> loader);
+    }
+
+
+    // null handling
+
+    @Test(expectedExceptions = { NullPointerException.class })
+    public void testCreateWithNull1() {
+        ClassLoader loader = new ClassLoader() { };
+        ModuleLayer.empty().defineModules(null, mn -> loader);
+    }
+
+    @Test(expectedExceptions = { NullPointerException.class })
+    public void testCreateWithNull2() {
+        Configuration cf = resolve(ModuleLayer.boot().configuration(), ModuleFinder.of());
+        ModuleLayer.boot().defineModules(cf, null);
+    }
+
+    @Test(expectedExceptions = { NullPointerException.class })
+    public void testCreateWithNull3() {
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        ModuleLayer.empty().defineModulesWithOneLoader(null, scl);
+    }
+
+    @Test(expectedExceptions = { NullPointerException.class })
+    public void testCreateWithNull4() {
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        ModuleLayer.empty().defineModulesWithManyLoaders(null, scl);
+    }
+
+    @Test(expectedExceptions = { NullPointerException.class })
+    public void testFindModuleWithNull() {
+        ModuleLayer.boot().findModule(null);
+    }
+
+    @Test(expectedExceptions = { NullPointerException.class })
+    public void testFindLoaderWithNull() {
+        ModuleLayer.boot().findLoader(null);
+    }
+
+
+    // immutable sets
+
+    @Test(expectedExceptions = { UnsupportedOperationException.class })
+    public void testImmutableSet() {
+        Module base = Object.class.getModule();
+        ModuleLayer.boot().modules().add(base);
+    }
+
+
+    /**
+     * Resolve the given modules, by name, and returns the resulting
+     * Configuration.
+     */
+    private static Configuration resolve(Configuration cf,
+                                         ModuleFinder finder,
+                                         String... roots) {
+        return cf.resolve(finder, ModuleFinder.of(), Set.of(roots));
+    }
+
+    private static Configuration resolve(ModuleFinder finder,
+                                         String... roots) {
+        return resolve(Configuration.empty(), finder, roots);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,721 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @library /lib/testlibrary
+ * @modules jdk.compiler
+ * @build LayerAndLoadersTest CompilerUtils ModuleUtils
+ * @run testng LayerAndLoadersTest
+ * @summary Tests for java.lang.ModuleLayer@defineModulesWithXXX methods
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Optional;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class LayerAndLoadersTest {
+
+    private static final String TEST_SRC = System.getProperty("test.src");
+
+    private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
+    private static final Path MODS_DIR = Paths.get("mods");
+
+    @BeforeTest
+    public void setup() throws Exception {
+
+        // javac -d mods --module-source-path src src/**
+        assertTrue(CompilerUtils.compile(SRC_DIR, MODS_DIR,
+                "--module-source-path", SRC_DIR.toString()));
+    }
+
+
+    /**
+     * Basic test of ModuleLayer.defineModulesWithOneLoader
+     *
+     * Test scenario:
+     *   m1 requires m2 and m3
+     */
+    public void testWithOneLoader() throws Exception {
+
+        Configuration cf = resolve("m1");
+
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
+
+        checkLayer(layer, "m1", "m2", "m3");
+
+        ClassLoader cl1 = layer.findLoader("m1");
+        ClassLoader cl2 = layer.findLoader("m2");
+        ClassLoader cl3 = layer.findLoader("m3");
+
+        assertTrue(cl1.getParent() == scl);
+        assertTrue(cl2 == cl1);
+        assertTrue(cl3 == cl1);
+
+        invoke(layer, "m1", "p.Main");
+
+    }
+
+
+    /**
+     * Basic test of ModuleLayer.defineModulesWithManyLoaders
+     *
+     * Test scenario:
+     *   m1 requires m2 and m3
+     */
+    public void testWithManyLoaders() throws Exception {
+
+        Configuration cf = resolve("m1");
+
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl);
+
+        checkLayer(layer, "m1", "m2", "m3");
+
+        ClassLoader cl1 = layer.findLoader("m1");
+        ClassLoader cl2 = layer.findLoader("m2");
+        ClassLoader cl3 = layer.findLoader("m3");
+
+        assertTrue(cl1.getParent() == scl);
+        assertTrue(cl2.getParent() == scl);
+        assertTrue(cl3.getParent() == scl);
+        assertTrue(cl2 != cl1);
+        assertTrue(cl3 != cl1);
+        assertTrue(cl3 != cl2);
+
+        invoke(layer, "m1", "p.Main");
+
+    }
+
+
+    /**
+     * Basic test of ModuleLayer.defineModulesWithOneLoader where one of the
+     * modules is a service provider module.
+     *
+     * Test scenario:
+     *    m1 requires m2 and m3
+     *    m1 uses S
+     *    m4 provides S with ...
+     */
+    public void testServicesWithOneLoader() throws Exception {
+
+        Configuration cf = resolveAndBind("m1");
+
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
+
+        checkLayer(layer, "m1", "m2", "m3", "m4");
+
+        ClassLoader cl1 = layer.findLoader("m1");
+        ClassLoader cl2 = layer.findLoader("m2");
+        ClassLoader cl3 = layer.findLoader("m3");
+        ClassLoader cl4 = layer.findLoader("m4");
+
+        assertTrue(cl1.getParent() == scl);
+        assertTrue(cl2 == cl1);
+        assertTrue(cl3 == cl1);
+        assertTrue(cl4 == cl1);
+
+        Class<?> serviceType = cl1.loadClass("p.Service");
+        assertTrue(serviceType.getClassLoader() == cl1);
+
+        Iterator<?> iter = ServiceLoader.load(serviceType, cl1).iterator();
+        Object provider = iter.next();
+        assertTrue(serviceType.isInstance(provider));
+        assertTrue(provider.getClass().getClassLoader() == cl1);
+        assertFalse(iter.hasNext());
+
+    }
+
+
+    /**
+     * Basic test of ModuleLayer.defineModulesWithManyLoaders where one of the
+     * modules is a service provider module.
+     *
+     * Test scenario:
+     *    m1 requires m2 and m3
+     *    m1 uses S
+     *    m4 provides S with ...
+     */
+    public void testServicesWithManyLoaders() throws Exception {
+
+        Configuration cf = resolveAndBind("m1");
+
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl);
+
+        checkLayer(layer, "m1", "m2", "m3", "m4");
+
+        ClassLoader cl1 = layer.findLoader("m1");
+        ClassLoader cl2 = layer.findLoader("m2");
+        ClassLoader cl3 = layer.findLoader("m3");
+        ClassLoader cl4 = layer.findLoader("m4");
+
+        assertTrue(cl1.getParent() == scl);
+        assertTrue(cl2.getParent() == scl);
+        assertTrue(cl3.getParent() == scl);
+        assertTrue(cl4.getParent() == scl);
+        assertTrue(cl2 != cl1);
+        assertTrue(cl3 != cl1);
+        assertTrue(cl3 != cl2);
+        assertTrue(cl4 != cl1);
+        assertTrue(cl4 != cl2);
+        assertTrue(cl4 != cl3);
+
+        Class<?> serviceType = cl1.loadClass("p.Service");
+        assertTrue(serviceType.getClassLoader() == cl1);
+
+        // Test that the service provider can be located via any of
+        // the class loaders in the layer
+        for (Module m : layer.modules()) {
+            ClassLoader loader = m.getClassLoader();
+            Iterator<?> iter = ServiceLoader.load(serviceType, loader).iterator();
+            Object provider = iter.next();
+            assertTrue(serviceType.isInstance(provider));
+            assertTrue(provider.getClass().getClassLoader() == cl4);
+            assertFalse(iter.hasNext());
+        }
+
+    }
+
+
+    /**
+     * Tests that the class loaders created by defineModulesWithXXX delegate
+     * to the given parent class loader.
+     */
+    public void testDelegationToParent() throws Exception {
+
+        Configuration cf = resolve("m1");
+
+        ClassLoader parent = this.getClass().getClassLoader();
+        String cn = this.getClass().getName();
+
+        // one loader
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, parent);
+        testLoad(layer, cn);
+
+         // one loader with boot loader as parent
+        layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, null);
+        testLoadFail(layer, cn);
+
+        // many loaders
+        layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, parent);
+        testLoad(layer, cn);
+
+        // many loader with boot loader as parent
+        layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, null);
+        testLoadFail(layer, cn);
+
+    }
+
+
+    /**
+     * Test defineModulesWithXXX when modules that have overlapping packages.
+     *
+     * Test scenario:
+     *   m1 exports p
+     *   m2 exports p
+     */
+    public void testOverlappingPackages() {
+
+        ModuleDescriptor descriptor1
+            = ModuleDescriptor.newModule("m1").exports("p").build();
+
+        ModuleDescriptor descriptor2
+            = ModuleDescriptor.newModule("m2").exports("p").build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2);
+
+        Configuration cf = ModuleLayer.boot()
+            .configuration()
+            .resolve(finder, ModuleFinder.of(), Set.of("m1", "m2"));
+
+        // cannot define both module m1 and m2 to the same class loader
+        try {
+            ModuleLayer.boot().defineModulesWithOneLoader(cf, null);
+            assertTrue(false);
+        } catch (LayerInstantiationException expected) { }
+
+        // should be okay to have one module per class loader
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, null);
+        checkLayer(layer, "m1", "m2");
+
+    }
+
+
+    /**
+     * Test ModuleLayer.defineModulesWithXXX with split delegation.
+     *
+     * Test scenario:
+     *   layer1: m1 exports p, m2 exports p
+     *   layer2: m3 reads m1, m4 reads m2
+     */
+    public void testSplitDelegation() {
+
+        ModuleDescriptor descriptor1
+            = ModuleDescriptor.newModule("m1").exports("p").build();
+
+        ModuleDescriptor descriptor2
+            = ModuleDescriptor.newModule("m2").exports("p").build();
+
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
+
+        Configuration cf1 = ModuleLayer.boot()
+            .configuration()
+            .resolve(finder1, ModuleFinder.of(), Set.of("m1", "m2"));
+
+        ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, null);
+        checkLayer(layer1, "m1", "m2");
+
+        ModuleDescriptor descriptor3
+            = ModuleDescriptor.newModule("m3").requires("m1").build();
+
+        ModuleDescriptor descriptor4
+            = ModuleDescriptor.newModule("m4").requires("m2").build();
+
+        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor3, descriptor4);
+
+        Configuration cf2 = cf1.resolve(finder2, ModuleFinder.of(),
+                                                Set.of("m3", "m4"));
+
+        // package p cannot be supplied by two class loaders
+        try {
+            layer1.defineModulesWithOneLoader(cf2, null);
+            assertTrue(false);
+        } catch (LayerInstantiationException expected) { }
+
+        // no split delegation when modules have their own class loader
+        ModuleLayer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
+        checkLayer(layer2, "m3", "m4");
+
+    }
+
+
+    /**
+     * Test ModuleLayer.defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
+     *
+     * Test scenario:
+     *   layer1: m1, m2, m3 => same loader
+     *   layer2: m1, m2, m4 => same loader
+     */
+    public void testOverriding1() throws Exception {
+
+        Configuration cf1 = resolve("m1");
+
+        ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithOneLoader(cf1, null);
+        checkLayer(layer1, "m1", "m2", "m3");
+
+        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
+        Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
+
+        ModuleLayer layer2 = layer1.defineModulesWithOneLoader(cf2, null);
+        checkLayer(layer2, "m1", "m2", "m3");
+        invoke(layer1, "m1", "p.Main");
+
+        ClassLoader loader1 = layer1.findLoader("m1");
+        ClassLoader loader2 = layer1.findLoader("m2");
+        ClassLoader loader3 = layer1.findLoader("m3");
+
+        ClassLoader loader4 = layer2.findLoader("m1");
+        ClassLoader loader5 = layer2.findLoader("m2");
+        ClassLoader loader6 = layer2.findLoader("m3");
+
+        assertTrue(loader1 == loader2);
+        assertTrue(loader1 == loader3);
+
+        assertTrue(loader4 == loader5);
+        assertTrue(loader4 == loader6);
+        assertTrue(loader4 != loader1);
+
+        assertTrue(loader1.loadClass("p.Main").getClassLoader() == loader1);
+        assertTrue(loader1.loadClass("q.Hello").getClassLoader() == loader1);
+        assertTrue(loader1.loadClass("w.Hello").getClassLoader() == loader1);
+
+        assertTrue(loader4.loadClass("p.Main").getClassLoader() == loader4);
+        assertTrue(loader4.loadClass("q.Hello").getClassLoader() == loader4);
+        assertTrue(loader4.loadClass("w.Hello").getClassLoader() == loader4);
+
+    }
+
+
+    /**
+     * Test Layer defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
+     *
+     * Test scenario:
+     *   layer1: m1, m2, m3 => loader pool
+     *   layer2: m1, m2, m3 => loader pool
+     */
+    public void testOverriding2() throws Exception {
+
+        Configuration cf1 = resolve("m1");
+
+        ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, null);
+        checkLayer(layer1, "m1", "m2", "m3");
+
+        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
+        Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
+
+        ModuleLayer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
+        checkLayer(layer2, "m1", "m2", "m3");
+        invoke(layer1, "m1", "p.Main");
+
+        ClassLoader loader1 = layer1.findLoader("m1");
+        ClassLoader loader2 = layer1.findLoader("m2");
+        ClassLoader loader3 = layer1.findLoader("m3");
+
+        ClassLoader loader4 = layer2.findLoader("m1");
+        ClassLoader loader5 = layer2.findLoader("m2");
+        ClassLoader loader6 = layer2.findLoader("m3");
+
+        assertTrue(loader4 != loader1);
+        assertTrue(loader5 != loader2);
+        assertTrue(loader6 != loader3);
+
+        assertTrue(loader1.loadClass("p.Main").getClassLoader() == loader1);
+        assertTrue(loader1.loadClass("q.Hello").getClassLoader() == loader2);
+        assertTrue(loader1.loadClass("w.Hello").getClassLoader() == loader3);
+
+        // p.Main is not visible via loader2
+        try {
+            loader2.loadClass("p.Main");
+            assertTrue(false);
+        } catch (ClassNotFoundException expected) { }
+
+        // w.Hello is not visible via loader2
+        try {
+            loader2.loadClass("w.Hello");
+            assertTrue(false);
+        } catch (ClassNotFoundException expected) { }
+
+        // p.Main is not visible via loader3
+        try {
+            loader3.loadClass("p.Main");
+            assertTrue(false);
+        } catch (ClassNotFoundException expected) { }
+
+        // q.Hello is not visible via loader3
+        try {
+            loader3.loadClass("q.Hello");
+            assertTrue(false);
+        } catch (ClassNotFoundException expected) { }
+
+
+        assertTrue(loader4.loadClass("p.Main").getClassLoader() == loader4);
+        assertTrue(loader5.loadClass("q.Hello").getClassLoader() == loader5);
+        assertTrue(loader6.loadClass("w.Hello").getClassLoader() == loader6);
+
+        // p.Main is not visible via loader5
+        try {
+            loader5.loadClass("p.Main");
+            assertTrue(false);
+        } catch (ClassNotFoundException expected) { }
+
+        // w.Hello is not visible via loader5
+        try {
+            loader5.loadClass("w.Hello");
+            assertTrue(false);
+        } catch (ClassNotFoundException expected) { }
+
+        // p.Main is not visible via loader6
+        try {
+            loader6.loadClass("p.Main");
+            assertTrue(false);
+        } catch (ClassNotFoundException expected) { }
+
+        // q.Hello is not visible via loader6
+        try {
+            loader6.loadClass("q.Hello");
+            assertTrue(false);
+        } catch (ClassNotFoundException expected) { }
+
+    }
+
+
+    /**
+     * Test ModuleLayer.defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
+     *
+     * layer1: m1, m2, m3 => same loader
+     * layer2: m1, m3 => same loader
+     */
+    public void testOverriding3() throws Exception {
+
+        Configuration cf1 = resolve("m1");
+
+        ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithOneLoader(cf1, null);
+        checkLayer(layer1, "m1", "m2", "m3");
+
+        ModuleFinder finder = finderFor("m1", "m3");
+
+        Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
+
+        ModuleLayer layer2 = layer1.defineModulesWithOneLoader(cf2, null);
+        checkLayer(layer2, "m1", "m3");
+        invoke(layer1, "m1", "p.Main");
+
+        ClassLoader loader1 = layer1.findLoader("m1");
+        ClassLoader loader2 = layer2.findLoader("m1");
+
+        assertTrue(loader1.loadClass("p.Main").getClassLoader() == loader1);
+        assertTrue(loader1.loadClass("q.Hello").getClassLoader() == loader1);
+        assertTrue(loader1.loadClass("w.Hello").getClassLoader() == loader1);
+
+        assertTrue(loader2.loadClass("p.Main").getClassLoader() == loader2);
+        assertTrue(loader2.loadClass("q.Hello").getClassLoader() == loader1);
+        assertTrue(loader2.loadClass("w.Hello").getClassLoader() == loader2);
+
+    }
+
+
+    /**
+     * Test Layer defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
+     *
+     * layer1: m1, m2, m3 => loader pool
+     * layer2: m1, m3 => loader pool
+     */
+    public void testOverriding4() throws Exception {
+
+        Configuration cf1 = resolve("m1");
+
+        ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, null);
+        checkLayer(layer1, "m1", "m2", "m3");
+
+        ModuleFinder finder = finderFor("m1", "m3");
+
+        Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
+
+        ModuleLayer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
+        checkLayer(layer2, "m1", "m3");
+        invoke(layer1, "m1", "p.Main");
+
+        ClassLoader loader1 = layer1.findLoader("m1");
+        ClassLoader loader2 = layer1.findLoader("m2");
+        ClassLoader loader3 = layer1.findLoader("m3");
+
+        ClassLoader loader4 = layer2.findLoader("m1");
+        ClassLoader loader5 = layer2.findLoader("m2");
+        ClassLoader loader6 = layer2.findLoader("m3");
+
+        assertTrue(loader4 != loader1);
+        assertTrue(loader5 == loader2);  // m2 not overridden
+        assertTrue(loader6 != loader3);
+
+        assertTrue(loader1.loadClass("p.Main").getClassLoader() == loader1);
+        assertTrue(loader1.loadClass("q.Hello").getClassLoader() == loader2);
+        assertTrue(loader1.loadClass("w.Hello").getClassLoader() == loader3);
+
+        assertTrue(loader2.loadClass("q.Hello").getClassLoader() == loader2);
+
+        assertTrue(loader3.loadClass("w.Hello").getClassLoader() == loader3);
+
+        assertTrue(loader4.loadClass("p.Main").getClassLoader() == loader4);
+        assertTrue(loader4.loadClass("q.Hello").getClassLoader() == loader2);
+        assertTrue(loader4.loadClass("w.Hello").getClassLoader() == loader6);
+
+        assertTrue(loader6.loadClass("w.Hello").getClassLoader() == loader6);
+
+    }
+
+
+    /**
+     * Basic test of resource loading with a class loader created by
+     * Layer.defineModulesWithOneLoader.
+     */
+    public void testResourcesOneLoader() throws Exception {
+        Configuration cf = resolve("m1");
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
+        ClassLoader loader = layer.findLoader("m1");
+        testResourceLoading(loader, "p/Main.class");
+    }
+
+    /**
+     * Basic test of resource loading with a class loader created by
+     * Layer.defineModulesWithOneLoader.
+     */
+    public void testResourcesManyLoaders() throws Exception {
+        Configuration cf = resolve("m1");
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl);
+        ClassLoader loader = layer.findLoader("m1");
+        testResourceLoading(loader, "p/Main.class");
+    }
+
+    /**
+     * Test that a resource is located by a class loader.
+     */
+    private void testResourceLoading(ClassLoader loader, String name)
+        throws IOException
+    {
+        URL url = loader.getResource(name);
+        assertNotNull(url);
+
+        try (InputStream in = loader.getResourceAsStream(name)) {
+            assertNotNull(in);
+        }
+
+        Enumeration<URL> urls = loader.getResources(name);
+        assertTrue(urls.hasMoreElements());
+    }
+
+
+    // -- supporting methods --
+
+
+    /**
+     * Resolve the given modules, by name, and returns the resulting
+     * Configuration.
+     */
+    private static Configuration resolve(String... roots) {
+        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
+        return ModuleLayer.boot()
+            .configuration()
+            .resolve(finder, ModuleFinder.of(), Set.of(roots));
+    }
+
+    /**
+     * Resolve the given modules, by name, and returns the resulting
+     * Configuration.
+     */
+    private static Configuration resolveAndBind(String... roots) {
+        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
+        return ModuleLayer.boot()
+            .configuration()
+            .resolveAndBind(finder, ModuleFinder.of(), Set.of(roots));
+    }
+
+
+    /**
+     * Invokes the static void main(String[]) method on the given class
+     * in the given module.
+     */
+    private static void invoke(ModuleLayer layer, String mn, String mc) throws Exception {
+        ClassLoader loader = layer.findLoader(mn);
+        Class<?> c = loader.loadClass(mc);
+        Method mainMethod = c.getMethod("main", String[].class);
+        mainMethod.invoke(null, (Object)new String[0]);
+    }
+
+
+    /**
+     * Checks that the given layer contains exactly the expected modules
+     * (by name).
+     */
+    private void checkLayer(ModuleLayer layer, String ... expected) {
+        Set<String> names = layer.modules().stream()
+                .map(Module::getName)
+                .collect(Collectors.toSet());
+        assertTrue(names.size() == expected.length);
+        for (String name : expected) {
+            assertTrue(names.contains(name));
+        }
+    }
+
+
+    /**
+     * Test that a class can be loaded via the class loader of all modules
+     * in the given layer.
+     */
+    static void testLoad(ModuleLayer layer, String cn) throws Exception {
+        for (Module m : layer.modules()) {
+            ClassLoader l = m.getClassLoader();
+            l.loadClass(cn);
+        }
+    }
+
+
+    /**
+     * Test that a class cannot be loaded via any of the class loaders of
+     * the modules in the given layer.
+     */
+    static void testLoadFail(ModuleLayer layer, String cn) throws Exception {
+        for (Module m : layer.modules()) {
+            ClassLoader l = m.getClassLoader();
+            try {
+                l.loadClass(cn);
+                assertTrue(false);
+            } catch (ClassNotFoundException expected) { }
+        }
+    }
+
+
+    /**
+     * Returns a ModuleFinder that only finds the given test modules
+     */
+    static ModuleFinder finderFor(String... names) {
+
+        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
+
+        Map<String, ModuleReference> mrefs = new HashMap<>();
+        for (String name : names) {
+            Optional<ModuleReference> omref = finder.find(name);
+            assert omref.isPresent();
+            mrefs.put(name, omref.get());
+        }
+
+        return new ModuleFinder() {
+            @Override
+            public Optional<ModuleReference> find(String name) {
+                ModuleReference mref = mrefs.get(name);
+                return Optional.ofNullable(mref);
+            }
+            @Override
+            public Set<ModuleReference> findAll() {
+                return mrefs.values().stream().collect(Collectors.toSet());
+            }
+        };
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/LayerControllerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @library /lib/testlibrary
+ * @build LayerControllerTest ModuleUtils
+ * @run testng LayerControllerTest
+ * @summary Basic tests for java.lang.ModuleLayer.Controller
+ */
+
+import java.lang.module.Configuration;
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleFinder;
+import java.util.List;
+import java.util.Set;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class LayerControllerTest {
+
+    /**
+     * Creates a Controller for a module layer containing modules m1 and m2.
+     * Module m1 contains p1, reads java.base, does not export/open any package
+     * Module m2 contains p2, reads java.base, does not export/open any package
+     */
+    private ModuleLayer.Controller createTestLayer() {
+        ModuleDescriptor descriptor1
+            = ModuleDescriptor.newModule("m1")
+                .packages(Set.of("p1"))
+                .requires("java.base")
+                .build();
+
+        ModuleDescriptor descriptor2
+            = ModuleDescriptor.newModule("m2")
+                .requires("java.base")
+                .packages(Set.of("p2"))
+                .build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2);
+        ModuleLayer bootLayer = ModuleLayer.boot();
+
+        Configuration cf = bootLayer.configuration()
+                .resolve(finder, ModuleFinder.of(), Set.of("m1", "m2"));
+
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        ModuleLayer.Controller controller
+            = ModuleLayer.defineModulesWithOneLoader(cf, List.of(bootLayer), scl);
+
+        ModuleLayer layer = controller.layer();
+
+        assertTrue(layer.modules().size() == 2);
+        assertTrue(layer.findModule("m1").isPresent());
+        assertTrue(layer.findModule("m2").isPresent());
+
+        return controller;
+    }
+
+    /**
+     * Basic test of Controller to update modules m1 and m2 to read and
+     * open packages to each other.
+     */
+    public void testBasic() {
+        ModuleLayer.Controller controller = createTestLayer();
+        ModuleLayer layer = controller.layer();
+        Module m1 = layer.findModule("m1").orElseThrow(RuntimeException::new);
+        Module m2 = layer.findModule("m2").orElseThrow(RuntimeException::new);
+
+        assertFalse(m1.canRead(m2));
+        assertFalse(m1.isExported("p1"));
+        assertFalse(m1.isOpen("p1"));
+        assertFalse(m1.isExported("p1", m2));
+        assertFalse(m1.isOpen("p1", m2));
+
+        assertFalse(m2.canRead(m1));
+        assertFalse(m2.isExported("p2"));
+        assertFalse(m2.isOpen("p2"));
+        assertFalse(m2.isExported("p2", m1));
+        assertFalse(m2.isOpen("p2", m1));
+
+        // update m1 to read m2
+        assertTrue(controller.addReads(m1, m2) == controller);
+        assertTrue(m1.canRead(m2));
+        assertFalse(m2.canRead(m1));
+
+        // update m2 to read m1
+        assertTrue(controller.addReads(m2, m1) == controller);
+        assertTrue(m1.canRead(m2));
+        assertTrue(m1.canRead(m1));
+
+        // update m1 to open p1 to m2
+        assertTrue(controller.addOpens(m1, "p1", m2) == controller);
+        assertTrue(m1.isExported("p1", m2));
+        assertTrue(m1.isOpen("p1", m2));
+        assertFalse(m1.isExported("p1"));
+        assertFalse(m1.isOpen("p1"));
+
+        // update m2 to open p2 to m1
+        assertTrue(controller.addOpens(m2, "p2", m1) == controller);
+        assertTrue(m2.isExported("p2", m1));
+        assertTrue(m2.isOpen("p2", m1));
+        assertFalse(m2.isExported("p2"));
+        assertFalse(m2.isOpen("p2"));
+    }
+
+    /**
+     * Test invalid argument handling
+     */
+    public void testBadArguments() {
+        ModuleLayer.Controller controller = createTestLayer();
+        ModuleLayer layer = controller.layer();
+        Module m1 = layer.findModule("m1").orElseThrow(RuntimeException::new);
+        Module m2 = layer.findModule("m2").orElseThrow(RuntimeException::new);
+        Module base = Object.class.getModule();
+
+        // java.base is not in layer
+        try {
+            controller.addReads(base, m2);
+            assertTrue(false);
+        } catch (IllegalArgumentException expected) { }
+
+        // java.base is not in layer
+        try {
+            controller.addOpens(base, "java.lang", m2);
+            assertTrue(false);
+        } catch (IllegalArgumentException expected) { }
+
+        // m1 does not contain java.lang
+        try {
+            controller.addOpens(m1, "java.lang", m2);
+            assertTrue(false);
+        } catch (IllegalArgumentException expected) { }
+    }
+
+    /**
+     * Test null handling
+     */
+    public void testNulls() {
+        ModuleLayer.Controller controller = createTestLayer();
+        ModuleLayer layer = controller.layer();
+        Module m1 = layer.findModule("m1").orElseThrow(RuntimeException::new);
+        Module m2 = layer.findModule("m2").orElseThrow(RuntimeException::new);
+        assertTrue(m1 != null);
+        assertTrue(m2 != null);
+
+        try {
+            controller.addReads(null, m2);
+            assertTrue(false);
+        } catch (NullPointerException expected) { }
+
+        try {
+            controller.addReads(m1, null);
+            assertTrue(false);
+        } catch (NullPointerException expected) { }
+
+        try {
+            controller.addOpens(null, "p1", m2);
+            assertTrue(false);
+        } catch (NullPointerException expected) { }
+
+        try {
+            controller.addOpens(m1, null, m2);
+            assertTrue(false);
+        } catch (NullPointerException expected) { }
+
+        try {
+            controller.addOpens(m1, "p1", null);
+            assertTrue(false);
+        } catch (NullPointerException expected) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/layertest/Test.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Supporting class for tests of java.lang.ModuleLayer.
+ */
+
+package layertest;
+
+public class Test { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/src/m1/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module m1 {
+    requires m2;
+    requires m3;
+    exports p;
+    uses p.Service;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/src/m1/p/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+import java.net.URL;
+
+public class Main {
+    public static void main(String[] args) {
+
+        URL url1 = Main.class.getResource("Main.class");
+        if (url1 == null) throw new RuntimeException();
+        URL url2 = Main.class.getResource("/p/Main.class");
+        if (url2 == null) throw new RuntimeException();
+
+        q.Hello.hello();
+        w.Hello.hello();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/src/m1/p/Service.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+public interface Service { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/src/m2/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module m2 {
+    exports q;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/src/m2/q/Hello.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package q;
+
+import java.net.URL;
+
+public class Hello {
+
+    public static void hello() {
+
+        URL url1 = Hello.class.getResource("Hello.class");
+        if (url1 == null) throw new RuntimeException();
+        URL url2 = Hello.class.getResource("/q/Hello.class");
+        if (url2 == null) throw new RuntimeException();
+
+        System.out.println("Hello!");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/src/m3/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module m3 {
+    // qualified export
+    exports w to m1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/src/m3/w/Hello.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package w;
+
+import java.net.URL;
+
+public class Hello {
+
+    public static void hello() {
+
+        URL url1 = Hello.class.getResource("Hello.class");
+        if (url1 == null) throw new RuntimeException();
+        URL url2 = Hello.class.getResource("/w/Hello.class");
+        if (url2 == null) throw new RuntimeException();
+
+        System.out.println("Hello!");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/src/m4/impl/ServiceImpl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package impl;
+
+public class ServiceImpl implements p.Service {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleLayer/src/m4/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module m4 {
+    requires m1;
+    provides p.Service with impl.ServiceImpl;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/AddExportsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @modules java.base/jdk.internal.misc
+ *          java.desktop
+ * @run main/othervm --add-exports=java.desktop/sun.awt=java.base AddExportsTest
+ * @run main/othervm --add-exports=java.desktop/sun.awt=ALL-UNNAMED AddExportsTest
+ * @summary Test Module isExported methods with exports changed by -AddExportsTest
+ */
+
+import java.util.Optional;
+import java.util.stream.Stream;
+
+import jdk.internal.misc.VM;
+
+public class AddExportsTest {
+    /*
+     * jtreg sets -Dtest.modules system property to the internal APIs
+     * specified at @modules tag.  The test will exclude --add-exports set
+     * for @modules.
+     */
+    private static final String TEST_MODULES = System.getProperty("test.modules");
+
+    public static void main(String[] args) {
+
+        Optional<String> oaddExports = Stream.of(VM.getRuntimeArguments())
+            .filter(arg -> arg.startsWith("--add-exports="))
+            .filter(arg -> !arg.equals("--add-exports=" + TEST_MODULES + "=ALL-UNNAMED"))
+            .map(arg -> arg.substring("--add-exports=".length(), arg.length()))
+            .findFirst();
+
+        assertTrue(oaddExports.isPresent());
+
+        ModuleLayer bootLayer = ModuleLayer.boot();
+
+        Module unnamedModule = AddExportsTest.class.getModule();
+        assertFalse(unnamedModule.isNamed());
+
+        for (String expr : oaddExports.get().split(",")) {
+
+            String[] s = expr.split("=");
+            assertTrue(s.length == 2);
+
+            // $MODULE/$PACKAGE
+            String[] moduleAndPackage = s[0].split("/");
+            assertTrue(moduleAndPackage.length == 2);
+
+            String mn = moduleAndPackage[0];
+            String pn = moduleAndPackage[1];
+
+            // source module
+            Module source;
+            Optional<Module> om = bootLayer.findModule(mn);
+            assertTrue(om.isPresent(), mn + " not in boot layer");
+            source = om.get();
+
+            // package should not be exported unconditionally
+            assertFalse(source.isExported(pn),
+                        pn + " should not be exported unconditionally");
+
+            // $TARGET
+            String tn = s[1];
+            if ("ALL-UNNAMED".equals(tn)) {
+
+                // package is exported to all unnamed modules
+                assertTrue(source.isExported(pn, unnamedModule),
+                           pn + " should be exported to all unnamed modules");
+
+            } else {
+
+                om = bootLayer.findModule(tn);
+                assertTrue(om.isPresent());
+                Module target = om.get();
+
+                // package should be exported to target module
+                assertTrue(source.isExported(pn, target),
+                           pn + " should be exported to " + target);
+
+                // package should not be exported to unnamed modules
+                assertFalse(source.isExported(pn, unnamedModule),
+                            pn + " should not be exported to unnamed modules");
+
+            }
+
+        }
+    }
+
+    static void assertTrue(boolean cond) {
+        if (!cond) throw new RuntimeException();
+    }
+
+    static void assertTrue(boolean cond, String msg) {
+        if (!cond) throw new RuntimeException(msg);
+    }
+
+    static void assertFalse(boolean cond) {
+        if (cond) throw new RuntimeException();
+    }
+
+    static void assertFalse(boolean cond, String msg) {
+        if (cond) throw new RuntimeException(msg);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/AnnotationsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import jdk.internal.module.ClassFileAttributes;
+import jdk.internal.org.objectweb.asm.AnnotationVisitor;
+import jdk.internal.org.objectweb.asm.Attribute;
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Opcodes;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/**
+ * @test
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.module
+ *          java.xml
+ * @run testng AnnotationsTest
+ * @summary Basic test of annotations on modules
+ */
+
+public class AnnotationsTest {
+
+    /**
+     * Test that there are no annotations on an unnamed module.
+     */
+    @Test
+    public void testUnnamedModule() {
+        Module module = this.getClass().getModule();
+        assertTrue(module.getAnnotations().length == 0);
+    }
+
+    /**
+     * Test loading a module with a RuntimeVisibleAnnotation attribute.
+     * The test copies the module-info.class for java.xml, adds the attribute,
+     * and then loads the updated module.
+     */
+    @Test
+    public void testNamedModule() throws IOException {
+
+        // "deprecate" java.xml
+        Path dir = Files.createTempDirectory("mods");
+        deprecateModule("java.xml", true, "9", dir);
+
+        // "load" the cloned java.xml
+        Module module = loadModule(dir, "java.xml");
+
+        // check the annotation is present
+        assertTrue(module.isAnnotationPresent(Deprecated.class));
+        Deprecated d = module.getAnnotation(Deprecated.class);
+        assertNotNull(d, "@Deprecated not found");
+        assertTrue(d.forRemoval());
+        assertEquals(d.since(), "9");
+        Annotation[] a = module.getAnnotations();
+        assertTrue(a.length == 1);
+        assertTrue(a[0] instanceof Deprecated);
+    }
+
+
+    /**
+     * Copy the module-info.class for the given module, add the
+     * Deprecated annotation, and write the updated module-info.class
+     * to a directory.
+     */
+    static void deprecateModule(String name,
+                                boolean forRemoval,
+                                String since,
+                                Path output) throws IOException {
+        Module module = ModuleLayer.boot().findModule(name).orElse(null);
+        assertNotNull(module, name + " not found");
+
+        InputStream in = module.getResourceAsStream("module-info.class");
+        assertNotNull(in, "No module-info.class for " + name);
+
+        try (in) {
+            ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS
+                                             + ClassWriter.COMPUTE_FRAMES);
+
+            ClassVisitor cv = new ClassVisitor(Opcodes.ASM5, cw) { };
+
+            ClassReader cr = new ClassReader(in);
+
+            List<Attribute> attrs = new ArrayList<>();
+            attrs.add(new ClassFileAttributes.ModuleAttribute());
+            attrs.add(new ClassFileAttributes.ModulePackagesAttribute());
+            attrs.add(new ClassFileAttributes.ModuleTargetAttribute());
+            cr.accept(cv, attrs.toArray(new Attribute[0]), 0);
+
+            AnnotationVisitor annotationVisitor
+                = cv.visitAnnotation("Ljava/lang/Deprecated;", true);
+            annotationVisitor.visit("forRemoval", forRemoval);
+            annotationVisitor.visit("since", since);
+            annotationVisitor.visitEnd();
+
+            byte[] bytes = cw.toByteArray();
+            Path mi = output.resolve("module-info.class");
+            Files.write(mi, bytes);
+        }
+    }
+
+    /**
+     * Load the module of the given name in the given directory into a
+     * child layer.
+     */
+    static Module loadModule(Path dir, String name) throws IOException {
+        ModuleFinder finder = ModuleFinder.of(dir);
+
+        ModuleLayer bootLayer = ModuleLayer.boot();
+
+        Configuration cf = bootLayer.configuration()
+                .resolve(finder, ModuleFinder.of(), Set.of(name));
+
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
+
+        Module module = layer.findModule(name).orElse(null);
+        assertNotNull(module, name + " not loaded");
+        return module;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/BasicModuleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,329 @@
+/*
+ * 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
+ * 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.module.ModuleDescriptor.Exports;
+import java.lang.module.ResolvedModule;
+import java.nio.file.spi.FileSystemProvider;  // service type in java.base
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import javax.print.PrintServiceLookup;        // service type in java.desktop
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/*
+ * @test
+ * @summary Basic test of java.lang.Module
+ * @modules java.desktop java.xml
+ * @run testng BasicModuleTest
+ */
+
+public class BasicModuleTest {
+
+    /**
+     * Tests that the given module reads all modules in the boot layer.
+     */
+    private void testReadsAllBootModules(Module m) {
+        ModuleLayer bootLayer = ModuleLayer.boot();
+        bootLayer.configuration()
+            .modules()
+            .stream()
+            .map(ResolvedModule::name)
+            .map(bootLayer::findModule)
+            .forEach(target -> assertTrue(m.canRead(target.get())));
+    }
+
+    /**
+     * Returns a {@code Predicate} to test if a package is exported.
+     */
+    private Predicate<Exports> doesExport(String pn) {
+        return e -> (e.source().equals(pn) && !e.isQualified());
+    }
+
+
+
+    @Test
+    public void testThisModule() {
+        Module thisModule = BasicModuleTest.class.getModule();
+        Module baseModule = Object.class.getModule();
+
+        assertFalse(thisModule.isNamed());
+        assertTrue(thisModule.getName() == null);
+        assertTrue(thisModule.getDescriptor() == null);
+        assertTrue(thisModule.getLayer() == null);
+        assertTrue(thisModule.toString().startsWith("unnamed module "));
+
+        ClassLoader thisLoader = BasicModuleTest.class.getClassLoader();
+        assertTrue(thisLoader == thisModule.getClassLoader());
+        assertTrue(thisLoader.getUnnamedModule() == thisModule);
+
+        // unnamed modules read all other modules
+        ClassLoader cl;
+        cl = ClassLoader.getPlatformClassLoader();
+        assertTrue(thisModule.canRead(cl.getUnnamedModule()));
+        cl = ClassLoader.getSystemClassLoader();
+        assertTrue(thisModule.canRead(cl.getUnnamedModule()));
+        testReadsAllBootModules(thisModule);
+
+        // unnamed modules export all packages
+        assertTrue(thisModule.isExported(""));
+        assertTrue(thisModule.isExported("", thisModule));
+        assertTrue(thisModule.isExported("", baseModule));
+        assertTrue(thisModule.isExported("p"));
+        assertTrue(thisModule.isExported("p", thisModule));
+        assertTrue(thisModule.isExported("p", baseModule));
+
+        // this test is in the unnamed package
+        assertTrue(thisModule.getPackages().contains(""));
+    }
+
+
+    @Test
+    public void testUnnamedModules() {
+        Module thisModule = BasicModuleTest.class.getModule();
+        Module baseModule = Object.class.getModule();
+
+        ClassLoader loader1 = ClassLoader.getSystemClassLoader();
+        ClassLoader loader2 = loader1.getParent();
+
+        Module m1 = loader1.getUnnamedModule();
+        Module m2 = loader2.getUnnamedModule();
+
+        assertTrue(m1 != m2);
+
+        assertFalse(m1.isNamed());
+        assertFalse(m2.isNamed());
+
+        assertTrue(m1.getLayer() == null);
+        assertTrue(m2.getLayer() == null);
+
+        assertTrue(m1.toString().startsWith("unnamed module "));
+        assertTrue(m2.toString().startsWith("unnamed module "));
+
+        // unnamed module reads all modules
+        assertTrue(m1.canRead(m2));
+        assertTrue(m2.canRead(m1));
+
+        testReadsAllBootModules(m1);
+        testReadsAllBootModules(m2);
+
+        assertTrue(m1.isExported(""));
+        assertTrue(m1.isExported("", thisModule));
+        assertTrue(m1.isExported("", baseModule));
+        assertTrue(m1.isExported("p"));
+        assertTrue(m1.isExported("p", thisModule));
+        assertTrue(m1.isExported("p", baseModule));
+    }
+
+
+
+    @Test
+    public void testBaseModule() {
+        Module base = Object.class.getModule();
+        Module thisModule = BasicModuleTest.class.getModule();
+
+        // getName
+        assertTrue(base.getName().equals("java.base"));
+
+        // getDescriptor
+        assertTrue(base.getDescriptor().exports().stream()
+                .anyMatch(doesExport("java.lang")));
+
+        // getClassLoader
+        assertTrue(base.getClassLoader() == null);
+
+        // getLayer
+        assertTrue(base.getLayer() == ModuleLayer.boot());
+
+        // toString
+        assertEquals(base.toString(), "module java.base");
+
+        // getPackages
+        assertTrue(base.getPackages().contains("java.lang"));
+
+        // canRead
+        assertTrue(base.canRead(base));
+        assertFalse(base.canRead(thisModule));
+
+        // addReads
+        try {
+            base.addReads(thisModule);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        assertFalse(base.canRead(thisModule));
+
+        // isExported
+        assertTrue(base.isExported("java.lang"));
+        assertTrue(base.isExported("java.lang", thisModule));
+        assertTrue(base.isExported("java.lang", base));
+        assertFalse(base.isExported("jdk.internal.misc"));
+        assertFalse(base.isExported("jdk.internal.misc", thisModule));
+        assertTrue(base.isExported("jdk.internal.misc", base));
+        assertFalse(base.isExported("java.wombat"));
+        assertFalse(base.isExported("java.wombat", thisModule));
+        assertFalse(base.isExported("java.wombat", base));
+
+        // addExports
+        try {
+            base.addExports("java.lang", thisModule);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        try {
+            base.addExports("jdk.internal.misc", thisModule);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        assertFalse(base.isExported("jdk.internal.misc"));
+        assertFalse(base.isExported("jdk.internal.misc", thisModule));
+
+        // isOpen
+        assertFalse(base.isOpen("java.lang"));
+        assertFalse(base.isOpen("java.lang", thisModule));
+        assertTrue(base.isOpen("java.lang", base));
+        assertFalse(base.isOpen("jdk.internal.misc"));
+        assertFalse(base.isOpen("jdk.internal.misc", thisModule));
+        assertTrue(base.isOpen("jdk.internal.misc", base));
+        assertFalse(base.isOpen("java.wombat"));
+        assertFalse(base.isOpen("java.wombat", thisModule));
+        assertFalse(base.isOpen("java.wombat", base));
+
+        // addOpens
+        try {
+            base.addOpens("jdk.internal.misc", thisModule);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        assertFalse(base.isOpen("jdk.internal.misc"));
+        assertFalse(base.isOpen("jdk.internal.misc", thisModule));
+
+        // canUse
+        assertTrue(base.canUse(FileSystemProvider.class));
+        assertFalse(base.canUse(Thread.class));
+
+        // addUses
+        try {
+            base.addUses(FileSystemProvider.class);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        try {
+            base.addUses(Thread.class);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        assertFalse(base.canUse(Thread.class));
+    }
+
+
+    @Test
+    public void testDesktopModule() {
+        Module desktop = java.awt.Component.class.getModule();
+        Module base = Object.class.getModule();
+        Module xml = javax.xml.XMLConstants.class.getModule();
+        Module thisModule = BasicModuleTest.class.getModule();
+
+        // name
+        assertTrue(desktop.getName().equals("java.desktop"));
+
+        // descriptor
+        assertTrue(desktop.getDescriptor().exports().stream()
+                   .anyMatch(doesExport("java.awt")));
+
+        // getClassLoader
+        assertTrue(desktop.getClassLoader() == null);
+
+        // getLayer
+        assertTrue(desktop.getLayer() == ModuleLayer.boot());
+
+        // toString
+        assertEquals(desktop.toString(), "module java.desktop");
+
+        // getPackages
+        assertTrue(desktop.getPackages().contains("java.awt"));
+        assertTrue(desktop.getPackages().contains("sun.awt"));
+
+        // canRead
+        assertTrue(desktop.canRead(base));
+        assertTrue(desktop.canRead(xml));
+
+        // addReads
+        try {
+            desktop.addReads(thisModule);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        assertFalse(desktop.canRead(thisModule));
+
+        // isExported
+        assertTrue(desktop.isExported("java.awt"));
+        assertTrue(desktop.isExported("java.awt", thisModule));
+        assertFalse(desktop.isExported("sun.awt"));
+        assertFalse(desktop.isExported("sun.awt", thisModule));
+        assertTrue(desktop.isExported("sun.awt", desktop));
+        assertFalse(desktop.isExported("java.wombat"));
+        assertFalse(desktop.isExported("java.wombat", thisModule));
+        assertFalse(desktop.isExported("java.wombat", base));
+
+        // addExports
+        try {
+            desktop.addExports("java.awt", thisModule);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        try {
+            desktop.addExports("sun.awt", thisModule);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        assertFalse(desktop.isExported("sun.awt"));
+        assertFalse(desktop.isExported("sun.awt", thisModule));
+
+        // isOpen
+        assertFalse(desktop.isOpen("java.awt"));
+        assertFalse(desktop.isOpen("java.awt", thisModule));
+        assertTrue(desktop.isOpen("java.awt", desktop));
+        assertFalse(desktop.isOpen("sun.awt"));
+        assertFalse(desktop.isOpen("sun.awt", thisModule));
+        assertTrue(desktop.isOpen("sun.awt", desktop));
+        assertFalse(desktop.isOpen("java.wombat"));
+        assertFalse(desktop.isOpen("java.wombat", thisModule));
+        assertFalse(desktop.isOpen("java.wombat", desktop));
+
+        // addOpens
+        try {
+            base.addOpens("sun.awt", thisModule);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        assertFalse(desktop.isOpen("sun.awt"));
+        assertFalse(desktop.isOpen("sun.awt", thisModule));
+
+        // canUse
+        assertTrue(base.canUse(FileSystemProvider.class));
+        assertFalse(base.canUse(Thread.class));
+
+        // addUses
+        try {
+            desktop.addUses(PrintServiceLookup.class);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        try {
+            desktop.addUses(Thread.class);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+        assertFalse(desktop.canUse(Thread.class));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/WithSecurityManager.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @modules jdk.compiler
+ * @summary Test java.lang.Module methods that specify permission checks
+ * @run main/othervm -Djava.security.policy=${test.src}/allow.policy WithSecurityManager allow
+ * @run main/othervm WithSecurityManager deny
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * Test java.lang.Module methods that specify permission checks.
+ */
+
+public class WithSecurityManager {
+
+    // a module that will be loaded into a child layer
+    static final String ANOTHER_MODULE          = "jdk.compiler";
+    static final String ANOTHER_MODULE_RESOURCE = "com/sun/tools/javac/Main.class";
+
+    public static void main(String[] args) throws IOException {
+        boolean allow = args[0].equals("allow");
+
+        // base module, in the boot layer
+        Module base = Object.class.getModule();
+
+        // another module, in a child layer
+        Module other = loadModuleInChildLayer(ANOTHER_MODULE);
+        assertTrue(other.getLayer() != ModuleLayer.boot());
+
+        System.setSecurityManager(new SecurityManager());
+
+        test(base, "java/lang/Object.class", allow);
+        test(other, ANOTHER_MODULE_RESOURCE, allow);
+    }
+
+    /**
+     * Test the permission checks by invoking methods on the given module.
+     *
+     * If {@code allow} is {@code true} then the permission checks should succeed.
+     */
+    static void test(Module m, String name, boolean allow) throws IOException {
+
+        // test Module::getClassLoader
+        System.out.format("Test getClassLoader on %s ...%n", m);
+        try {
+            ClassLoader cl = m.getClassLoader();
+            System.out.println(cl);
+            if (!allow)
+                assertTrue("getClassLoader should have failed", false);
+        } catch (SecurityException e) {
+            System.out.println(e + " thrown");
+            if (allow)
+                throw e;
+        }
+
+        // test Module::getResourceAsStream
+        System.out.format("Test getResourceAsStream(\"%s\") on %s ...%n", name, m);
+        try (InputStream in = m.getResourceAsStream(name)) {
+            System.out.println(in);
+            if (allow && (in == null))
+                assertTrue(name + " not found", false);
+            if (!allow && (in != null))
+                assertTrue(name + " should not be found", false);
+        }
+
+    }
+
+    /**
+     * Create a module layer that contains the given system module.
+     */
+    static Module loadModuleInChildLayer(String mn) {
+        Optional<ModuleReference> omref = ModuleFinder.ofSystem().find(mn);
+        assertTrue("module " + mn + " not a system module", omref.isPresent());
+
+        // create a ModuleFinder that only finds this module
+        ModuleReference mref = omref.get();
+        ModuleFinder finder = new ModuleFinder() {
+            @Override
+            public Optional<ModuleReference> find(String name) {
+                if (name.equals(mn))
+                    return Optional.of(mref);
+                else
+                    return Optional.empty();
+            }
+
+            @Override
+            public Set<ModuleReference> findAll() {
+                return Collections.singleton(mref);
+            }
+        };
+
+        // create a child configuration and layer with this module
+        ModuleLayer bootLayer = ModuleLayer.boot();
+        Configuration cf = bootLayer
+            .configuration()
+            .resolve(finder, ModuleFinder.of(), Set.of(ANOTHER_MODULE));
+        ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, null);
+
+        Optional<Module> om = layer.findModule(mn);
+        assertTrue("module " + mn + " not in child layer", om.isPresent());
+        return om.get();
+    }
+
+    static void assertTrue(String msg, boolean e) {
+        if (!e)
+            throw new RuntimeException(msg);
+    }
+
+    static void assertTrue(boolean e) {
+        if (!e)
+            throw new RuntimeException();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/access/AccessTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+
+import static jdk.testlibrary.ProcessTools.executeTestJava;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/**
+ * @test
+ * @library /lib/testlibrary
+ * @modules jdk.compiler
+ * @build AccessTest CompilerUtils jdk.testlibrary.*
+ * @run testng AccessTest
+ * @summary Driver for test that checks access to access to types in
+ *          exported and non-exported packages.
+ */
+
+@Test
+public class AccessTest {
+
+    private static final String TEST_SRC = System.getProperty("test.src");
+
+    private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
+    private static final Path MODS_DIR = Paths.get("mods");
+
+
+    // the names of the modules in this test
+    private static List<String> modules = Arrays.asList("test", "target");
+
+
+    /**
+     * Compiles all modules used by the test
+     */
+    @BeforeTest
+    public void compileAll() throws Exception {
+        for (String mn : modules) {
+            Path src = SRC_DIR.resolve(mn);
+            Path mods = MODS_DIR.resolve(mn);
+            assertTrue(CompilerUtils.compile(src, mods));
+        }
+    }
+
+    /**
+     * Run the test
+     */
+    public void runTest() throws Exception {
+        int exitValue
+            = executeTestJava("--module-path", MODS_DIR.toString(),
+                              "--add-modules", "target",
+                              "-Dsun.reflect.enableStrictMode=true",
+                              "-m", "test/test.Main")
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .getExitValue();
+
+        assertTrue(exitValue == 0);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/access/src/target/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module target {
+    exports p1;
+    exports p2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/access/src/target/p1/Helper.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p1;
+
+/**
+ * Helper class in target module to allow test invoke addExports[Private]
+ */
+
+public class Helper {
+    Helper() { }
+
+    public static void addExports(String pn, Module who) {
+        Helper.class.getModule().addExports(pn, who);
+    }
+
+    public static void addOpens(String pn, Module who) {
+        Helper.class.getModule().addOpens(pn, who);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/access/src/target/p1/Public.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p1;
+
+public class Public {
+
+    // public constructor
+    public Public() { }
+
+    // non-public constructor
+    private Public(Void ignore) { }
+
+    // public field
+    public static Object f1;
+
+    // non-public field
+    private static Object f2;
+
+    // public method
+    public static void foo() { }
+
+    // non-public method
+    private static void bar() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/access/src/target/p2/NonPublic.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p2;
+
+class NonPublic {
+
+    // public constructor
+    public NonPublic() { }
+
+    // non-public constructor
+    private NonPublic(Void ignore) { }
+
+    // public field
+    public static Object f1;
+
+    // non-public field
+    private static Object f2;
+
+    // public method
+    public static void foo() { }
+
+    // non-public method
+    private static void bar() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/access/src/target/q1/Public.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package q1;
+
+public class Public {
+
+    // public constructor
+    public Public() { }
+
+    // non-public constructor
+    private Public(Void ignore) { }
+
+    // public field
+    public static Object f1;
+
+    // non-public field
+    private static Object f2;
+
+    // public method
+    public static void foo() { }
+
+    // non-public method
+    private static void bar() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/access/src/target/q2/NonPublic.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package q2;
+
+class NonPublic {
+
+    // public constructor
+    public NonPublic() { }
+
+    // non-public constructor
+    private NonPublic(Void ignore) { }
+
+    // public field
+    public static Object f1;
+
+    // non-public field
+    private static Object f2;
+
+    // public method
+    public static void foo() { }
+
+    // non-public method
+    private static void bar() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/access/src/test/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module test { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/access/src/test/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,377 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package test;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ * Test access to public/non-public members of public/non-public classes in
+ * exported and non-exported packages.
+ */
+
+public class Main {
+
+    public static void main(String[] args) throws Exception {
+        testPublicClassInExportedPackage();
+        testNonPublicClassInExportedPackage();
+        testPublicClassInNonExportedPackage();
+        testNonPublicClassInNonExportedPackage();
+    }
+
+    static void testPublicClassInExportedPackage() throws Exception {
+        Module thisModule = Main.class.getModule();
+        Module targetModule = getTargetModule();
+
+        assertTrue(targetModule.isExported("p1"));
+        assertTrue(targetModule.isExported("p1", thisModule));
+        assertTrue(targetModule.isExported("p1", targetModule));
+
+        assertFalse(targetModule.isOpen("p1"));
+        assertFalse(targetModule.isOpen("p1", thisModule));
+        assertTrue(targetModule.isOpen("p1", targetModule));
+
+        Class<?> clazz = Class.forName("p1.Public");
+        Constructor<?> ctor1 = clazz.getConstructor();   // public
+        Constructor<?> ctor2 = clazz.getDeclaredConstructor(Void.class); // non-public
+
+        Field f1 = clazz.getField("f1");    // public
+        Field f2 = clazz.getDeclaredField("f2");    // non-public
+
+        Method m1 = clazz.getMethod("foo");  // public
+        Method m2 = clazz.getDeclaredMethod("bar");  // non-public
+
+        tryAccessConstructor(ctor1, true);
+        tryAccessConstructor(ctor2, false);
+        tryAccessMethod(m1, true);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, true);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, true);
+        trySetAccessible(ctor2, false);
+        trySetAccessible(m1, true);
+        trySetAccessible(m2, false);
+        trySetAccessible(f1, true);
+        trySetAccessible(f2, false);
+
+        targetAddOpens("p1", thisModule);
+
+        tryAccessConstructor(ctor1, true);
+        tryAccessConstructor(ctor2, false);
+        tryAccessMethod(m1, true);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, true);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, true);
+        trySetAccessible(ctor2, true);
+        trySetAccessible(m1, true);
+        trySetAccessible(m2, true);
+        trySetAccessible(f1, true);
+        trySetAccessible(f2, true);
+    }
+
+    static void testNonPublicClassInExportedPackage() throws Exception {
+        Module thisModule = Main.class.getModule();
+        Module targetModule = getTargetModule();
+
+        assertTrue(targetModule.isExported("p2"));
+        assertTrue(targetModule.isExported("p2", thisModule));
+        assertTrue(targetModule.isExported("p2", targetModule));
+
+        assertFalse(targetModule.isOpen("p2"));
+        assertFalse(targetModule.isOpen("p2", thisModule));
+        assertTrue(targetModule.isOpen("p1", targetModule));
+
+        Class<?> clazz = Class.forName("p2.NonPublic");
+        Constructor<?> ctor1 = clazz.getConstructor();
+        Constructor<?> ctor2 = clazz.getDeclaredConstructor(Void.class);
+
+        Field f1 = clazz.getField("f1");    // public
+        Field f2 = clazz.getDeclaredField("f2");    // non-public
+
+        Method m1 = clazz.getMethod("foo");  // public
+        Method m2 = clazz.getDeclaredMethod("bar");  // non-public
+
+        tryAccessConstructor(ctor1, false);
+        tryAccessConstructor(ctor2, false);
+        tryAccessMethod(m1, false);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, false);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, false);
+        trySetAccessible(ctor2, false);
+        trySetAccessible(m1, false);
+        trySetAccessible(m2, false);
+        trySetAccessible(f1, false);
+        trySetAccessible(f2, false);
+
+        targetAddExports("p2", thisModule);
+
+        tryAccessConstructor(ctor1, false);
+        tryAccessConstructor(ctor2, false);
+        tryAccessMethod(m1, false);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, false);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, false);
+        trySetAccessible(ctor2, false);
+        trySetAccessible(m1, false);
+        trySetAccessible(m2, false);
+        trySetAccessible(f1, false);
+        trySetAccessible(f2, false);
+
+        targetAddOpens("p2", thisModule);
+
+        tryAccessConstructor(ctor1, false);
+        tryAccessConstructor(ctor2, false);
+        tryAccessMethod(m1, false);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, false);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, true);
+        trySetAccessible(ctor2, true);
+        trySetAccessible(m1, true);
+        trySetAccessible(m2, true);
+        trySetAccessible(f1, true);
+        trySetAccessible(f2, true);
+    }
+
+    static void testPublicClassInNonExportedPackage() throws Exception {
+        Module thisModule = Main.class.getModule();
+        Module targetModule = getTargetModule();
+
+        assertFalse(targetModule.isExported("q1"));
+        assertFalse(targetModule.isExported("q1", thisModule));
+        assertTrue(targetModule.isExported("q1", targetModule));
+
+        assertFalse(targetModule.isOpen("q1"));
+        assertFalse(targetModule.isOpen("q1", thisModule));
+        assertTrue(targetModule.isOpen("q1", targetModule));
+
+        Class<?> clazz = Class.forName("q1.Public");
+        Constructor<?> ctor1 = clazz.getConstructor();  // public
+        Constructor<?> ctor2 = clazz.getDeclaredConstructor(Void.class);  // non-public
+
+        Field f1 = clazz.getField("f1");    // public
+        Field f2 = clazz.getDeclaredField("f2");    // non-public
+
+        Method m1 = clazz.getMethod("foo");  // public
+        Method m2 = clazz.getDeclaredMethod("bar");  // non-public
+
+        tryAccessConstructor(ctor1, false);
+        tryAccessConstructor(ctor2, false);
+        tryAccessMethod(m1, false);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, false);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, false);
+        trySetAccessible(ctor2, false);
+        trySetAccessible(m1, false);
+        trySetAccessible(m2, false);
+        trySetAccessible(f1, false);
+        trySetAccessible(f2, false);
+
+        targetAddExports("q1", thisModule);
+
+        tryAccessConstructor(ctor1, true);
+        tryAccessConstructor(ctor2, false);
+        tryAccessMethod(m1, true);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, true);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, true);
+        trySetAccessible(ctor2, false);
+        trySetAccessible(m1, true);
+        trySetAccessible(m2, false);
+        trySetAccessible(f1, true);
+        trySetAccessible(f2, false);
+
+        targetAddOpens("q1", thisModule);
+
+        tryAccessConstructor(ctor1, true);
+        tryAccessConstructor(ctor1, false);
+        tryAccessMethod(m1, true);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, true);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, true);
+        trySetAccessible(ctor2, true);
+        trySetAccessible(m1, true);
+        trySetAccessible(m2, true);
+        trySetAccessible(f1, true);
+        trySetAccessible(f2, true);
+    }
+
+    static void testNonPublicClassInNonExportedPackage() throws Exception {
+        Module thisModule = Main.class.getModule();
+        Module targetModule = getTargetModule();
+
+        assertFalse(targetModule.isExported("q2"));
+        assertFalse(targetModule.isExported("q2", thisModule));
+        assertTrue(targetModule.isExported("q2", targetModule));
+
+        assertFalse(targetModule.isOpen("q2"));
+        assertFalse(targetModule.isOpen("q2", thisModule));
+        assertTrue(targetModule.isOpen("q2", targetModule));
+
+        Class<?> clazz = Class.forName("q2.NonPublic");
+        Constructor<?> ctor1 = clazz.getConstructor();  // public
+        Constructor<?> ctor2 = clazz.getDeclaredConstructor(Void.class);  // non-public
+
+        Field f1 = clazz.getField("f1");    // public
+        Field f2 = clazz.getDeclaredField("f2");    // non-public
+
+        Method m1 = clazz.getMethod("foo");  // public
+        Method m2 = clazz.getDeclaredMethod("bar");  // non-public
+
+        tryAccessConstructor(ctor1, false);
+        tryAccessConstructor(ctor2, false);
+        tryAccessMethod(m1, false);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, false);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, false);
+        trySetAccessible(ctor2, false);
+        trySetAccessible(m1, false);
+        trySetAccessible(m2, false);
+        trySetAccessible(f1, false);
+        trySetAccessible(f2, false);
+
+        targetAddExports("q2", thisModule);
+
+        tryAccessConstructor(ctor1, false);
+        tryAccessConstructor(ctor2, false);
+        tryAccessMethod(m1, false);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, false);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, false);
+        trySetAccessible(ctor2, false);
+        trySetAccessible(m1, false);
+        trySetAccessible(m2, false);
+        trySetAccessible(f1, false);
+        trySetAccessible(f2, false);
+
+        targetAddOpens("q2", thisModule);
+
+        tryAccessConstructor(ctor1, false);
+        tryAccessConstructor(ctor2, false);
+        tryAccessMethod(m1, false);
+        tryAccessMethod(m2, false);
+        tryAccessObjectField(f1, false);
+        tryAccessObjectField(f2, false);
+
+        trySetAccessible(ctor1, true);
+        trySetAccessible(m1, true);
+        trySetAccessible(m2, true);
+        trySetAccessible(f1, true);
+        trySetAccessible(f2, true);
+    }
+
+
+    static Module getTargetModule() {
+        return ModuleLayer.boot().findModule("target").get();
+    }
+
+    static void tryAccessConstructor(Constructor<?> ctor, boolean shouldSucceed) {
+        try {
+            ctor.newInstance();
+            assertTrue(shouldSucceed);
+        } catch (Exception e) {
+            assertFalse(shouldSucceed);
+        }
+    }
+
+    static void tryAccessMethod(Method method, boolean shouldSucceed) {
+        try {
+            method.invoke(null);
+            assertTrue(shouldSucceed);
+        } catch (Exception e) {
+            e.printStackTrace();
+            assertFalse(shouldSucceed);
+        }
+    }
+
+    static void tryAccessObjectField(Field f, boolean shouldSucceed) {
+        try {
+            f.get(null);
+            assertTrue(shouldSucceed);
+        } catch (Exception e) {
+            assertFalse(shouldSucceed);
+        }
+        try {
+            f.set(null, new Object());
+            assertTrue(shouldSucceed);
+        } catch (Exception e) {
+            assertFalse(shouldSucceed);
+        }
+    }
+
+    static void trySetAccessible(AccessibleObject ao, boolean shouldSucceed) {
+        try {
+            ao.setAccessible(true);
+            assertTrue(shouldSucceed);
+        } catch (Exception e) {
+            assertFalse(shouldSucceed);
+        }
+    }
+
+    /**
+     * Update target module to export a package to the given module.
+     */
+    static void targetAddExports(String pn, Module who) throws Exception {
+        Class<?> helper = Class.forName("p1.Helper");
+        Method m = helper.getMethod("addExports", String.class, Module.class);
+        m.invoke(null, pn, who);
+    }
+
+    /**
+     * Update target module to open a package to the given module.
+     */
+    static void targetAddOpens(String pn, Module who) throws Exception {
+        Class<?> helper = Class.forName("p1.Helper");
+        Method m = helper.getMethod("addOpens", String.class, Module.class);
+        m.invoke(null, pn, who);
+    }
+
+    static void assertTrue(boolean expr) {
+        if (!expr) throw new RuntimeException();
+    }
+
+    static void assertFalse(boolean expr) {
+        assertTrue(!expr);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/Driver.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @build test/* m1/* m2/* m3/* m4/*
+ * @run testng/othervm test/test.Main
+ * @summary Basic test case for Module::addXXX methods
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/m1/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+module m1 {
+    exports p1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/m1/p1/C.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package p1;
+
+public class C {
+    public C() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/m2/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+module m2 {
+    exports p2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/C.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package p2;
+
+public class C {
+
+    public static void export(String pn, Module m) {
+        C.class.getModule().addExports(pn, m);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/internal/C.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package p2.internal;
+
+public class C {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/m3/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+module m3 {
+    exports p3 to test;
+    opens p3 to test;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/m3/p3/C.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package p3;
+
+public class C {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/m4/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+module m4 {
+    exports p4;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/m4/p4/C.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package p4;
+
+import java.lang.reflect.Constructor;
+
+public class C {
+    public static Object tryNewInstance(Class<?> clazz) throws Exception {
+        Constructor<?> ctor = clazz.getDeclaredConstructor();
+        return ctor.newInstance();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/test/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+module test {
+    exports test to testng;
+
+    requires m2;
+    requires m3;
+    requires m4;
+    requires testng;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/test/test/C.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package test;
+
+public class C { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/test/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,195 @@
+/*
+ * 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 test;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.Constructor;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/**
+ * Basic test case for Module::addXXXX methods
+ */
+
+@Test
+public class Main {
+
+    /**
+     * Test Module::addReads
+     *
+     *     module test { }
+     *
+     *     module m1 {
+     *         exports p1;
+     *     }
+     */
+    public void testAddReads() throws Throwable {
+        Module thisModule = Main.class.getModule();
+        Class<?> clazz = Class.forName("p1.C");
+        Module m1 = clazz.getModule();
+
+        // test does not read m1
+        assertFalse(thisModule.canRead(m1));
+        MethodHandles.Lookup lookup = MethodHandles.lookup();
+        MethodType mt = MethodType.methodType(void.class);
+        try {
+            lookup.findConstructor(clazz, mt);
+            assertTrue(false);
+        } catch (IllegalAccessException expected) { }
+
+        // update test to read m1
+        Module result = thisModule.addReads(m1);
+        assertTrue(result== thisModule);
+        assertTrue(thisModule.canRead(m1));
+        MethodHandle mh = lookup.findConstructor(clazz, mt);
+        Object obj = mh.invoke();
+
+        // attempt to update m1 to read test
+        try {
+            m1.addReads(thisModule);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+    }
+
+
+    /**
+     * Test Module::addExports
+     *
+     *     module test {
+     *         requires m2;
+     *     }
+     *     module m2 {
+     *         exports p2;
+     *         contains package p2.internal;
+     *     }
+     */
+    public void testAddExports() throws Exception {
+        Module thisModule = Main.class.getModule();
+        Module m2 = p2.C.class.getModule();
+        Class<?> targetClass = Class.forName("p2.internal.C");
+        String p2Internal = targetClass.getPackageName();
+        assertTrue(targetClass.getModule() == m2);
+
+        // m2 does not export p2.internal to test
+        assertFalse(m2.isExported(p2Internal, thisModule));
+        Constructor<?> ctor = targetClass.getDeclaredConstructor();
+        try {
+            ctor.newInstance();
+            assertTrue(false);
+        } catch (IllegalAccessException expected) { }
+
+        // update m2 to export p2.internal to test
+        p2.C.export(p2Internal, thisModule);
+        assertTrue(m2.isExported(p2Internal, thisModule));
+        ctor.newInstance(); // should succeed
+
+        // attempt to update m2 to export a package to test
+        try {
+            m2.addExports("p2.other", thisModule);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+    }
+
+    /**
+     * Test Module::addOpens
+     *
+     *     module test {
+     *         requires m3;
+     *         requires m4;
+     *     }
+     *
+     *     module m3 {
+     *         exports p3 to test;
+     *         opens p3 to test;
+     *     }
+     *
+     *     module m4 {
+     *         exports p4;
+     *     }
+     */
+    public void testAddOpens() throws Exception {
+        Module thisModule = Main.class.getModule();
+        Module m3 = p3.C.class.getModule();
+        Module m4 = p4.C.class.getModule();
+
+        // test does not open package test to m4
+        assertFalse(thisModule.isOpen("test", m4));
+        try {
+            p4.C.tryNewInstance(test.C.class);
+            assertTrue(false);
+        } catch (IllegalAccessException expected) { }
+
+        // open test to m4
+        thisModule.addOpens("test", m4);
+        p4.C.tryNewInstance(test.C.class);  // should succeed
+
+
+        // m3 does not open p3 to m4
+        assertFalse(m3.isOpen("p3", m4));
+        try {
+            p4.C.tryNewInstance(p3.C.class);
+            assertTrue(false);
+        } catch (IllegalAccessException expected) { }
+
+
+        // m3 opens p3 to test => test allowed to open m3/p3 to m4
+        assertTrue(m3.isOpen("p3", thisModule));
+        m3.addOpens("p3", m4);
+        assertTrue(m3.isOpen("p3", m4));
+        p4.C.tryNewInstance(p3.C.class);   // should succeed
+
+
+        // attempt to update m4 to open package to m3
+        try {
+            m4.addOpens("p4", m3);
+            assertTrue(false);
+        } catch (IllegalCallerException expected) { }
+    }
+
+
+    /**
+     * Test Module::addUses
+     */
+    public void testAddUses() {
+        Module thisModule = Main.class.getModule();
+
+        assertFalse(thisModule.canUse(Service.class));
+        try {
+            ServiceLoader.load(Service.class);
+            assertTrue(false);
+        } catch (ServiceConfigurationError expected) { }
+
+        Module result = thisModule.addUses(Service.class);
+        assertTrue(result== thisModule);
+
+        assertTrue(thisModule.canUse(Service.class));
+        ServiceLoader.load(Service.class); // no exception
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/addXXX/test/test/Service.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package test;
+
+/**
+ * Simple service type
+ */
+public interface Service { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/allow.policy	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+grant {
+    permission java.lang.RuntimePermission "getClassLoader";
+    permission java.lang.RuntimePermission "accessSystemModules";
+    permission java.io.FilePermission "${java.home}/modules/-", "read";    // exploded build
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/annotation/Basic.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @library src
+ * @build m/* Basic
+ * @run testng/othervm Basic
+ * @summary Basic test for annotations on modules
+ */
+
+import java.util.Arrays;
+
+import p.annotation.Foo;
+import p.annotation.Bar;
+import p.annotation.Baz;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+public class Basic {
+
+    final Module module = Foo.class.getModule();
+
+    /**
+     * {@code @Foo} does not have RUNTIME retention policy.
+     */
+    @Test
+    public void testInvisibleAnnotation() {
+        assertFalse(module.isAnnotationPresent(Foo.class));
+        assertNull(module.getAnnotation(Foo.class));
+    }
+
+    /**
+     * {@code @Bar} has RUNTIME retention policy and value "bar"
+     */
+    @Test
+    public void testBarAnnotation() {
+        assertTrue(module.isAnnotationPresent(Bar.class));
+        Bar bar = module.getAnnotation(Bar.class);
+        assertNotNull(bar);
+        assertEquals(bar.value(), "bar");
+    }
+
+    /**
+     * {@code @Baz} has RUNTIME retention policy has a repeating value
+     */
+    @Test
+    public void testBazAnnotation() {
+        assertTrue(module.isAnnotationPresent(Baz.class));
+        Baz baz = module.getAnnotation(Baz.class);
+        assertNotNull(baz);
+        String[] expected = { "one", "two", "three" };
+        assertTrue(Arrays.equals(baz.value(), expected));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/annotation/src/m/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import p.annotation.*;
+
+@Foo
+@Bar("bar")
+@Baz({"one", "two", "three"})
+module m {
+    exports p.annotation;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/annotation/src/m/p/annotation/Bar.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.MODULE;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value={MODULE})
+public @interface Bar {
+   String value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/annotation/src/m/p/annotation/Baz.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.MODULE;
+
+@Target(value={MODULE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Baz {
+   String[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ModuleTests/annotation/src/m/p/annotation/Foo.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p.annotation;
+
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.MODULE;
+
+@Target(value={MODULE})
+public @interface Foo {}
--- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java	Mon Apr 10 08:31:37 2017 -0700
@@ -33,7 +33,6 @@
 
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReference;
-import java.lang.reflect.Layer;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Optional;
@@ -82,7 +81,7 @@
 
         void test() {
             final boolean isModulePresent =
-                        Layer.boot().findModule(moduleName).isPresent();
+                        ModuleLayer.boot().findModule(moduleName).isPresent();
             System.out.format("Testing module: %1$s. Module is%2$s present.\n",
                         moduleName, isModulePresent ? "" : " NOT");
 
--- a/jdk/test/java/lang/SecurityManager/CheckSecurityProvider.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/SecurityManager/CheckSecurityProvider.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  * @run main/othervm CheckSecurityProvider
  */
 
-import java.lang.reflect.Layer;
 import java.security.Provider;
 import java.security.Security;
 import java.util.ArrayList;
@@ -45,7 +44,7 @@
  */
 public class CheckSecurityProvider {
     public static void main(String[] args) throws Exception {
-        Layer layer = Layer.boot();
+        ModuleLayer layer = ModuleLayer.boot();
 
         System.setSecurityManager(new SecurityManager());
 
--- a/jdk/test/java/lang/SecurityManager/modules/Test.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/SecurityManager/modules/Test.java	Mon Apr 10 08:31:37 2017 -0700
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import java.lang.reflect.Module;
-
 public class Test {
     public static void main(String... args) {
         SecurityManager sm = System.getSecurityManager();
--- a/jdk/test/java/lang/StackTraceElement/PublicConstructor.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/StackTraceElement/PublicConstructor.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,6 @@
  */
 
 import java.lang.module.ModuleDescriptor;
-import java.lang.reflect.Module;
 
 public class PublicConstructor {
     public static void main(String... args) {
--- a/jdk/test/java/lang/StackTraceElement/lib/m1/com/app/Utils.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/StackTraceElement/lib/m1/com/app/Utils.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,7 +25,6 @@
 
 import java.lang.StackWalker.StackFrame;
 import java.lang.module.ModuleDescriptor;
-import java.lang.reflect.Module;
 import java.util.Objects;
 
 public class Utils {
--- a/jdk/test/java/lang/System/Logger/custom/CustomLoggerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/Logger/custom/CustomLoggerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -46,7 +46,6 @@
 import java.lang.System.Logger;
 import java.lang.System.Logger.Level;
 import java.util.stream.Stream;
-import java.lang.reflect.Module;
 import java.security.AllPermission;
 
 /**
--- a/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinder.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinder.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,7 +25,6 @@
 import java.security.PrivilegedAction;
 import java.lang.System.LoggerFinder;
 import java.lang.System.Logger;
-import java.lang.reflect.Module;
 
 public  class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
 
--- a/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/TestLoggerFinder.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/TestLoggerFinder.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,7 +30,6 @@
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.Supplier;
 import java.lang.System.Logger;
-import java.lang.reflect.Module;
 
 /**
  * What our test provider needs to implement.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,252 @@
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
+import java.lang.System.LoggerFinder;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Objects;
+import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
+// Can't use testng because testng requires java.logging
+//import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @bug 8177835
+ * @summary Checks that the DefaultLoggerFinder and LoggingProviderImpl
+ *          implementations of the System.LoggerFinder conform to the
+ *          LoggerFinder specification, in particular with respect to
+ *          throwing NullPointerException. The test uses --limit-module
+ *          to force the selection of one or the other.
+ * @author danielfuchs
+ * @build LoggerFinderAPI
+ * @run main/othervm --limit-modules java.base,java.logging
+ *          -Djava.util.logging.SimpleFormatter.format=LOG-%4$s:-[%2$s]-%5$s%6$s%n
+ *          LoggerFinderAPI
+ * @run main/othervm -Djdk.system.logger.format=LOG-%4$s:-[%2$s]-%5$s%6$s%n
+ *          --limit-modules java.base
+ *          LoggerFinderAPI
+ */
+public class LoggerFinderAPI {
+
+    // Simplified log format string. No white space for main/othervm line
+    static final String TEST_FORMAT = "LOG-%4$s:-[%2$s]-%5$s%6$s%n";
+    static final String JDK_FORMAT_PROP_KEY = "jdk.system.logger.format";
+    static final String JUL_FORMAT_PROP_KEY =
+        "java.util.logging.SimpleFormatter.format";
+
+    static class RecordStream extends OutputStream {
+        static final Object LOCK = new Object[0];
+        final PrintStream out;
+        final PrintStream err;
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        boolean record;
+        RecordStream(PrintStream out, PrintStream err) {
+            this.out = out;
+            this.err = err;
+        }
+
+        @Override
+        public void write(int i) throws IOException {
+            if (record) {
+                bos.write(i);
+                out.write(i);
+            } else {
+                err.write(i);
+            }
+        }
+
+        void startRecording() {
+            out.flush();
+            err.flush();
+            bos.reset();
+            record = true;
+        }
+        byte[] stopRecording() {
+            out.flush();
+            err.flush();
+            record = false;
+            return bos.toByteArray();
+        }
+    }
+
+    static final PrintStream ERR = System.err;
+    static final PrintStream OUT = System.out;
+    static final RecordStream LOG_STREAM = new RecordStream(OUT, ERR);
+    static {
+        Locale.setDefault(Locale.US);
+        PrintStream perr = new PrintStream(LOG_STREAM);
+        System.setErr(perr);
+    }
+
+    public static class MyResourceBundle extends ResourceBundle {
+        final ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
+        @Override
+        protected Object handleGetObject(String string) {
+            return map.computeIfAbsent(string, s -> "[localized] " + s);
+        }
+
+        @Override
+        public Enumeration<String> getKeys() {
+            return map.keys();
+        }
+
+    }
+
+    public static void main(String[] args) {
+        // Set on the command line, to ensure that the test will fail if
+        // the 'wrong' provider gets selected.
+        // System.setProperty(JDK_FORMAT_PROP_KEY, TEST_FORMAT);
+        // System.setProperty(JUL_FORMAT_PROP_KEY, TEST_FORMAT);
+        LoggerFinder finder = System.LoggerFinder.getLoggerFinder();
+        System.out.println("LoggerFinder is " + finder.getClass().getName());
+
+        LoggerFinderAPI apiTest = new LoggerFinderAPI();
+        for (Object[] params : getLoggerDataProvider()) {
+            apiTest.testGetLogger((String)params[0],
+                                  (String)params[1],
+                                  (Module)params[2],
+                                  Throwable.class.getClass().cast(params[3]));
+        }
+        for (Object[] params : getLocalizedLoggerDataProvider()) {
+            apiTest.testGetLocalizedLogger((String)params[0],
+                                  (String)params[1],
+                                  (ResourceBundle)params[2],
+                                  (Module)params[3],
+                                  Throwable.class.getClass().cast(params[4]));
+        }
+    }
+
+    //Can't use testng because testng requires java.logging
+    //@Test(dataProvider = "testGetLoggerDataProvider")
+    void testGetLogger(String desc, String name, Module mod, Class<? extends Throwable> thrown) {
+        try {
+            LoggerFinder finder = System.LoggerFinder.getLoggerFinder();
+            Logger logger = finder.getLogger(name, mod);
+            if (thrown != null) {
+                throw new AssertionError("Exception " + thrown.getName()
+                        + " not thrown for "
+                        + "LoggerFinder.getLogger"
+                        + " with " + desc);
+            }
+            // Make sure we don't fail if tests are run in parallel
+            synchronized(RecordStream.LOCK) {
+                LOG_STREAM.startRecording();
+                try {
+                    logger.log(Level.INFO, "{0} with {1}: PASSED",
+                               "LoggerFinder.getLogger",
+                               desc);
+                } finally {
+                    byte[] logged = LOG_STREAM.stopRecording();
+                    check(logged, "testGetLogger", desc, null,
+                          "LoggerFinder.getLogger");
+                }
+            }
+        } catch (Throwable x) {
+            if (thrown != null && thrown.isInstance(x)) {
+                System.out.printf("Got expected exception for %s with %s: %s\n",
+                        "LoggerFinder.getLogger", desc, String.valueOf(x));
+            } else throw x;
+        }
+    }
+
+    //Can't use testng because testng requires java.logging
+    //@Test(dataProvider = "getLocalizedLoggerDataProvider")
+    void testGetLocalizedLogger(String desc, String name, ResourceBundle bundle,
+                                Module mod, Class<? extends Throwable> thrown) {
+        try {
+            LoggerFinder finder = System.LoggerFinder.getLoggerFinder();
+            Logger logger = finder.getLocalizedLogger(name, bundle, mod);
+            if (thrown != null) {
+                throw new AssertionError("Exception " + thrown.getName()
+                        + " not thrown for "
+                        + "LoggerFinder.getLocalizedLogger"
+                        + " with " + desc);
+            }
+            // Make sure we don't fail if tests are run in parallel
+            synchronized(RecordStream.LOCK) {
+                LOG_STREAM.startRecording();
+                try {
+                    logger.log(Level.INFO, "{0} with {1}: PASSED",
+                              "LoggerFinder.getLocalizedLogger",
+                              desc);
+                } finally {
+                    byte[] logged = LOG_STREAM.stopRecording();
+                    check(logged, "testGetLocalizedLogger", desc, bundle,
+                          "LoggerFinder.getLocalizedLogger");
+                }
+            }
+        } catch (Throwable x) {
+            if (thrown != null && thrown.isInstance(x)) {
+                System.out.printf("Got expected exception for %s with %s: %s\n",
+                        "LoggerFinder.getLocalizedLogger", desc, String.valueOf(x));
+            } else throw x;
+        }
+    }
+
+    private void check(byte[] logged, String test, String desc,
+                       ResourceBundle bundle, String meth) {
+        String msg = new String(logged);
+        String expected = String.format(TEST_FORMAT, null,
+                "LoggerFinderAPI " + test, null, Level.INFO.name(),
+                (bundle==null?"":"[localized] ") + meth + " with " + desc + ": PASSED",
+                "");
+        if (!Objects.equals(msg, expected)) {
+            throw new AssertionError("Expected log message not found: "
+                                     + "\n\texpected:  " + expected
+                                     + "\n\tretrieved: " + msg);
+        }
+    }
+
+
+    static final Module MODULE = LoggerFinderAPI.class.getModule();
+    static final ResourceBundle BUNDLE = new MyResourceBundle();
+    static final Object[][] GET_LOGGER = {
+        {"null name", null, MODULE , NullPointerException.class},
+        {"null module", "foo", null, NullPointerException.class},
+        {"null name and module", null, null, NullPointerException.class},
+        {"non null name and module", "foo", MODULE, null},
+    };
+    static final Object[][] GET_LOCALIZED_LOGGER = {
+        {"null name", null, BUNDLE, MODULE , NullPointerException.class},
+        {"null module", "foo", BUNDLE, null, NullPointerException.class},
+        {"null name and module", null, BUNDLE, null, NullPointerException.class},
+        {"non null name and module", "foo", BUNDLE, MODULE, null},
+        {"null name and bundle", null, null, MODULE , NullPointerException.class},
+        {"null module and bundle", "foo", null, null, NullPointerException.class},
+        {"null name and module and bundle", null, null, null, NullPointerException.class},
+        {"non null name and module, null bundle", "foo", null, MODULE, null},
+    };
+    public static Object[][] getLoggerDataProvider() {
+        return GET_LOGGER;
+    }
+    public static Object[][] getLocalizedLoggerDataProvider() {
+        return GET_LOCALIZED_LOGGER;
+    }
+}
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -55,7 +55,6 @@
 import jdk.internal.logger.DefaultLoggerFinder;
 import jdk.internal.logger.SimpleConsoleLogger;
 import sun.util.logging.PlatformLogger;
-import java.lang.reflect.Module;
 
 /**
  * @test
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -47,7 +47,6 @@
 import java.lang.System.Logger;
 import java.lang.System.Logger.Level;
 import java.util.stream.Stream;
-import java.lang.reflect.Module;
 
 /**
  * @test
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -47,7 +47,6 @@
 import java.security.AccessControlException;
 import java.util.stream.Stream;
 import sun.util.logging.PlatformLogger;
-import java.lang.reflect.Module;
 
 /**
  * @test
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,7 +30,6 @@
 import java.util.List;
 import java.util.ResourceBundle;
 import java.util.Set;
-import java.lang.reflect.Module;
 import jdk.internal.logger.BootstrapLogger;
 import jdk.internal.logger.LazyLoggers;
 
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -43,7 +43,6 @@
 import java.util.stream.Stream;
 import jdk.internal.logger.BootstrapLogger;
 import jdk.internal.logger.LazyLoggers;
-import java.lang.reflect.Module;
 
 /*
  * @test
--- a/jdk/test/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -51,7 +51,6 @@
 import java.lang.System.Logger.Level;
 import java.util.stream.Stream;
 import sun.util.logging.PlatformLogger;
-import java.lang.reflect.Module;
 
 /**
  * @test
--- a/jdk/test/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -53,7 +53,6 @@
 import java.util.ServiceLoader;
 import java.util.concurrent.atomic.AtomicReference;
 import jdk.internal.logger.SimpleConsoleLogger;
-import java.lang.reflect.Module;
 
 /**
  * @test
--- a/jdk/test/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -49,7 +49,6 @@
 import java.lang.System.Logger.Level;
 import java.util.stream.Stream;
 import sun.util.logging.PlatformLogger;
-import java.lang.reflect.Module;
 
 /**
  * @test
--- a/jdk/test/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
 
 /*
@@ -106,7 +105,7 @@
         }
         Class<?> platformLoggerType = platformLogger.getClass();
         System.out.println("platformLogger: " + platformLoggerType);
-        boolean simpleConsoleOnly = !Layer.boot().findModule("java.logging").isPresent();
+        boolean simpleConsoleOnly = !ModuleLayer.boot().findModule("java.logging").isPresent();
         if (simpleConsoleOnly) {
             /* Happens if the test is called with custom JDK without java.logging module
                or in case usage commandline option --limit-modules java.base */
--- a/jdk/test/java/lang/System/LoggerFinder/internal/backend/LoggerFinderBackendTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/backend/LoggerFinderBackendTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -78,7 +78,6 @@
 import java.util.logging.LogRecord;
 import java.util.logging.Logger;
 import sun.util.logging.internal.LoggingProviderImpl;
-import java.lang.reflect.Module;
 
 /**
  * @author danielfuchs
--- a/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -48,7 +48,6 @@
 import java.lang.System.Logger;
 import java.util.stream.Stream;
 import sun.util.logging.internal.LoggingProviderImpl;
-import java.lang.reflect.Module;
 
 /**
  * @test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/WeakPairMap/Driver.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8888888
+ * @summary Functional test for WeakPairMap
+ * @build java.base/java.lang.WeakPairMapTest
+ * @run main Driver
+ */
+public class Driver {
+    public static void main(String[] args) {
+        java.lang.WeakPairMapTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/WeakPairMap/java.base/java/lang/WeakPairMapTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+import java.lang.ref.Reference;
+import java.util.Objects;
+
+/**
+ * Functional test for WeakPairMap
+ *
+ * @author Peter Levart
+ */
+public class WeakPairMapTest {
+    public static void main(String[] args) {
+        WeakPairMap<Object, Object, String> pm = new WeakPairMap<>();
+        Object key1 = new Object();
+        Object key2 = new Object();
+
+        // check for emptiness
+        assertEquals(pm.containsKeyPair(key1, key2), false);
+        assertEquals(pm.get(key1, key2), null);
+
+        // check for NPE(s)
+        for (Object k1 : new Object[]{null, key1}) {
+            for (Object k2 : new Object[]{null, key2}) {
+                for (String v : new String[]{null, "abc"}) {
+
+                    if (k1 != null && k2 != null && v != null) {
+                        // skip non-null args
+                        continue;
+                    }
+
+                    try {
+                        pm.put(k1, k2, v);
+                        throw new AssertionError("Unexpected code path, k1=" +
+                                                 k1 + ", k2=" + k2 + ", v=" + v);
+                    } catch (NullPointerException e) {
+                        // expected
+                    }
+
+                    try {
+                        pm.putIfAbsent(k1, k2, v);
+                        throw new AssertionError("Unexpected code path, k1=" +
+                                                 k1 + ", k2=" + k2 + ", v=" + v);
+                    } catch (NullPointerException e) {
+                        // expected
+                    }
+
+                    if (k1 != null && k2 != null) {
+                        // skip non-null args
+                        continue;
+                    }
+
+                    try {
+                        pm.computeIfAbsent(k1, k2, (_k1, _k2) -> v);
+                        throw new AssertionError("Unexpected code path, k1=" +
+                                                 k1 + ", k2=" + k2 + ", v=" + v);
+                    } catch (NullPointerException e) {
+                        // expected
+                    }
+
+                    try {
+                        pm.containsKeyPair(k1, k2);
+                        throw new AssertionError("Unexpected code path, k1=" +
+                                                 k1 + ", k2=" + k2);
+                    } catch (NullPointerException e) {
+                        // expected
+                    }
+
+                    try {
+                        pm.get(k1, k2);
+                        throw new AssertionError("Unexpected code path, k1=" +
+                                                 k1 + ", k2=" + k2);
+                    } catch (NullPointerException e) {
+                        // expected
+                    }
+                }
+            }
+        }
+
+        // how much to wait when it is expected for entry to be retained
+        final long retentionTimeout = 500L;
+        // how much to wait when it is expected for entry to be removed
+        final long cleanupTimeout = 30_000L;
+
+        // check insertion
+        assertEquals(pm.putIfAbsent(key1, key2, "abc"), null);
+        assertEquals(pm.get(key1, key2), "abc");
+
+        // check retention while both keys are still reachable
+        assertEquals(gcAndWaitRemoved(pm, "abc", retentionTimeout), false);
+        assertEquals(pm.get(key1, key2), "abc");
+
+        // check cleanup when both keys are unreachable
+        key1 = null;
+        key2 = null;
+        assertEquals(gcAndWaitRemoved(pm, "abc", cleanupTimeout), true);
+
+        // new insertion
+        key1 = new Object();
+        key2 = new Object();
+        assertEquals(pm.putIfAbsent(key1, key2, "abc"), null);
+        assertEquals(pm.get(key1, key2), "abc");
+
+        // check retention while both keys are still reachable
+        assertEquals(gcAndWaitRemoved(pm, "abc", retentionTimeout), false);
+        assertEquals(pm.get(key1, key2), "abc");
+
+        // check cleanup when 1st key is unreachable
+        key1 = null;
+        assertEquals(gcAndWaitRemoved(pm, "abc", cleanupTimeout), true);
+        Reference.reachabilityFence(key2);
+
+        // new insertion
+        key1 = new Object();
+        key2 = new Object();
+        assertEquals(pm.putIfAbsent(key1, key2, "abc"), null);
+        assertEquals(pm.get(key1, key2), "abc");
+
+        // check retention while both keys are still reachable
+        assertEquals(gcAndWaitRemoved(pm, "abc", retentionTimeout), false);
+        assertEquals(pm.get(key1, key2), "abc");
+
+        // check cleanup when 2nd key is unreachable
+        key2 = null;
+        assertEquals(gcAndWaitRemoved(pm, "abc", cleanupTimeout), true);
+        Reference.reachabilityFence(key1);
+    }
+
+    /**
+     * Trigger GC and wait for at most {@code millis} ms for given value to
+     * be removed from given WeakPairMap.
+     *
+     * @return true if element has been removed or false if not
+     */
+    static <V> boolean gcAndWaitRemoved(WeakPairMap<?, ?, V> pm, V value,
+                                        long millis) {
+        System.gc();
+        for (int i = 0; i < (millis + 99) / 100 && pm.values().contains(value); i++) {
+            try {
+                Thread.sleep(100L);
+            } catch (InterruptedException e) {
+                throw new AssertionError("Interrupted");
+            }
+        }
+        return !pm.values().contains(value);
+    }
+
+    static void assertEquals(Object actual, Object expected) {
+        if (!Objects.equals(actual, expected)) {
+            throw new AssertionError("Expected: " + expected + ", actual: " + actual);
+        }
+    }
+}
--- a/jdk/test/java/lang/instrument/ATransformerManagementTestCase.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/instrument/ATransformerManagementTestCase.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,8 +24,6 @@
 
 import java.io.*;
 import java.lang.instrument.*;
-
-import java.lang.reflect.Module;
 import java.security.ProtectionDomain;
 import java.util.*;
 
--- a/jdk/test/java/lang/instrument/BootstrapClassPathAgent.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/instrument/BootstrapClassPathAgent.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
 import java.io.*;
 import java.lang.instrument.ClassFileTransformer;
 import java.lang.instrument.Instrumentation;
-import java.lang.reflect.Module;
 import java.security.ProtectionDomain;
 
 public class BootstrapClassPathAgent {
--- a/jdk/test/java/lang/instrument/BootstrapClassPathTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/instrument/BootstrapClassPathTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -33,7 +33,6 @@
 
 import java.io.*;
 import java.lang.instrument.*;
-import java.lang.reflect.Module;
 import java.security.ProtectionDomain;
 
 public class BootstrapClassPathTest {
--- a/jdk/test/java/lang/instrument/RedefineClassWithNativeMethodAgent.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/instrument/RedefineClassWithNativeMethodAgent.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,7 +24,6 @@
 import java.io.InputStream;
 import java.lang.instrument.ClassDefinition;
 import java.lang.instrument.Instrumentation;
-import java.lang.reflect.Module;
 import java.util.Timer;
 import java.util.TimerTask;
 
--- a/jdk/test/java/lang/instrument/RedefineModuleAgent.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/instrument/RedefineModuleAgent.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
  */
 
 import java.lang.instrument.Instrumentation;
-import java.lang.reflect.Module;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -47,4 +46,8 @@
                                Map<Class<?>, List<Class<?>>> extraProvides) {
         inst.redefineModule(module, extraReads, extraExports, extraOpens, extraUses, extraProvides);
     }
+
+    static boolean isModifiableModule(Module module) {
+        return inst.isModifiableModule(module);
+    }
 }
--- a/jdk/test/java/lang/instrument/RedefineModuleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/instrument/RedefineModuleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /**
  * @test
  * @summary Basic test for redefineModule
- * @modules java.instrument
+ *
  * @build java.base/java.lang.TestProvider
  *        java.base/jdk.internal.test.TestProviderImpl1
  *        java.base/jdk.internal.test.TestProviderImpl2
@@ -34,8 +34,6 @@
 
 import java.lang.TestProvider;
 import java.lang.instrument.Instrumentation;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.net.URLStreamHandler;
 import java.net.spi.URLStreamHandlerProvider;
 import java.nio.file.FileSystems;
@@ -68,6 +66,10 @@
                                            extraProvides);
     }
 
+    static boolean isModifiableModule(Module module) {
+        return RedefineModuleAgent.isModifiableModule(module);
+    }
+
 
     /**
      * Use redefineModule to update java.base to read java.instrument
@@ -138,13 +140,13 @@
         // pre-conditions
         assertFalse(baseModule.canUse(service));
         assertTrue(collect(ServiceLoader.load(service)).isEmpty());
-        assertTrue(collect(ServiceLoader.load(Layer.boot(), service)).isEmpty());
+        assertTrue(collect(ServiceLoader.load(ModuleLayer.boot(), service)).isEmpty());
 
         // update java.base to use TestProvider
         redefineModule(baseModule, Set.of(), Map.of(), Map.of(), Set.of(service), Map.of());
         assertTrue(baseModule.canUse(service));
         assertTrue(collect(ServiceLoader.load(service)).isEmpty());
-        assertTrue(collect(ServiceLoader.load(Layer.boot(), service)).isEmpty());
+        assertTrue(collect(ServiceLoader.load(ModuleLayer.boot(), service)).isEmpty());
 
         // update java.base to provide an implementation of TestProvider
         Class<?> type1 = Class.forName("jdk.internal.test.TestProviderImpl1");
@@ -162,7 +164,7 @@
         assertTrue(containsInstanceOf(collect(providers), type1));
 
         // use ServiceLoader to load implementations in the boot layer
-        providers = collect(ServiceLoader.load(Layer.boot(), service));
+        providers = collect(ServiceLoader.load(ModuleLayer.boot(), service));
         assertTrue(collect(providers).size() == 1);
         assertTrue(containsInstanceOf(collect(providers), type1));
 
@@ -184,7 +186,7 @@
         assertTrue(containsInstanceOf(providers, type2));
 
         // use ServiceLoader to load implementations in the boot layer
-        providers = collect(ServiceLoader.load(Layer.boot(), service));
+        providers = collect(ServiceLoader.load(ModuleLayer.boot(), service));
         assertTrue(collect(providers).size() == 2);
         assertTrue(containsInstanceOf(providers, type1));
         assertTrue(containsInstanceOf(providers, type2));
@@ -279,6 +281,19 @@
     }
 
     /**
+     * Exercise IsModifiableModule
+     */
+    @Test
+    public void testIsModifiableModule() {
+        ClassLoader pcl = ClassLoader.getPlatformClassLoader();
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        assertTrue(isModifiableModule(pcl.getUnnamedModule()));
+        assertTrue(isModifiableModule(scl.getUnnamedModule()));
+        assertTrue(isModifiableModule(RedefineModuleTest.class.getModule()));
+        assertTrue(isModifiableModule(Object.class.getModule()));
+    }
+
+    /**
      * Test redefineClass with null
      */
     public void testNulls() {
--- a/jdk/test/java/lang/instrument/RetransformAgent.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/instrument/RetransformAgent.java	Mon Apr 10 08:31:37 2017 -0700
@@ -34,7 +34,6 @@
  */
 
 import java.lang.instrument.*;
-import java.lang.reflect.Module;
 import java.security.ProtectionDomain;
 import java.io.*;
 import asmlib.*;
--- a/jdk/test/java/lang/instrument/SimpleIdentityTransformer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/instrument/SimpleIdentityTransformer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,7 +24,6 @@
 import java.lang.instrument.Instrumentation;
 import java.lang.instrument.ClassFileTransformer;
 
-import java.lang.reflect.Module;
 import java.security.*;
 
 /*
--- a/jdk/test/java/lang/instrument/TestAgentWithLimitMods.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/instrument/TestAgentWithLimitMods.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @test
  * @summary Tests that the -javaagent option adds the java.instrument into
  * the module graph
- * @modules java.instrument
+ *
  * @run shell MakeJAR3.sh SimpleAgent
  * @run main/othervm -javaagent:SimpleAgent.jar --limit-modules java.base TestAgentWithLimitMods
  *
--- a/jdk/test/java/lang/invoke/MethodHandles/privateLookupIn/test/p/PrivateLookupInTests.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/invoke/MethodHandles/privateLookupIn/test/p/PrivateLookupInTests.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 
 import static java.lang.invoke.MethodHandles.Lookup.*;
 
--- a/jdk/test/java/lang/invoke/modules/m1/p1/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/invoke/modules/m1/p1/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,8 +27,6 @@
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.invoke.MethodType;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 
 import static java.lang.invoke.MethodHandles.Lookup.*;
 
@@ -64,14 +62,14 @@
         }
 
         // check setup
-        Module m1 = Layer.boot().findModule("m1").orElse(null);
+        Module m1 = ModuleLayer.boot().findModule("m1").orElse(null);
         assertNotNull(m1);
         assertTrue(p1_Type1.getModule() == m1);
         assertTrue(p2_Type2.getModule() == m1);
         assertTrue(m1.isExported("p1"));
         assertFalse(m1.isExported("p2"));
 
-        Module m2 = Layer.boot().findModule("m2").orElse(null);
+        Module m2 = ModuleLayer.boot().findModule("m2").orElse(null);
         assertNotNull(m2);
         assertTrue(q1_Type1.getModule() == m2);
         assertTrue(q2_Type2.getModule() == m2);
--- a/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  *                             ClassLoadingMXBean.getTotalLoadedClassCount()
  *                             ClassLoadingMXBean.getUnloadedClassCount()
  * @author  Alexei Guibadoulline
- * @modules java.management
+ *
  * @run main/othervm LoadCounts
  */
 
--- a/jdk/test/java/lang/management/CompilationMXBean/Basic.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/CompilationMXBean/Basic.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 5011189 8004928
  * @summary Unit test for java.lang.management.CompilationMXBean
  *
- * @modules java.management
  * @run main/othervm -Xcomp -Xbatch Basic
  */
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/CompositeData/MemoryUsageCompositeData.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/CompositeData/MemoryUsageCompositeData.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          or throw exception if the input CompositeData is invalid.
  * @author  Mandy Chung
  *
- * @modules java.management
  * @build MemoryUsageCompositeData
  * @run main MemoryUsageCompositeData
  */
--- a/jdk/test/java/lang/management/CompositeData/ThreadInfoCompositeData.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/CompositeData/ThreadInfoCompositeData.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,6 @@
  *          the input CompositeData is invalid.
  * @author  Mandy Chung
  *
- * @modules java.management
  * @compile OpenTypeConverter.java
  * @build ThreadInfoCompositeData
  * @run main ThreadInfoCompositeData
--- a/jdk/test/java/lang/management/ManagementFactory/GetObjectName.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/GetObjectName.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @summary Test if getObjectName handles properly when called by
  *          multiple threads simultaneously. Run in othervm mode to
  *          make sure the object name is not initialized to begin with.
- * @modules java.management
+ *
  * @run main/othervm GetObjectName
  */
 
--- a/jdk/test/java/lang/management/ManagementFactory/GetPlatformMXBeans.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/GetPlatformMXBeans.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          methods and PlatformManagedObject.getObjectName()
  * @author  Mandy Chung
  *
- * @modules jdk.management
  * @run main GetPlatformMXBeans
  */
 
--- a/jdk/test/java/lang/management/ManagementFactory/GetPlatformManagementInterfaces.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/GetPlatformManagementInterfaces.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          ManagementFactory.getPlatformManagementInterfaces() method
  * @author  Frederic Parain
  *
- * @modules jdk.management
  * @run main GetPlatformManagementInterfaces
  */
 
--- a/jdk/test/java/lang/management/ManagementFactory/MBeanServerMXBeanUnsupportedTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/MBeanServerMXBeanUnsupportedTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that all the platform MXBeans are wrapped in StandardMBean so
  *          an MBeanServer which does not have support for MXBeans can be used.
  * @author Luis-Miguel Alventosa
- * @modules jdk.management
+ *
  * @run clean MBeanServerMXBeanUnsupportedTest
  * @run build MBeanServerMXBeanUnsupportedTest
  * @run main/othervm MBeanServerMXBeanUnsupportedTest
--- a/jdk/test/java/lang/management/ManagementFactory/MXBeanException.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/MXBeanException.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,6 @@
  *
  * @author  Mandy Chung
  *
- * @modules jdk.management
  * @build MXBeanException
  * @run main MXBeanException
  */
--- a/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,9 +25,9 @@
  * @test
  * @bug     5024531
  * @summary Basic Test for ManagementFactory.newPlatformMXBean().
- * @modules jdk.management
+ * @author  Mandy Chung
+ *
  * @run main/othervm MXBeanProxyTest
- * @author  Mandy Chung
  */
 import javax.management.*;
 import java.lang.management.ClassLoadingMXBean;
--- a/jdk/test/java/lang/management/ManagementFactory/PlatformMBeanServerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/PlatformMBeanServerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,9 @@
  * @bug     4947536
  * @summary Basic unit test of ManagementFactory.getPlatformMBeanServer()
  * @author  Mandy Chung
- * @modules jdk.management
+ *
+ * @modules java.logging
+ *          jdk.management
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/ManagementFactory/ProxyExceptions.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/ProxyExceptions.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Test type mapping of the platform MXBean proxy
  *          returned from Management.newPlatformMXBeanProxy().
  * @author  Mandy Chung
- * @modules jdk.management
  */
 import java.lang.management.*;
 import javax.management.*;
--- a/jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          returned from Management.newPlatformMXBeanProxy().
  * @author  Mandy Chung
  *
- * @modules jdk.management
  * @compile ProxyTypeMapping.java
  * @run main/othervm -verbose:gc ProxyTypeMapping
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/management/ManagementFactory/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = jdk.management
+
--- a/jdk/test/java/lang/management/ManagementFactory/ThreadMXBeanProxy.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/ThreadMXBeanProxy.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,10 +26,8 @@
  * @bug     5086470 6358247 7193302
  * @summary Test type conversion when invoking ThreadMXBean.dumpAllThreads
  *          through proxy.
- *
  * @author  Mandy Chung
  *
- * @modules jdk.management
  * @run main ThreadMXBeanProxy
  */
 
--- a/jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          MBeanServer.
  * @author  Mandy Chung
  *
- * @modules jdk.management
  * @compile ValidateOpenTypes.java
  * @run main/othervm -verbose:gc ValidateOpenTypes
  */
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,17 +27,16 @@
  * @summary Basic unit test of memory management testing:
  *          1) setUsageThreshold() and getUsageThreshold()
  *          2) test low memory detection on the old generation.
- *
  * @author  Mandy Chung
  *
- * @library /lib/testlibrary/
- * @modules java.management
- * @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil
- * @run main/timeout=600 LowMemoryTest
  * @requires vm.gc == "null"
  * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
  * @requires vm.opt.ExplicitGCInvokesConcurrentAndUnloadsClasses != "true"
  * @requires vm.opt.DisableExplicitGC != "true"
+ * @library /lib/testlibrary/
+ *
+ * @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil
+ * @run main/timeout=600 LowMemoryTest
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -25,8 +25,9 @@
 # @test
 # @bug     4982128
 # @summary Test low memory detection of non-heap memory pool
+#
 # @requires vm.gc=="null"
-# @modules java.management
+#
 # @run build LowMemoryTest2 MemoryUtil
 # @run shell/timeout=600 LowMemoryTest2.sh
 #
@@ -51,10 +52,10 @@
 }
 
 # Run test with each GC configuration
-# 
+#
 # Notes: To ensure that metaspace fills up we disable class unloading.
 # Also we set the max metaspace to 8MB - otherwise the test takes too
-# long to run. 
+# long to run.
 
 go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseSerialGC LowMemoryTest2
 go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseParallelGC LowMemoryTest2
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -26,8 +26,9 @@
 # @bug     4530538
 # @summary Run MemoryManagement test with concurrent mark sweep GC
 # @author  Mandy Chung
+#
 # @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
-# @modules java.management
+#
 # @run build MemoryManagement
 # @run shell/timeout=600 MemoryManagementConcMarkSweepGC.sh
 #
@@ -42,7 +43,7 @@
 fi
 
 runOne()
-{ 
+{
    echo "runOne $@"
    $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2
 }
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -26,8 +26,9 @@
 # @bug     4530538
 # @summary Run MemoryManagement test with parallel GC
 # @author  Mandy Chung
+#
 # @requires vm.gc=="Parallel" | vm.gc=="null"
-# @modules java.management
+#
 # @run build MemoryManagement
 # @run shell/timeout=600 MemoryManagementParallelGC.sh
 #
@@ -42,7 +43,7 @@
 fi
 
 runOne()
-{ 
+{
    echo "runOne $@"
    $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2
 }
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -26,8 +26,9 @@
 # @bug     4530538
 # @summary Run MemoryManagement test with serial GC
 # @author  Mandy Chung
+#
 # @requires vm.gc=="Serial" | vm.gc=="null"
-# @modules java.management
+#
 # @run build MemoryManagement
 # @run shell/timeout=600 MemoryManagementSerialGC.sh
 #
@@ -42,7 +43,7 @@
 fi
 
 runOne()
-{ 
+{
    echo "runOne $@"
    $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2
 }
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryTestAllGC.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryTestAllGC.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -24,10 +24,11 @@
 #
 # @test
 # @bug     4530538
-# @summary 
+# @summary
 # @author  Mandy Chung
+#
 # @requires vm.gc=="Parallel" | vm.gc=="null"
-# @modules java.management
+#
 # @run compile MemoryTest.java
 # @run shell MemoryTestAllGC.sh
 #
@@ -42,7 +43,7 @@
 fi
 
 runOne()
-{ 
+{
    echo "runOne $@"
    $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2
 }
--- a/jdk/test/java/lang/management/MemoryMXBean/Pending.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/MemoryMXBean/Pending.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,8 +24,6 @@
 /*
  * @test
  * @bug     4530538
- * @modules java.base/jdk.internal.misc
- *          java.management
  * @summary Basic unit test of
  *          RuntimeMXBean.getObjectPendingFinalizationCount()
  *          1. GC and runFinalization() to get the current pending number
@@ -34,6 +32,9 @@
  *          4. GC and runFinalization() and the finalizable objects should
  *             be garbage collected.
  * @author  Alexei Guibadoulline and Mandy Chung
+ *
+ * @modules java.base/jdk.internal.misc
+ *          java.management
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Mon Apr 10 08:31:37 2017 -0700
@@ -32,13 +32,14 @@
  * @summary Basic Test for MemoryPool.resetPeakUsage()
  * @author  Mandy Chung
  *
- * @library /lib/testlibrary/
- * @modules jdk.management
- * @build jdk.testlibrary.* ResetPeakMemoryUsage MemoryUtil RunUtil
- * @run main ResetPeakMemoryUsage
  * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
  * @requires vm.opt.ExplicitGCInvokesConcurrentAndUnloadsClasses != "true"
  * @requires vm.opt.DisableExplicitGC != "true"
+ * @library /lib/testlibrary/
+ * @modules jdk.management
+ *
+ * @build jdk.testlibrary.* ResetPeakMemoryUsage MemoryUtil RunUtil
+ * @run main ResetPeakMemoryUsage
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          MemoryPoolMXBean.isCollectionThresholdExceeded().
  * @author  Mandy Chung
  *
- * @modules java.management
  * @run main/othervm ThresholdTest
  */
 
--- a/jdk/test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -23,11 +23,10 @@
 
 #
 # @test
+# @bug      6336608 6367473 6511738
 # @summary  Tests OperatingSystemMXBean.getSystemLoadAverage() api.
 # @author   Mandy Chung
-# @bug      6336608 6367473 6511738
 #
-# @modules java.management
 # @run build GetSystemLoadAverage
 # @run shell/timeout=300 TestSystemLoadAvg.sh
 #
--- a/jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Test if proxy for PlatformLoggingMXBean is equivalent
  *          to proxy for LoggingMXBean
  *
- * @modules jdk.management
  * @build LoggingMXBeanTest
  * @run main LoggingMXBeanTest
  */
--- a/jdk/test/java/lang/management/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,12 +24,10 @@
 /*
  * @test
  * @bug     6876135 7024172 7067691
- *
  * @summary Test PlatformLoggingMXBean
  *          This test performs similar testing as
  *          java/util/logging/LoggingMXBeanTest.
  *
- * @modules jdk.management
  * @build PlatformLoggingMXBeanTest
  * @run main PlatformLoggingMXBeanTest
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/management/PlatformLoggingMXBean/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = java.logging
+
--- a/jdk/test/java/lang/management/RuntimeMXBean/GetSystemProperties.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/RuntimeMXBean/GetSystemProperties.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     4990512
  * @summary Basic Test for RuntimeMXBean.getSystemProperties().
  * @author  Mandy Chung
- * @modules java.management
  */
 
 import java.lang.management.ManagementFactory;
--- a/jdk/test/java/lang/management/RuntimeMXBean/PropertiesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/RuntimeMXBean/PropertiesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          properties contain another list of properties as the defaults.
  * @author  Mandy Chung
  *
- * @modules java.management
  * @run build PropertiesTest
  * @run main  PropertiesTest
  */
--- a/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -24,9 +24,9 @@
 #
 # @test
 # @bug     4530538
-# @summary 
+# @summary
 # @author  Mandy Chung
-# @modules java.management
+#
 # @run compile InputArgument.java
 # @run shell TestInputArgument.sh
 #
@@ -41,12 +41,12 @@
 fi
 
 runOne()
-{ 
+{
    echo "runOne $@"
    $TESTJAVA/bin/java $TESTVMOPTS -classpath $TESTCLASSES "$@" || exit 2
 }
 
-runOne InputArgument 
+runOne InputArgument
 
 runOne -XX:+UseFastJNIAccessors -Xlog:gc*=debug InputArgument
 runOne -XX:+UseFastJNIAccessors -Xlog:gc*=debug InputArgument -XX:+UseFastJNIAccessors
--- a/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug     4530538
  * @summary Basic unit test of RuntimeMXBean.getUptime()
  * @author  Alexei Guibadoulline
- * @modules java.management
  */
 
 import java.lang.management.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/management/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = java.management
+
--- a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,11 +24,10 @@
 /*
  * @test
  * @bug     4530538
+ * @key intermittent
  * @summary Basic unit test of ThreadMXBean.getAllThreadIds()
  * @author  Alexei Guibadoulline and Mandy Chung
  *
- * @key intermittent
- * @modules java.management
  * @run main/othervm AllThreadIds
  */
 
--- a/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary The capability is disabled regardless of number of times
  *          it was enabled.
  * @author  Mandy Chung
- * @modules java.management
  */
 
 import java.lang.management.ThreadMXBean;
--- a/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,6 @@
  *          and ThreadMXBean.setThreadCpuTimeEnabled().
  * @author  Mandy Chung
  *
- * @modules java.management
  * @run main EnableTest
  */
 
--- a/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,7 +31,6 @@
  *          - ThreadMXBean.findMonitorDeadlockedThreads()
  * @author  Mandy Chung
  *
- * @modules java.management
  * @build MonitorDeadlock
  * @build SynchronizerDeadlock
  * @build ThreadDump
--- a/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          - ThreadMXBean.findMonitorDeadlockedThreads()
  * @author  Mandy Chung
  *
- * @modules java.management
  * @build MonitorDeadlock
  * @build ThreadDump
  * @run main/othervm FindMonitorDeadlock
--- a/jdk/test/java/lang/management/ThreadMXBean/InvalidThreadID.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/InvalidThreadID.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          if id <= 0 and returns -1 if the thread doesn't exist.
  * @author  Mandy Chung
  *
- * @modules java.management
  * @run main InvalidThreadID
  */
 
--- a/jdk/test/java/lang/management/ThreadMXBean/LockedMonitors.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/LockedMonitors.java	Mon Apr 10 08:31:37 2017 -0700
@@ -34,7 +34,6 @@
  *
  * @author  Mandy Chung
  *
- * @modules java.management
  * @build Barrier
  * @build LockingThread
  * @build ThreadDump
--- a/jdk/test/java/lang/management/ThreadMXBean/LockedSynchronizers.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/LockedSynchronizers.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,7 +30,6 @@
  *
  * @author  Mandy Chung
  *
- * @modules java.management
  * @build Barrier
  * @build SynchronizerLockingThread
  * @build ThreadDump
--- a/jdk/test/java/lang/management/ThreadMXBean/Locks.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/Locks.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,11 +26,11 @@
  * @bug     4530538
  * @summary Basic unit test of ThreadInfo.getLockName()
  *          and ThreadInfo.getLockOwnerName()
- * @library /lib/testlibrary
  * @author  Mandy Chung
  * @author  Jaroslav Bachorik
  *
- * @modules java.management
+ * @library /lib/testlibrary
+ *
  * @build jdk.testlibrary.*
  * @run main/othervm Locks
  */
--- a/jdk/test/java/lang/management/ThreadMXBean/MyOwnSynchronizer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/MyOwnSynchronizer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          and getThreadInfo of customized JSR-166 synchronizers.
  * @author  Mandy Chung
  *
- * @modules java.management
  * @build Barrier
  * @build ThreadDump
  * @run main/othervm MyOwnSynchronizer
--- a/jdk/test/java/lang/management/ThreadMXBean/ResetPeakThreadCount.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/ResetPeakThreadCount.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,6 @@
  * @author  Mandy Chung
  * @author  Jaroslav Bachorik
  *
- * @modules java.management
  * @build ResetPeakThreadCount
  * @build ThreadDump
  * @run main/othervm ResetPeakThreadCount
--- a/jdk/test/java/lang/management/ThreadMXBean/SharedSynchronizer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/SharedSynchronizer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          in shared mode which has no owner when a thread is parked.
  * @author  Mandy Chung
  *
- * @modules java.management
  * @run main/othervm SharedSynchronizer
  */
 
--- a/jdk/test/java/lang/management/ThreadMXBean/SynchronizationStatistics.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/SynchronizationStatistics.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,11 +25,9 @@
  * @test
  * @bug     4530538
  * @summary Basic unit test of the synchronization statistics support:
- *
  * @author  Mandy Chung
  * @author  Jaroslav Bachorik
  *
- * @modules java.management
  * @run main/othervm SynchronizationStatistics
  */
 
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadBlockedCount.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadBlockedCount.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Basic unit test of ThreadInfo.getBlockedCount()
  * @author  Alexei Guibadoulline and Mandy Chung
  * @author  Jaroslav Bachorik
- * @modules java.management
+ *
  * @run main ThreadBlockedCount
  */
 
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadCounts.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadCounts.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,7 +30,6 @@
  *                             mbean.getDaemonThreadCount()
  * @author  Alexei Guibadoulline
  *
- * @modules java.management
  * @run main ThreadCounts
  */
 
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadCpuTime.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadCpuTime.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Basic test of ThreadMXBean.getThreadCpuTime and
  *          getCurrentThreadCpuTime.
  * @author  Mandy Chung
- * @modules java.management
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadDaemonTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadDaemonTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,7 +31,6 @@
  * @bug     6588467
  * @summary Basic test of ThreadInfo.isDaemon
  * @author  Jeremy Manson
- * @modules java.management
  */
 public class ThreadDaemonTest {
 
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadLists.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadLists.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 5047639
  * @summary Check that the "java-level" APIs provide a consistent view of
  *          the thread list
- * @modules java.management
  */
 import java.lang.management.ManagementFactory;
 import java.lang.management.ThreadMXBean;
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,12 +27,11 @@
  * @summary Basic unit test of thread states returned by
  *          ThreadMXBean.getThreadInfo.getThreadState().
  *          It also tests lock information returned by ThreadInfo.
- *
  * @author  Mandy Chung
  *
  * @library ../../Thread
  * @library /lib/testlibrary
- * @modules java.management
+ *
  * @build jdk.testlibrary.*
  * @build ThreadMXBeanStateTest ThreadStateController
  * @run main ThreadMXBeanStateTest
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadStackTrace.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadStackTrace.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
  *          ThreadInfo.getThreadState()
  * @author  Mandy Chung
  *
- * @modules java.management
  * @run build Utils
  * @run main ThreadStackTrace
  */
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadUserTime.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadUserTime.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Basic test of ThreadMXBean.getThreadUserTime and
  *          getCurrentThreadUserTime.
  * @author  Mandy Chung
- * @modules java.management
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/module/AutomaticModulesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/module/AutomaticModulesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -38,8 +38,6 @@
 import java.lang.module.ModuleReference;
 import java.lang.module.ResolutionException;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -69,13 +67,8 @@
             { "foo.jar",                    "foo" },
             { "foo4j.jar",                  "foo4j", },
 
-            { "foo1.jar",                   "foo" },
-            { "foo1.2.jar",                 "foo" },
-            { "foo1.2.3.jar",               "foo" },
-
-            { "foo10.jar",                  "foo" },
-            { "foo10.20.jar",               "foo" },
-            { "foo10.20.30.jar",            "foo" },
+            { "foo1.jar",                   "foo1" },
+            { "foo10.jar",                  "foo10" },
 
             { "foo-1.jar",                  "foo/1" },
             { "foo-1.2.jar",                "foo/1.2" },
@@ -93,6 +86,9 @@
             { "foo-bar-10.jar",             "foo.bar/10" },
             { "foo-bar-10.20.jar",          "foo.bar/10.20" },
 
+            { "foo.bar1.jar",               "foo.bar1" },
+            { "foo.bar10.jar",              "foo.bar10" },
+
             { "foo-1.2-SNAPSHOT.jar",       "foo/1.2-SNAPSHOT" },
             { "foo-bar-1.2-SNAPSHOT.jar",   "foo.bar/1.2-SNAPSHOT" },
 
@@ -108,8 +104,12 @@
     public Object[][] createBadNames() {
         return new Object[][]{
 
-            { ".jar",     null },
-            { "_.jar",    null }
+            { ".jar",          null },
+            { "_.jar",         null },
+
+            { "foo.1.jar",     null },
+            { "1foo.jar",      null },
+            { "foo.1bar.jar",  null },
 
         };
     }
@@ -389,7 +389,7 @@
 
         ModuleFinder finder = ModuleFinder.of(dir);
 
-        Configuration parent = Layer.boot().configuration();
+        Configuration parent = ModuleLayer.boot().configuration();
         Configuration cf = resolve(parent, finder, "m");
 
         ModuleDescriptor descriptor = findDescriptor(cf, "m");
@@ -469,11 +469,11 @@
         createDummyJarFile(dir.resolve("c.jar"), "q/T.class");
 
         // module finder locates a and the modules in the directory
-        ModuleFinder finder
-            = ModuleFinder.compose(ModuleUtils.finderOf(descriptor1),
-                ModuleFinder.of(dir));
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
+        ModuleFinder finder2 = ModuleFinder.of(dir);
+        ModuleFinder finder = ModuleFinder.compose(finder1, finder2);
 
-        Configuration parent = Layer.boot().configuration();
+        Configuration parent = ModuleLayer.boot().configuration();
         Configuration cf = resolve(parent, finder, "a");
 
         assertTrue(cf.modules().size() == 3);
@@ -482,7 +482,7 @@
         assertTrue(cf.findModule("c").isPresent());
 
         ResolvedModule base = cf.findModule("java.base").get();
-        assertTrue(base.configuration() == Layer.boot().configuration());
+        assertTrue(base.configuration() == ModuleLayer.boot().configuration());
         ResolvedModule a = cf.findModule("a").get();
         ResolvedModule b = cf.findModule("b").get();
         ResolvedModule c = cf.findModule("c").get();
@@ -534,11 +534,11 @@
         createDummyJarFile(dir.resolve("d.jar"), "q/T.class");
 
         // module finder locates a and the modules in the directory
-        ModuleFinder finder
-            = ModuleFinder.compose(ModuleUtils.finderOf(descriptor1, descriptor2),
-                                   ModuleFinder.of(dir));
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
+        ModuleFinder finder2 = ModuleFinder.of(dir);
+        ModuleFinder finder = ModuleFinder.compose(finder1, finder2);
 
-        Configuration parent = Layer.boot().configuration();
+        Configuration parent = ModuleLayer.boot().configuration();
         Configuration cf = resolve(parent, finder, "a", "d");
 
         assertTrue(cf.modules().size() == 4);
@@ -554,7 +554,7 @@
         // readability
 
         ResolvedModule base = cf.findModule("java.base").get();
-        assertTrue(base.configuration() == Layer.boot().configuration());
+        assertTrue(base.configuration() == ModuleLayer.boot().configuration());
         ResolvedModule a = cf.findModule("a").get();
         ResolvedModule b = cf.findModule("b").get();
         ResolvedModule c = cf.findModule("c").get();
@@ -607,11 +607,11 @@
         createDummyJarFile(dir.resolve("d.jar"), "q/T.class");
 
         // module finder locates a and the modules in the directory
-        ModuleFinder finder
-            = ModuleFinder.compose(ModuleUtils.finderOf(descriptor1, descriptor2),
-                ModuleFinder.of(dir));
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
+        ModuleFinder finder2 = ModuleFinder.of(dir);
+        ModuleFinder finder = ModuleFinder.compose(finder1, finder2);
 
-        Configuration parent = Layer.boot().configuration();
+        Configuration parent = ModuleLayer.boot().configuration();
         Configuration cf = resolve(parent, finder, "a", "d");
 
         assertTrue(cf.modules().size() == 4);
@@ -621,7 +621,7 @@
         assertTrue(cf.findModule("d").isPresent());
 
         ResolvedModule base = cf.findModule("java.base").get();
-        assertTrue(base.configuration() == Layer.boot().configuration());
+        assertTrue(base.configuration() == ModuleLayer.boot().configuration());
         ResolvedModule a = cf.findModule("a").get();
         ResolvedModule b = cf.findModule("b").get();
         ResolvedModule c = cf.findModule("c").get();
@@ -661,6 +661,189 @@
 
 
     /**
+     * Basic test to ensure that no automatic modules are resolved when
+     * an automatic module is not a root or required by other modules.
+     */
+    public void testInConfiguration4() throws IOException {
+        ModuleDescriptor descriptor1
+            = ModuleDescriptor.newModule("m1")
+                .requires("java.base")
+                .build();
+
+        // automatic modules
+        Path dir = Files.createTempDirectory(USER_DIR, "mods");
+        createDummyJarFile(dir.resolve("auto1.jar"), "p1/C.class");
+        createDummyJarFile(dir.resolve("auto2.jar"), "p2/C.class");
+        createDummyJarFile(dir.resolve("auto3.jar"), "p3/C.class");
+
+        // module finder locates m1 and the modules in the directory
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
+        ModuleFinder finder2 =  ModuleFinder.of(dir);
+        ModuleFinder finder = ModuleFinder.compose(finder1, finder2);
+
+        Configuration parent = ModuleLayer.boot().configuration();
+        Configuration cf = resolve(parent, finder, "m1");
+
+        // ensure that no automatic module is resolved
+        assertTrue(cf.modules().size() == 1);
+        assertTrue(cf.findModule("m1").isPresent());
+    }
+
+
+    /**
+     * Basic test to ensure that if an automatic module is resolved then
+     * all observable automatic modules are resolved.
+     */
+    public void testInConfiguration5() throws IOException {
+        // m1 requires m2
+        ModuleDescriptor descriptor1
+            = ModuleDescriptor.newModule("m1")
+                .requires("m2").build();
+
+        // m2 requires automatic module
+        ModuleDescriptor descriptor2
+            = ModuleDescriptor.newModule("m2")
+                .requires("auto1")
+                .build();
+
+        // automatic modules
+        Path dir = Files.createTempDirectory(USER_DIR, "mods");
+        createDummyJarFile(dir.resolve("auto1.jar"), "p1/C.class");
+        createDummyJarFile(dir.resolve("auto2.jar"), "p2/C.class");
+        createDummyJarFile(dir.resolve("auto3.jar"), "p3/C.class");
+
+        // module finder locates m1, m2, and the modules in the directory
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
+        ModuleFinder finder2 =  ModuleFinder.of(dir);
+        ModuleFinder finder = ModuleFinder.compose(finder1, finder2);
+
+        Configuration parent = ModuleLayer.boot().configuration();
+        Configuration cf = resolve(parent, finder, "m1");
+
+        // all automatic modules should be resolved
+        assertTrue(cf.modules().size() == 5);
+        assertTrue(cf.findModule("m1").isPresent());
+        assertTrue(cf.findModule("m2").isPresent());
+        assertTrue(cf.findModule("auto1").isPresent());
+        assertTrue(cf.findModule("auto2").isPresent());
+        assertTrue(cf.findModule("auto3").isPresent());
+
+        ResolvedModule base = parent.findModule("java.base")
+                                    .orElseThrow(() -> new RuntimeException());
+        ResolvedModule m1 = cf.findModule("m1").get();
+        ResolvedModule m2 = cf.findModule("m2").get();
+        ResolvedModule auto1 = cf.findModule("auto1").get();
+        ResolvedModule auto2 = cf.findModule("auto2").get();
+        ResolvedModule auto3 = cf.findModule("auto3").get();
+
+        // m1 does not read the automatic modules
+        assertTrue(m1.reads().size() == 2);
+        assertTrue(m1.reads().contains(m2));
+        assertTrue(m1.reads().contains(base));
+
+        // m2 should read all the automatic modules
+        assertTrue(m2.reads().size() == 4);
+        assertTrue(m2.reads().contains(auto1));
+        assertTrue(m2.reads().contains(auto2));
+        assertTrue(m2.reads().contains(auto3));
+        assertTrue(m2.reads().contains(base));
+
+        assertTrue(auto1.reads().contains(m1));
+        assertTrue(auto1.reads().contains(m2));
+        assertTrue(auto1.reads().contains(auto2));
+        assertTrue(auto1.reads().contains(auto3));
+        assertTrue(auto1.reads().contains(base));
+
+        assertTrue(auto2.reads().contains(m1));
+        assertTrue(auto2.reads().contains(m2));
+        assertTrue(auto2.reads().contains(auto1));
+        assertTrue(auto2.reads().contains(auto3));
+        assertTrue(auto2.reads().contains(base));
+
+        assertTrue(auto3.reads().contains(m1));
+        assertTrue(auto3.reads().contains(m2));
+        assertTrue(auto3.reads().contains(auto1));
+        assertTrue(auto3.reads().contains(auto2));
+        assertTrue(auto3.reads().contains(base));
+    }
+
+
+    /**
+     * Basic test of automatic modules in a child configuration. All automatic
+     * modules that are found with the before finder should be resolved. The
+     * automatic modules that are found by the after finder and not shadowed
+     * by the before finder, or parent configurations, should also be resolved.
+     */
+    public void testInConfiguration6() throws IOException {
+        // m1 requires auto1
+        ModuleDescriptor descriptor1
+            = ModuleDescriptor.newModule("m1")
+                .requires("auto1")
+                .build();
+
+        Path dir = Files.createTempDirectory(USER_DIR, "mods");
+        createDummyJarFile(dir.resolve("auto1.jar"), "p1/C.class");
+
+        // module finder locates m1 and auto1
+        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
+        ModuleFinder finder2 =  ModuleFinder.of(dir);
+        ModuleFinder finder = ModuleFinder.compose(finder1, finder2);
+
+        Configuration parent = ModuleLayer.boot().configuration();
+        Configuration cf1 = resolve(parent, finder, "m1");
+
+        assertTrue(cf1.modules().size() == 2);
+        assertTrue(cf1.findModule("m1").isPresent());
+        assertTrue(cf1.findModule("auto1").isPresent());
+
+        ResolvedModule base = parent.findModule("java.base")
+                                    .orElseThrow(() -> new RuntimeException());
+        ResolvedModule m1 = cf1.findModule("m1").get();
+        ResolvedModule auto1 = cf1.findModule("auto1").get();
+
+        assertTrue(m1.reads().size() == 2);
+        assertTrue(m1.reads().contains(auto1));
+        assertTrue(m1.reads().contains(base));
+
+        assertTrue(auto1.reads().contains(m1));
+        assertTrue(auto1.reads().contains(base));
+
+
+        // create child configuration - the after finder locates auto1
+
+        dir = Files.createTempDirectory(USER_DIR, "mods");
+        createDummyJarFile(dir.resolve("auto2.jar"), "p2/C.class");
+        ModuleFinder beforeFinder =  ModuleFinder.of(dir);
+
+        dir = Files.createTempDirectory(USER_DIR, "mods");
+        createDummyJarFile(dir.resolve("auto1.jar"), "p1/C.class");
+        createDummyJarFile(dir.resolve("auto2.jar"), "p2/C.class");
+        createDummyJarFile(dir.resolve("auto3.jar"), "p3/C.class");
+        ModuleFinder afterFinder =  ModuleFinder.of(dir);
+
+        Configuration cf2 = cf1.resolve(beforeFinder, afterFinder, Set.of("auto2"));
+
+        // auto1 should be found in parent and should not be in cf2
+        assertTrue(cf2.modules().size() == 2);
+        assertTrue(cf2.findModule("auto2").isPresent());
+        assertTrue(cf2.findModule("auto3").isPresent());
+
+        ResolvedModule auto2 = cf2.findModule("auto2").get();
+        ResolvedModule auto3 = cf2.findModule("auto3").get();
+
+        assertTrue(auto2.reads().contains(m1));
+        assertTrue(auto2.reads().contains(auto1));
+        assertTrue(auto2.reads().contains(auto3));
+        assertTrue(auto2.reads().contains(base));
+
+        assertTrue(auto3.reads().contains(m1));
+        assertTrue(auto3.reads().contains(auto1));
+        assertTrue(auto3.reads().contains(auto2));
+        assertTrue(auto3.reads().contains(base));
+    }
+
+
+    /**
      * Basic test of a configuration created with automatic modules
      *   a requires b* and c*
      *   b* contains p
@@ -684,7 +867,7 @@
             = ModuleFinder.compose(ModuleUtils.finderOf(descriptor),
                                    ModuleFinder.of(dir));
 
-        Configuration parent = Layer.boot().configuration();
+        Configuration parent = ModuleLayer.boot().configuration();
         resolve(parent, finder, "a");
     }
 
@@ -711,13 +894,13 @@
             = ModuleFinder.compose(ModuleUtils.finderOf(descriptor),
                                    ModuleFinder.of(dir));
 
-        Configuration parent = Layer.boot().configuration();
+        Configuration parent = ModuleLayer.boot().configuration();
         resolve(parent, finder, "a");
     }
 
 
     /**
-     * Basic test of Layer containing automatic modules
+     * Basic test of layer containing automatic modules
      */
     public void testInLayer() throws IOException {
         ModuleDescriptor descriptor
@@ -736,12 +919,12 @@
             = ModuleFinder.compose(ModuleUtils.finderOf(descriptor),
                 ModuleFinder.of(dir));
 
-        Configuration parent = Layer.boot().configuration();
+        Configuration parent = ModuleLayer.boot().configuration();
         Configuration cf = resolve(parent, finder, "a");
         assertTrue(cf.modules().size() == 3);
 
         // each module gets its own loader
-        Layer layer = Layer.boot().defineModules(cf, mn -> new ClassLoader() { });
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, mn -> new ClassLoader() { });
 
         // an unnamed module
         Module unnamed = (new ClassLoader() { }).getUnnamedModule();
@@ -804,7 +987,7 @@
      */
     static void testReadAllBootModules(Configuration cf, String mn) {
 
-        Set<String> bootModules = Layer.boot().modules().stream()
+        Set<String> bootModules = ModuleLayer.boot().modules().stream()
                 .map(Module::getName)
                 .collect(Collectors.toSet());
 
@@ -813,10 +996,10 @@
     }
 
     /**
-     * Test that the given Module reads all module in the given Layer
-     * and its parent Layers.
+     * Test that the given Module reads all module in the given layer
+     * and its parent layers.
      */
-    static void testsReadsAll(Module m, Layer layer) {
+    static void testsReadsAll(Module m, ModuleLayer layer) {
         // check that m reads all modules in the layer
         layer.configuration().modules().stream()
             .map(ResolvedModule::name)
--- a/jdk/test/java/lang/module/ConfigurationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/module/ConfigurationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -40,7 +40,6 @@
 import java.lang.module.ModuleFinder;
 import java.lang.module.ResolutionException;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.List;
@@ -1708,7 +1707,7 @@
 
         ModuleFinder finder = ModuleUtils.finderOf(descriptor);
 
-        Configuration bootConfiguration = Layer.boot().configuration();
+        Configuration bootConfiguration = ModuleLayer.boot().configuration();
 
         // m1 contains package java.lang, java.base exports package java.lang to m1
         resolve(bootConfiguration, finder, "m1");
@@ -1989,14 +1988,14 @@
 
     @Test(expectedExceptions = { NullPointerException.class })
     public void testResolveRequiresWithNull5() {
-        Configuration cf = Layer.boot().configuration();
+        Configuration cf = ModuleLayer.boot().configuration();
         Configuration.resolve(ModuleFinder.of(), List.of(cf), null, Set.of());
     }
 
     @Test(expectedExceptions = { NullPointerException.class })
     public void testResolveRequiresWithNull6() {
         ModuleFinder empty = ModuleFinder.of();
-        Configuration cf = Layer.boot().configuration();
+        Configuration cf = ModuleLayer.boot().configuration();
         Configuration.resolve(empty, List.of(cf), empty, null);
     }
 
@@ -2024,14 +2023,14 @@
 
     @Test(expectedExceptions = { NullPointerException.class })
     public void testResolveRequiresAndUsesWithNull5() {
-        Configuration cf = Layer.boot().configuration();
+        Configuration cf = ModuleLayer.boot().configuration();
         Configuration.resolveAndBind(ModuleFinder.of(), List.of(cf), null, Set.of());
     }
 
     @Test(expectedExceptions = { NullPointerException.class })
     public void testResolveRequiresAndUsesWithNull6() {
         ModuleFinder empty = ModuleFinder.of();
-        Configuration cf = Layer.boot().configuration();
+        Configuration cf = ModuleLayer.boot().configuration();
         Configuration.resolveAndBind(empty, List.of(cf), empty, null);
     }
 
@@ -2044,14 +2043,14 @@
 
     @Test(expectedExceptions = { UnsupportedOperationException.class })
     public void testImmutableSet1() {
-        Configuration cf = Layer.boot().configuration();
+        Configuration cf = ModuleLayer.boot().configuration();
         ResolvedModule base = cf.findModule("java.base").get();
         cf.modules().add(base);
     }
 
     @Test(expectedExceptions = { UnsupportedOperationException.class })
     public void testImmutableSet2() {
-        Configuration cf = Layer.boot().configuration();
+        Configuration cf = ModuleLayer.boot().configuration();
         ResolvedModule base = cf.findModule("java.base").get();
         base.reads().add(base);
     }
--- a/jdk/test/java/lang/module/ModuleDescriptorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/module/ModuleDescriptorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -41,7 +41,6 @@
 import java.lang.module.ModuleDescriptor.Provides;
 import java.lang.module.ModuleDescriptor.Requires.Modifier;
 import java.lang.module.ModuleDescriptor.Version;
-import java.lang.reflect.Module;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collections;
--- a/jdk/test/java/lang/module/ModuleFinderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/module/ModuleFinderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -529,6 +529,30 @@
 
 
     /**
+     * Test ModuleFinder.of with a directory containing hidden files
+     */
+    public void testOfWithHiddenFiles() throws Exception {
+        Path dir = Files.createTempDirectory(USER_DIR, "mods");
+        createExplodedModule(dir.resolve("m"), "m",
+                "com/.ignore",
+                "com/foo/.ignore",
+                "com/foo/foo.properties");
+
+        ModuleFinder finder = ModuleFinder.of(dir);
+        ModuleReference mref = finder.find("m").orElse(null);
+        assertNotNull(mref);
+
+        Set<String> expectedPackages;
+        if (System.getProperty("os.name").startsWith("Windows")) {
+            expectedPackages = Set.of("com", "com.foo");
+        } else {
+            expectedPackages = Set.of("com.foo");
+        }
+        assertEquals(mref.descriptor().packages(), expectedPackages);
+    }
+
+
+    /**
      * Test ModuleFinder.of with a truncated module-info.class
      */
     public void testOfWithTruncatedModuleInfo() throws Exception {
--- a/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -37,7 +37,6 @@
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReader;
 import java.lang.module.ModuleReference;
-import java.lang.reflect.Module;
 import java.net.URI;
 import java.net.URL;
 import java.net.URLConnection;
--- a/jdk/test/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -36,7 +36,6 @@
 import java.lang.reflect.InaccessibleObjectException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 
 import jdk.internal.misc.Unsafe;
 
--- a/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1219 +0,0 @@
-/*
- * 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
- * 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
- * @modules java.base/jdk.internal.misc
- * @build BasicLayerTest ModuleUtils
- * @compile layertest/Test.java
- * @run testng BasicLayerTest
- * @summary Basic tests for java.lang.reflect.Layer
- */
-
-import java.lang.module.Configuration;
-import java.lang.module.ModuleDescriptor;
-import java.lang.module.ModuleDescriptor.Requires;
-import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.LayerInstantiationException;
-import java.lang.reflect.Module;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import jdk.internal.misc.SharedSecrets;
-
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-
-@Test
-public class BasicLayerTest {
-
-    /**
-     * Creates a "non-strict" builder for building a module. This allows the
-     * test the create ModuleDescriptor objects that do not require java.base.
-     */
-    private static ModuleDescriptor.Builder newBuilder(String mn) {
-        return SharedSecrets.getJavaLangModuleAccess()
-                .newModuleBuilder(mn, false, Set.of());
-    }
-
-    /**
-     * Exercise Layer.empty()
-     */
-    public void testEmpty() {
-        Layer emptyLayer = Layer.empty();
-
-        assertTrue(emptyLayer.parents().isEmpty());
-
-        assertTrue(emptyLayer.configuration() == Configuration.empty());
-
-        assertTrue(emptyLayer.modules().isEmpty());
-
-        assertFalse(emptyLayer.findModule("java.base").isPresent());
-
-        try {
-            emptyLayer.findLoader("java.base");
-            assertTrue(false);
-        } catch (IllegalArgumentException expected) { }
-    }
-
-
-    /**
-     * Exercise Layer.boot()
-     */
-    public void testBoot() {
-        Layer bootLayer = Layer.boot();
-
-        // configuration
-        Configuration cf = bootLayer.configuration();
-        assertTrue(cf.findModule("java.base").get()
-                .reference()
-                .descriptor()
-                .exports()
-                .stream().anyMatch(e -> (e.source().equals("java.lang")
-                                         && !e.isQualified())));
-
-        // modules
-        Set<Module> modules = bootLayer.modules();
-        assertTrue(modules.contains(Object.class.getModule()));
-        int count = (int) modules.stream().map(Module::getName).count();
-        assertEquals(count, modules.size()); // module names are unique
-
-        // findModule
-        Module base = Object.class.getModule();
-        assertTrue(bootLayer.findModule("java.base").get() == base);
-        assertTrue(base.getLayer() == bootLayer);
-
-        // findLoader
-        assertTrue(bootLayer.findLoader("java.base") == null);
-
-        // parents
-        assertTrue(bootLayer.parents().size() == 1);
-        assertTrue(bootLayer.parents().get(0) == Layer.empty());
-    }
-
-
-    /**
-     * Exercise Layer defineModules, created with empty layer as parent
-     */
-    public void testLayerOnEmpty() {
-        ModuleDescriptor descriptor1 = newBuilder("m1")
-                .requires("m2")
-                .exports("p1")
-                .build();
-
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .requires("m3")
-                .build();
-
-        ModuleDescriptor descriptor3 = newBuilder("m3")
-                .build();
-
-        ModuleFinder finder
-            = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3);
-
-        Configuration cf = resolve(finder, "m1");
-
-        // map each module to its own class loader for this test
-        ClassLoader loader1 = new ClassLoader() { };
-        ClassLoader loader2 = new ClassLoader() { };
-        ClassLoader loader3 = new ClassLoader() { };
-        Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", loader1);
-        map.put("m2", loader2);
-        map.put("m3", loader3);
-
-        Layer layer = Layer.empty().defineModules(cf, map::get);
-
-        // configuration
-        assertTrue(layer.configuration() == cf);
-        assertTrue(layer.configuration().modules().size() == 3);
-
-        // modules
-        Set<Module> modules = layer.modules();
-        assertTrue(modules.size() == 3);
-        Set<String> names = modules.stream()
-            .map(Module::getName)
-            .collect(Collectors.toSet());
-        assertTrue(names.contains("m1"));
-        assertTrue(names.contains("m2"));
-        assertTrue(names.contains("m3"));
-
-        // findModule
-        Module m1 = layer.findModule("m1").get();
-        Module m2 = layer.findModule("m2").get();
-        Module m3 = layer.findModule("m3").get();
-        assertEquals(m1.getName(), "m1");
-        assertEquals(m2.getName(), "m2");
-        assertEquals(m3.getName(), "m3");
-        assertTrue(m1.getDescriptor() == descriptor1);
-        assertTrue(m2.getDescriptor() == descriptor2);
-        assertTrue(m3.getDescriptor() == descriptor3);
-        assertTrue(m1.getLayer() == layer);
-        assertTrue(m2.getLayer() == layer);
-        assertTrue(m3.getLayer() == layer);
-        assertTrue(modules.contains(m1));
-        assertTrue(modules.contains(m2));
-        assertTrue(modules.contains(m3));
-        assertFalse(layer.findModule("godot").isPresent());
-
-        // findLoader
-        assertTrue(layer.findLoader("m1") == loader1);
-        assertTrue(layer.findLoader("m2") == loader2);
-        assertTrue(layer.findLoader("m3") == loader3);
-        try {
-            ClassLoader loader = layer.findLoader("godot");
-            assertTrue(false);
-        } catch (IllegalArgumentException ignore) { }
-
-        // parents
-        assertTrue(layer.parents().size() == 1);
-        assertTrue(layer.parents().get(0) == Layer.empty());
-    }
-
-
-    /**
-     * Exercise Layer defineModules, created with boot layer as parent
-     */
-    public void testLayerOnBoot() {
-        ModuleDescriptor descriptor1 = newBuilder("m1")
-                .requires("m2")
-                .requires("java.base")
-                .exports("p1")
-                .build();
-
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .requires("java.base")
-                .build();
-
-        ModuleFinder finder
-            = ModuleUtils.finderOf(descriptor1, descriptor2);
-
-        Configuration parent = Layer.boot().configuration();
-        Configuration cf = resolve(parent, finder, "m1");
-
-        ClassLoader loader = new ClassLoader() { };
-
-        Layer layer = Layer.boot().defineModules(cf, mn -> loader);
-
-        // configuration
-        assertTrue(layer.configuration() == cf);
-        assertTrue(layer.configuration().modules().size() == 2);
-
-        // modules
-        Set<Module> modules = layer.modules();
-        assertTrue(modules.size() == 2);
-        Set<String> names = modules.stream()
-            .map(Module::getName)
-            .collect(Collectors.toSet());
-        assertTrue(names.contains("m1"));
-        assertTrue(names.contains("m2"));
-
-        // findModule
-        Module m1 = layer.findModule("m1").get();
-        Module m2 = layer.findModule("m2").get();
-        assertEquals(m1.getName(), "m1");
-        assertEquals(m2.getName(), "m2");
-        assertTrue(m1.getDescriptor() == descriptor1);
-        assertTrue(m2.getDescriptor() == descriptor2);
-        assertTrue(m1.getLayer() == layer);
-        assertTrue(m2.getLayer() == layer);
-        assertTrue(modules.contains(m1));
-        assertTrue(modules.contains(m2));
-        assertTrue(layer.findModule("java.base").get() == Object.class.getModule());
-        assertFalse(layer.findModule("godot").isPresent());
-
-        // findLoader
-        assertTrue(layer.findLoader("m1") == loader);
-        assertTrue(layer.findLoader("m2") == loader);
-        assertTrue(layer.findLoader("java.base") == null);
-
-        // parents
-        assertTrue(layer.parents().size() == 1);
-        assertTrue(layer.parents().get(0) == Layer.boot());
-    }
-
-
-    /**
-     * Exercise Layer defineModules with a configuration of two modules that
-     * have the same module-private package.
-     */
-    public void testPackageContainedInSelfAndOther() {
-        ModuleDescriptor descriptor1 =  newBuilder("m1")
-                .requires("m2")
-                .packages(Set.of("p"))
-                .build();
-
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .packages(Set.of("p"))
-                .build();
-
-        ModuleFinder finder
-            = ModuleUtils.finderOf(descriptor1, descriptor2);
-
-        Configuration cf = resolve(finder, "m1");
-        assertTrue(cf.modules().size() == 2);
-
-        // one loader per module, should be okay
-        Layer.empty().defineModules(cf, mn -> new ClassLoader() { });
-
-        // same class loader
-        try {
-            ClassLoader loader = new ClassLoader() { };
-            Layer.empty().defineModules(cf, mn -> loader);
-            assertTrue(false);
-        } catch (LayerInstantiationException expected) { }
-    }
-
-
-    /**
-     * Exercise Layer defineModules with a configuration that is a partitioned
-     * graph. The same package is exported in both partitions.
-     */
-    public void testSameExportInPartitionedGraph() {
-
-        // m1 reads m2, m2 exports p to m1
-        ModuleDescriptor descriptor1 =  newBuilder("m1")
-                .requires("m2")
-                .build();
-        ModuleDescriptor descriptor2 =  newBuilder("m2")
-                .exports("p", Set.of("m1"))
-                .build();
-
-        // m3 reads m4, m4 exports p to m3
-        ModuleDescriptor descriptor3 = newBuilder("m3")
-                .requires("m4")
-                .build();
-        ModuleDescriptor descriptor4 = newBuilder("m4")
-                .exports("p", Set.of("m3"))
-                .build();
-
-        ModuleFinder finder
-            = ModuleUtils.finderOf(descriptor1,
-                                   descriptor2,
-                                   descriptor3,
-                                   descriptor4);
-
-        Configuration cf = resolve(finder, "m1", "m3");
-        assertTrue(cf.modules().size() == 4);
-
-        // one loader per module
-        Layer.empty().defineModules(cf, mn -> new ClassLoader() { });
-
-        // m1 & m2 in one loader, m3 & m4 in another loader
-        ClassLoader loader1 = new ClassLoader() { };
-        ClassLoader loader2 = new ClassLoader() { };
-        Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", loader1);
-        map.put("m2", loader1);
-        map.put("m3", loader2);
-        map.put("m4", loader2);
-        Layer.empty().defineModules(cf, map::get);
-
-        // same loader
-        try {
-            ClassLoader loader = new ClassLoader() { };
-            Layer.empty().defineModules(cf, mn -> loader);
-            assertTrue(false);
-        } catch (LayerInstantiationException expected) { }
-    }
-
-
-    /**
-     * Exercise Layer defineModules with a configuration with a module that
-     * contains a package that is the same name as a non-exported package in
-     * a parent layer.
-     */
-    public void testContainsSamePackageAsBootLayer() {
-
-        // check assumption that java.base contains sun.launcher
-        ModuleDescriptor base = Object.class.getModule().getDescriptor();
-        assertTrue(base.packages().contains("sun.launcher"));
-
-        ModuleDescriptor descriptor = newBuilder("m1")
-               .requires("java.base")
-               .packages(Set.of("sun.launcher"))
-               .build();
-
-        ModuleFinder finder = ModuleUtils.finderOf(descriptor);
-
-        Configuration parent = Layer.boot().configuration();
-        Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m1"));
-        assertTrue(cf.modules().size() == 1);
-
-        ClassLoader loader = new ClassLoader() { };
-        Layer layer = Layer.boot().defineModules(cf, mn -> loader);
-        assertTrue(layer.modules().size() == 1);
-   }
-
-
-    /**
-     * Test layers with implied readability.
-     *
-     * The test consists of three configurations:
-     * - Configuration/layer1: m1, m2 requires transitive m1
-     * - Configuration/layer2: m3 requires m1
-     */
-    public void testImpliedReadabilityWithLayers1() {
-
-        // cf1: m1 and m2, m2 requires transitive m1
-
-        ModuleDescriptor descriptor1 = newBuilder("m1")
-                .build();
-
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m1")
-                .build();
-
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
-
-        Configuration cf1 = resolve(finder1, "m2");
-
-        ClassLoader cl1 = new ClassLoader() { };
-        Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1);
-
-
-        // cf2: m3, m3 requires m2
-
-        ModuleDescriptor descriptor3 = newBuilder("m3")
-                .requires("m2")
-                .build();
-
-        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor3);
-
-        Configuration cf2 = resolve(cf1, finder2, "m3");
-
-        ClassLoader cl2 = new ClassLoader() { };
-        Layer layer2 = layer1.defineModules(cf2, mn -> cl2);
-
-        assertTrue(layer1.parents().size() == 1);
-        assertTrue(layer1.parents().get(0) == Layer.empty());
-
-        assertTrue(layer2.parents().size() == 1);
-        assertTrue(layer2.parents().get(0) == layer1);
-
-        Module m1 = layer2.findModule("m1").get();
-        Module m2 = layer2.findModule("m2").get();
-        Module m3 = layer2.findModule("m3").get();
-
-        assertTrue(m1.getLayer() == layer1);
-        assertTrue(m2.getLayer() == layer1);
-        assertTrue(m3.getLayer() == layer2);
-
-        assertTrue(m1.getClassLoader() == cl1);
-        assertTrue(m2.getClassLoader() == cl1);
-        assertTrue(m3.getClassLoader() == cl2);
-
-        assertTrue(m1.canRead(m1));
-        assertFalse(m1.canRead(m2));
-        assertFalse(m1.canRead(m3));
-
-        assertTrue(m2.canRead(m1));
-        assertTrue(m2.canRead(m2));
-        assertFalse(m2.canRead(m3));
-
-        assertTrue(m3.canRead(m1));
-        assertTrue(m3.canRead(m2));
-        assertTrue(m3.canRead(m3));
-    }
-
-
-    /**
-     * Test layers with implied readability.
-     *
-     * The test consists of three configurations:
-     * - Configuration/layer1: m1
-     * - Configuration/layer2: m2 requires transitive m3, m3 requires m2
-     */
-    public void testImpliedReadabilityWithLayers2() {
-
-        // cf1: m1
-
-        ModuleDescriptor descriptor1 = newBuilder("m1").build();
-
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
-
-        Configuration cf1 = resolve(finder1, "m1");
-
-        ClassLoader cl1 = new ClassLoader() { };
-        Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1);
-
-
-        // cf2: m2, m3: m2 requires transitive m1, m3 requires m2
-
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m1")
-                .build();
-
-        ModuleDescriptor descriptor3 = newBuilder("m3")
-                .requires("m2")
-                .build();
-
-        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2, descriptor3);
-
-        Configuration cf2 = resolve(cf1, finder2, "m3");
-
-        ClassLoader cl2 = new ClassLoader() { };
-        Layer layer2 = layer1.defineModules(cf2, mn -> cl2);
-
-        assertTrue(layer1.parents().size() == 1);
-        assertTrue(layer1.parents().get(0) == Layer.empty());
-
-        assertTrue(layer2.parents().size() == 1);
-        assertTrue(layer2.parents().get(0) == layer1);
-
-        Module m1 = layer2.findModule("m1").get();
-        Module m2 = layer2.findModule("m2").get();
-        Module m3 = layer2.findModule("m3").get();
-
-        assertTrue(m1.getLayer() == layer1);
-        assertTrue(m2.getLayer() == layer2);
-        assertTrue(m3.getLayer() == layer2);
-
-        assertTrue(m1.canRead(m1));
-        assertFalse(m1.canRead(m2));
-        assertFalse(m1.canRead(m3));
-
-        assertTrue(m2.canRead(m1));
-        assertTrue(m2.canRead(m2));
-        assertFalse(m2.canRead(m3));
-
-        assertTrue(m3.canRead(m1));
-        assertTrue(m3.canRead(m2));
-        assertTrue(m3.canRead(m3));
-    }
-
-
-    /**
-     * Test layers with implied readability.
-     *
-     * The test consists of three configurations:
-     * - Configuration/layer1: m1
-     * - Configuration/layer2: m2 requires transitive m1
-     * - Configuration/layer3: m3 requires m1
-     */
-    public void testImpliedReadabilityWithLayers3() {
-
-        // cf1: m1
-
-        ModuleDescriptor descriptor1 = newBuilder("m1").build();
-
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
-
-        Configuration cf1 = resolve(finder1, "m1");
-
-        ClassLoader cl1 = new ClassLoader() { };
-        Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1);
-
-
-        // cf2: m2 requires transitive m1
-
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m1")
-                .build();
-
-        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2);
-
-        Configuration cf2 = resolve(cf1, finder2, "m2");
-
-        ClassLoader cl2 = new ClassLoader() { };
-        Layer layer2 = layer1.defineModules(cf2, mn -> cl2);
-
-
-        // cf3: m3 requires m2
-
-        ModuleDescriptor descriptor3 = newBuilder("m3")
-                .requires("m2")
-                .build();
-
-        ModuleFinder finder3 = ModuleUtils.finderOf(descriptor3);
-
-        Configuration cf3 = resolve(cf2, finder3, "m3");
-
-        ClassLoader cl3 = new ClassLoader() { };
-        Layer layer3 = layer2.defineModules(cf3, mn -> cl3);
-
-        assertTrue(layer1.parents().size() == 1);
-        assertTrue(layer1.parents().get(0) == Layer.empty());
-
-        assertTrue(layer2.parents().size() == 1);
-        assertTrue(layer2.parents().get(0) == layer1);
-
-        assertTrue(layer3.parents().size() == 1);
-        assertTrue(layer3.parents().get(0) == layer2);
-
-        Module m1 = layer3.findModule("m1").get();
-        Module m2 = layer3.findModule("m2").get();
-        Module m3 = layer3.findModule("m3").get();
-
-        assertTrue(m1.getLayer() == layer1);
-        assertTrue(m2.getLayer() == layer2);
-        assertTrue(m3.getLayer() == layer3);
-
-        assertTrue(m1.canRead(m1));
-        assertFalse(m1.canRead(m2));
-        assertFalse(m1.canRead(m3));
-
-        assertTrue(m2.canRead(m1));
-        assertTrue(m2.canRead(m2));
-        assertFalse(m2.canRead(m3));
-
-        assertTrue(m3.canRead(m1));
-        assertTrue(m3.canRead(m2));
-        assertTrue(m3.canRead(m3));
-    }
-
-
-    /**
-     * Test layers with implied readability.
-     *
-     * The test consists of two configurations:
-     * - Configuration/layer1: m1, m2 requires transitive m1
-     * - Configuration/layer2: m3 requires transitive m2, m4 requires m3
-     */
-    public void testImpliedReadabilityWithLayers4() {
-
-        // cf1: m1, m2 requires transitive m1
-
-        ModuleDescriptor descriptor1 = newBuilder("m1")
-                .build();
-
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m1")
-                .build();
-
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
-
-        Configuration cf1 = resolve(finder1, "m2");
-
-        ClassLoader cl1 = new ClassLoader() { };
-        Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1);
-
-
-        // cf2: m3 requires transitive m2, m4 requires m3
-
-        ModuleDescriptor descriptor3 = newBuilder("m3")
-                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m2")
-                .build();
-
-        ModuleDescriptor descriptor4 = newBuilder("m4")
-                .requires("m3")
-                .build();
-
-
-        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor3, descriptor4);
-
-        Configuration cf2 = resolve(cf1, finder2, "m3", "m4");
-
-        ClassLoader cl2 = new ClassLoader() { };
-        Layer layer2 = layer1.defineModules(cf2, mn -> cl2);
-
-        assertTrue(layer1.parents().size() == 1);
-        assertTrue(layer1.parents().get(0) == Layer.empty());
-
-        assertTrue(layer2.parents().size() == 1);
-        assertTrue(layer2.parents().get(0) == layer1);
-
-        Module m1 = layer2.findModule("m1").get();
-        Module m2 = layer2.findModule("m2").get();
-        Module m3 = layer2.findModule("m3").get();
-        Module m4 = layer2.findModule("m4").get();
-
-        assertTrue(m1.getLayer() == layer1);
-        assertTrue(m2.getLayer() == layer1);
-        assertTrue(m3.getLayer() == layer2);
-        assertTrue(m4.getLayer() == layer2);
-
-        assertTrue(m1.canRead(m1));
-        assertFalse(m1.canRead(m2));
-        assertFalse(m1.canRead(m3));
-        assertFalse(m1.canRead(m4));
-
-        assertTrue(m2.canRead(m1));
-        assertTrue(m2.canRead(m2));
-        assertFalse(m1.canRead(m3));
-        assertFalse(m1.canRead(m4));
-
-        assertTrue(m3.canRead(m1));
-        assertTrue(m3.canRead(m2));
-        assertTrue(m3.canRead(m3));
-        assertFalse(m3.canRead(m4));
-
-        assertTrue(m4.canRead(m1));
-        assertTrue(m4.canRead(m2));
-        assertTrue(m4.canRead(m3));
-        assertTrue(m4.canRead(m4));
-    }
-
-
-    /**
-     * Test layers with a qualified export. The module exporting the package
-     * does not read the target module.
-     *
-     * m1 { exports p to m2 }
-     * m2 { }
-     */
-    public void testQualifiedExports1() {
-        ModuleDescriptor descriptor1 = newBuilder("m1").
-                exports("p", Set.of("m2"))
-                .build();
-
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .build();
-
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
-
-        Configuration cf = resolve(finder1, "m1", "m2");
-
-        ClassLoader cl = new ClassLoader() { };
-        Layer layer = Layer.empty().defineModules(cf, mn -> cl);
-        assertTrue(layer.modules().size() == 2);
-
-        Module m1 = layer.findModule("m1").get();
-        Module m2 = layer.findModule("m2").get();
-
-        // check m1 exports p to m2
-        assertFalse(m1.isExported("p"));
-        assertTrue(m1.isExported("p", m2));
-        assertFalse(m1.isOpen("p", m2));
-    }
-
-
-    /**
-     * Test layers with a qualified export. The module exporting the package
-     * reads the target module.
-     *
-     * m1 { exports p to m2; }
-     * m2 { requires m1; }
-     */
-    public void testQualifiedExports2() {
-        ModuleDescriptor descriptor1 = newBuilder("m1")
-                .exports("p", Set.of("m2"))
-                .build();
-
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .requires("m1")
-                .build();
-
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
-
-        Configuration cf = resolve(finder1, "m2");
-        ClassLoader cl = new ClassLoader() { };
-        Layer layer = Layer.empty().defineModules(cf, mn -> cl);
-        assertTrue(layer.modules().size() == 2);
-
-        Module m1 = layer.findModule("m1").get();
-        Module m2 = layer.findModule("m2").get();
-
-        // check m1 exports p to m2
-        assertFalse(m1.isExported("p"));
-        assertTrue(m1.isExported("p", m2));
-        assertFalse(m1.isOpen("p", m2));
-    }
-
-
-    /**
-     * Test layers with a qualified export. The module exporting the package
-     * does not read the target module in the parent layer.
-     *
-     * - Configuration/layer1: m1 { }
-     * - Configuration/layer2: m2 { exports p to m1; }
-     */
-    public void testQualifiedExports3() {
-        // create layer1 with m1
-        ModuleDescriptor descriptor1 = newBuilder("m1").build();
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
-        Configuration cf1 = resolve(finder1, "m1");
-        ClassLoader cl1 = new ClassLoader() { };
-        Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1);
-        assertTrue(layer1.modules().size() == 1);
-
-        // create layer2 with m2
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .exports("p", Set.of("m1"))
-                .build();
-        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2);
-        Configuration cf2 = resolve(cf1, finder2, "m2");
-        ClassLoader cl2 = new ClassLoader() { };
-        Layer layer2 = layer1.defineModules(cf2, mn -> cl2);
-        assertTrue(layer2.modules().size() == 1);
-
-        Module m1 = layer1.findModule("m1").get();
-        Module m2 = layer2.findModule("m2").get();
-
-        // check m2 exports p to layer1/m1
-        assertFalse(m2.isExported("p"));
-        assertTrue(m2.isExported("p", m1));
-        assertFalse(m2.isOpen("p", m1));
-    }
-
-
-    /**
-     * Test layers with a qualified export. The module exporting the package
-     * reads the target module in the parent layer.
-     *
-     * - Configuration/layer1: m1 { }
-     * - Configuration/layer2: m2 { requires m1; exports p to m1; }
-     */
-    public void testQualifiedExports4() {
-        // create layer1 with m1
-        ModuleDescriptor descriptor1 = newBuilder("m1").build();
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
-        Configuration cf1 = resolve(finder1, "m1");
-        ClassLoader cl1 = new ClassLoader() { };
-        Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1);
-        assertTrue(layer1.modules().size() == 1);
-
-        // create layer2 with m2
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .requires("m1")
-                .exports("p", Set.of("m1"))
-                .build();
-        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2);
-        Configuration cf2 = resolve(cf1, finder2, "m2");
-        ClassLoader cl2 = new ClassLoader() { };
-        Layer layer2 = layer1.defineModules(cf2, mn -> cl2);
-        assertTrue(layer2.modules().size() == 1);
-
-        Module m1 = layer1.findModule("m1").get();
-        Module m2 = layer2.findModule("m2").get();
-
-        // check m2 exports p to layer1/m1
-        assertFalse(m2.isExported("p"));
-        assertTrue(m2.isExported("p", m1));
-        assertFalse(m2.isOpen("p", m1));
-    }
-
-    /**
-     * Test layers with a qualified export. The module exporting the package
-     * does not read the target module.
-     *
-     * - Configuration/layer1: m1
-     * - Configuration/layer2: m1, m2 { exports p to m1; }
-     */
-    public void testQualifiedExports5() {
-        // create layer1 with m1
-        ModuleDescriptor descriptor1 = newBuilder("m1").build();
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
-        Configuration cf1 = resolve(finder1, "m1");
-        ClassLoader cl1 = new ClassLoader() { };
-        Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1);
-        assertTrue(layer1.modules().size() == 1);
-
-        // create layer2 with m1 and m2
-        ModuleDescriptor descriptor2 = newBuilder("m2").exports("p", Set.of("m1")).build();
-        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor1, descriptor2);
-        Configuration cf2 = resolve(cf1, finder2, "m1", "m2");
-        ClassLoader cl2 = new ClassLoader() { };
-        Layer layer2 = layer1.defineModules(cf2, mn -> cl2);
-        assertTrue(layer2.modules().size() == 2);
-
-        Module m1_v1 = layer1.findModule("m1").get();
-        Module m1_v2 = layer2.findModule("m1").get();
-        Module m2 = layer2.findModule("m2").get();
-
-        // check m2 exports p to layer2/m2
-        assertFalse(m2.isExported("p"));
-        assertTrue(m2.isExported("p", m1_v2));
-        assertFalse(m2.isExported("p", m1_v1));
-    }
-
-
-    /**
-     * Test layers with a qualified export. The module exporting the package
-     * reads the target module in the parent layer (due to requires transitive).
-     *
-     * - Configuration/layer1: m1, m2 { requires transitive m1; }
-     * - Configuration/layer2: m1, m3 { requires m2; exports p to m1; }
-     */
-    public void testQualifiedExports6() {
-        // create layer1 with m1 and m2
-        ModuleDescriptor descriptor1 = newBuilder("m1").build();
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .requires(Set.of(Requires.Modifier.TRANSITIVE), "m1")
-                .build();
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
-        Configuration cf1 = resolve(finder1, "m2");
-        ClassLoader loader1 = new ClassLoader() { };
-        Layer layer1 = Layer.empty().defineModules(cf1, mn -> loader1);
-        assertTrue(layer1.modules().size() == 2);
-
-        // create layer2 with m1 and m3
-        ModuleDescriptor descriptor3 = newBuilder("m3")
-                .requires("m2")
-                .exports("p", Set.of("m1"))
-                .build();
-        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor1, descriptor3);
-        Configuration cf2 = resolve(cf1, finder2, "m1", "m3");
-        ClassLoader loader2 = new ClassLoader() { };
-        Layer layer2 = layer1.defineModules(cf2, mn -> loader2);
-        assertTrue(layer2.modules().size() == 2);
-
-        Module m1_v1 = layer1.findModule("m1").get();
-        Module m2 = layer1.findModule("m2").get();
-
-        Module m1_v2 = layer2.findModule("m1").get();
-        Module m3 = layer2.findModule("m3").get();
-
-        assertTrue(m3.canRead(m1_v1));
-        assertFalse(m3.canRead(m1_v2));
-
-        assertFalse(m3.isExported("p"));
-        assertTrue(m3.isExported("p", m1_v1));
-        assertFalse(m3.isExported("p", m1_v2));
-        assertFalse(m3.isExported("p", m2));
-    }
-
-
-    /**
-     * Test layers with a qualified export. The target module is not in any layer.
-     *
-     * - Configuration/layer1: m1 { }
-     * - Configuration/layer2: m2 { exports p to m3; }
-     */
-    public void testQualifiedExports7() {
-        // create layer1 with m1
-        ModuleDescriptor descriptor1 = newBuilder("m1").build();
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1);
-        Configuration cf1 = resolve(finder1, "m1");
-        ClassLoader cl1 = new ClassLoader() { };
-        Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1);
-        assertTrue(layer1.modules().size() == 1);
-
-        // create layer2 with m2
-        ModuleDescriptor descriptor2 = newBuilder("m2")
-                .exports("p", Set.of("m3"))
-                .build();
-        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2);
-        Configuration cf2 = resolve(cf1, finder2, "m2");
-        ClassLoader cl2 = new ClassLoader() { };
-        Layer layer2 = layer1.defineModules(cf2, mn -> cl2);
-        assertTrue(layer2.modules().size() == 1);
-
-        Module m1 = layer1.findModule("m1").get();
-        Module m2 = layer2.findModule("m2").get();
-
-        // check m2 does not export p to anyone
-        assertFalse(m2.isExported("p"));
-        assertFalse(m2.isExported("p", m1));
-    }
-
-    /**
-     * Attempt to use Layer defineModules to create a layer with a module
-     * defined to a class loader that already has a module of the same name
-     * defined to the class loader.
-     */
-    @Test(expectedExceptions = { LayerInstantiationException.class })
-    public void testModuleAlreadyDefinedToLoader() {
-
-        ModuleDescriptor md = newBuilder("m")
-                .requires("java.base")
-                .build();
-
-        ModuleFinder finder = ModuleUtils.finderOf(md);
-
-        Configuration parent = Layer.boot().configuration();
-
-        Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m"));
-
-        ClassLoader loader = new ClassLoader() { };
-
-        Layer.boot().defineModules(cf, mn -> loader);
-
-        // should throw LayerInstantiationException as m1 already defined to loader
-        Layer.boot().defineModules(cf, mn -> loader);
-
-    }
-
-
-    /**
-     * Attempt to use Layer defineModules to create a Layer with a module
-     * containing package {@code p} where the class loader already has a module
-     * defined to it containing package {@code p}.
-     */
-    @Test(expectedExceptions = { LayerInstantiationException.class })
-    public void testPackageAlreadyInNamedModule() {
-
-        ModuleDescriptor md1 = newBuilder("m1")
-                .packages(Set.of("p"))
-                .requires("java.base")
-                .build();
-
-        ModuleDescriptor md2 = newBuilder("m2")
-                .packages(Set.of("p"))
-                .requires("java.base")
-                .build();
-
-        ModuleFinder finder = ModuleUtils.finderOf(md1, md2);
-
-        ClassLoader loader = new ClassLoader() { };
-
-        // define m1 containing package p to class loader
-
-        Configuration parent = Layer.boot().configuration();
-
-        Configuration cf1 = parent.resolve(finder, ModuleFinder.of(), Set.of("m1"));
-
-        Layer layer1 = Layer.boot().defineModules(cf1, mn -> loader);
-
-        // attempt to define m2 containing package p to class loader
-
-        Configuration cf2 = parent.resolve(finder, ModuleFinder.of(), Set.of("m2"));
-
-        // should throw exception because p already in m1
-        Layer layer2 = Layer.boot().defineModules(cf2, mn -> loader);
-
-    }
-
-
-    /**
-     * Attempt to use Layer defineModules to create a Layer with a module
-     * containing a package in which a type is already loaded by the class
-     * loader.
-     */
-    @Test(expectedExceptions = { LayerInstantiationException.class })
-    public void testPackageAlreadyInUnnamedModule() throws Exception {
-
-        Class<?> c = layertest.Test.class;
-        assertFalse(c.getModule().isNamed());  // in unnamed module
-
-        ModuleDescriptor md = newBuilder("m")
-                .packages(Set.of(c.getPackageName()))
-                .requires("java.base")
-                .build();
-
-        ModuleFinder finder = ModuleUtils.finderOf(md);
-
-        Configuration parent = Layer.boot().configuration();
-        Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m"));
-
-        Layer.boot().defineModules(cf, mn -> c.getClassLoader());
-    }
-
-
-    /**
-     * Attempt to create a Layer with a module named "java.base".
-     */
-    public void testLayerWithJavaBase() {
-        ModuleDescriptor descriptor = newBuilder("java.base")
-                .exports("java.lang")
-                .build();
-
-        ModuleFinder finder = ModuleUtils.finderOf(descriptor);
-
-        Configuration cf = Layer.boot()
-            .configuration()
-            .resolve(finder, ModuleFinder.of(), Set.of("java.base"));
-        assertTrue(cf.modules().size() == 1);
-
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-
-        try {
-            Layer.boot().defineModules(cf, mn -> new ClassLoader() { });
-            assertTrue(false);
-        } catch (LayerInstantiationException e) { }
-
-        try {
-            Layer.boot().defineModulesWithOneLoader(cf, scl);
-            assertTrue(false);
-        } catch (LayerInstantiationException e) { }
-
-        try {
-            Layer.boot().defineModulesWithManyLoaders(cf, scl);
-            assertTrue(false);
-        } catch (LayerInstantiationException e) { }
-    }
-
-
-    @DataProvider(name = "javaPackages")
-    public Object[][] javaPackages() {
-        return new Object[][] { { "m1", "java" }, { "m2", "java.x" } };
-    }
-
-    /**
-     * Attempt to create a Layer with a module containing a "java" package.
-     * This should only be allowed when the module is defined to the platform
-     * class loader.
-     */
-    @Test(dataProvider = "javaPackages")
-    public void testLayerWithJavaPackage(String mn, String pn) {
-        ModuleDescriptor descriptor = newBuilder(mn).packages(Set.of(pn)).build();
-        ModuleFinder finder = ModuleUtils.finderOf(descriptor);
-
-        Configuration cf = Layer.boot()
-                .configuration()
-                .resolve(finder, ModuleFinder.of(), Set.of(mn));
-        assertTrue(cf.modules().size() == 1);
-
-        ClassLoader pcl = ClassLoader.getPlatformClassLoader();
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-
-        try {
-            Layer.boot().defineModules(cf, _mn -> new ClassLoader() { });
-            assertTrue(false);
-        } catch (LayerInstantiationException e) { }
-
-        try {
-            Layer.boot().defineModulesWithOneLoader(cf, scl);
-            assertTrue(false);
-        } catch (LayerInstantiationException e) { }
-
-        try {
-            Layer.boot().defineModulesWithManyLoaders(cf, scl);
-            assertTrue(false);
-        } catch (LayerInstantiationException e) { }
-
-        // create layer with module defined to platform class loader
-        Layer layer = Layer.boot().defineModules(cf, _mn -> pcl);
-        Optional<Module> om = layer.findModule(mn);
-        assertTrue(om.isPresent());
-        Module foo = om.get();
-        assertTrue(foo.getClassLoader() == pcl);
-        assertTrue(foo.getPackages().length == 1);
-        assertTrue(foo.getPackages()[0].equals(pn));
-    }
-
-
-    /**
-     * Attempt to create a Layer with a module defined to the boot loader
-     */
-    @Test(expectedExceptions = { LayerInstantiationException.class })
-    public void testLayerWithBootLoader() {
-        ModuleDescriptor descriptor = newBuilder("m1")
-                .build();
-
-        ModuleFinder finder = ModuleUtils.finderOf(descriptor);
-
-        Configuration cf = Layer.boot()
-            .configuration()
-            .resolve(finder, ModuleFinder.of(), Set.of("m1"));
-        assertTrue(cf.modules().size() == 1);
-
-        Layer.boot().defineModules(cf, mn -> null );
-    }
-
-
-    /**
-     * Parent of configuration != configuration of parent Layer
-     */
-    @Test(expectedExceptions = { IllegalArgumentException.class })
-    public void testIncorrectParent1() {
-
-        ModuleDescriptor descriptor1 = newBuilder("m1")
-                .requires("java.base")
-                .build();
-
-        ModuleFinder finder = ModuleUtils.finderOf(descriptor1);
-
-        Configuration parent = Layer.boot().configuration();
-        Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m1"));
-
-        ClassLoader loader = new ClassLoader() { };
-        Layer.empty().defineModules(cf, mn -> loader);
-    }
-
-
-    /**
-     * Parent of configuration != configuration of parent Layer
-     */
-    @Test(expectedExceptions = { IllegalArgumentException.class })
-    public void testIncorrectParent2() {
-
-        ModuleDescriptor descriptor1 = newBuilder("m1")
-                .build();
-
-        ModuleFinder finder = ModuleUtils.finderOf(descriptor1);
-
-        Configuration cf = resolve(finder, "m1");
-
-        ClassLoader loader = new ClassLoader() { };
-        Layer.boot().defineModules(cf, mn -> loader);
-    }
-
-
-    // null handling
-
-    @Test(expectedExceptions = { NullPointerException.class })
-    public void testCreateWithNull1() {
-        ClassLoader loader = new ClassLoader() { };
-        Layer.empty().defineModules(null, mn -> loader);
-    }
-
-    @Test(expectedExceptions = { NullPointerException.class })
-    public void testCreateWithNull2() {
-        Configuration cf = resolve(Layer.boot().configuration(), ModuleFinder.of());
-        Layer.boot().defineModules(cf, null);
-    }
-
-    @Test(expectedExceptions = { NullPointerException.class })
-    public void testCreateWithNull3() {
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer.empty().defineModulesWithOneLoader(null, scl);
-    }
-
-    @Test(expectedExceptions = { NullPointerException.class })
-    public void testCreateWithNull4() {
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer.empty().defineModulesWithManyLoaders(null, scl);
-    }
-
-    @Test(expectedExceptions = { NullPointerException.class })
-    public void testFindModuleWithNull() {
-        Layer.boot().findModule(null);
-    }
-
-    @Test(expectedExceptions = { NullPointerException.class })
-    public void testFindLoaderWithNull() {
-        Layer.boot().findLoader(null);
-    }
-
-
-    // immutable sets
-
-    @Test(expectedExceptions = { UnsupportedOperationException.class })
-    public void testImmutableSet() {
-        Module base = Object.class.getModule();
-        Layer.boot().modules().add(base);
-    }
-
-
-    /**
-     * Resolve the given modules, by name, and returns the resulting
-     * Configuration.
-     */
-    private static Configuration resolve(Configuration cf,
-                                         ModuleFinder finder,
-                                         String... roots) {
-        return cf.resolve(finder, ModuleFinder.of(), Set.of(roots));
-    }
-
-    private static Configuration resolve(ModuleFinder finder,
-                                         String... roots) {
-        return resolve(Configuration.empty(), finder, roots);
-    }
-}
--- a/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,724 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @library /lib/testlibrary
- * @modules jdk.compiler
- * @build LayerAndLoadersTest CompilerUtils ModuleUtils
- * @run testng LayerAndLoadersTest
- * @summary Tests for java.lang.reflect.Layer@createWithXXX methods
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.module.Configuration;
-import java.lang.module.ModuleDescriptor;
-import java.lang.module.ModuleFinder;
-import java.lang.module.ModuleReference;
-import java.lang.reflect.Layer;
-import java.lang.reflect.LayerInstantiationException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Module;
-import java.net.URL;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Optional;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-
-@Test
-public class LayerAndLoadersTest {
-
-    private static final String TEST_SRC = System.getProperty("test.src");
-
-    private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
-    private static final Path MODS_DIR = Paths.get("mods");
-
-    @BeforeTest
-    public void setup() throws Exception {
-
-        // javac -d mods --module-source-path src src/**
-        assertTrue(CompilerUtils.compile(SRC_DIR, MODS_DIR,
-                "--module-source-path", SRC_DIR.toString()));
-    }
-
-
-    /**
-     * Basic test of Layer defineModulesWithOneLoader
-     *
-     * Test scenario:
-     *   m1 requires m2 and m3
-     */
-    public void testWithOneLoader() throws Exception {
-
-        Configuration cf = resolve("m1");
-
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-
-        Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl);
-
-        checkLayer(layer, "m1", "m2", "m3");
-
-        ClassLoader cl1 = layer.findLoader("m1");
-        ClassLoader cl2 = layer.findLoader("m2");
-        ClassLoader cl3 = layer.findLoader("m3");
-
-        assertTrue(cl1.getParent() == scl);
-        assertTrue(cl2 == cl1);
-        assertTrue(cl3 == cl1);
-
-        invoke(layer, "m1", "p.Main");
-
-    }
-
-
-    /**
-     * Basic test of Layer defineModulesWithManyLoaders
-     *
-     * Test scenario:
-     *   m1 requires m2 and m3
-     */
-    public void testWithManyLoaders() throws Exception {
-
-        Configuration cf = resolve("m1");
-
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-
-        Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl);
-
-        checkLayer(layer, "m1", "m2", "m3");
-
-        ClassLoader cl1 = layer.findLoader("m1");
-        ClassLoader cl2 = layer.findLoader("m2");
-        ClassLoader cl3 = layer.findLoader("m3");
-
-        assertTrue(cl1.getParent() == scl);
-        assertTrue(cl2.getParent() == scl);
-        assertTrue(cl3.getParent() == scl);
-        assertTrue(cl2 != cl1);
-        assertTrue(cl3 != cl1);
-        assertTrue(cl3 != cl2);
-
-        invoke(layer, "m1", "p.Main");
-
-    }
-
-
-    /**
-     * Basic test of Layer defineModulesWithOneLoader where one of the modules
-     * is a service provider module.
-     *
-     * Test scenario:
-     *    m1 requires m2 and m3
-     *    m1 uses S
-     *    m4 provides S with ...
-     */
-    public void testServicesWithOneLoader() throws Exception {
-
-        Configuration cf = resolveAndBind("m1");
-
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-
-        Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl);
-
-        checkLayer(layer, "m1", "m2", "m3", "m4");
-
-        ClassLoader cl1 = layer.findLoader("m1");
-        ClassLoader cl2 = layer.findLoader("m2");
-        ClassLoader cl3 = layer.findLoader("m3");
-        ClassLoader cl4 = layer.findLoader("m4");
-
-        assertTrue(cl1.getParent() == scl);
-        assertTrue(cl2 == cl1);
-        assertTrue(cl3 == cl1);
-        assertTrue(cl4 == cl1);
-
-        Class<?> serviceType = cl1.loadClass("p.Service");
-        assertTrue(serviceType.getClassLoader() == cl1);
-
-        Iterator<?> iter = ServiceLoader.load(serviceType, cl1).iterator();
-        Object provider = iter.next();
-        assertTrue(serviceType.isInstance(provider));
-        assertTrue(provider.getClass().getClassLoader() == cl1);
-        assertFalse(iter.hasNext());
-
-    }
-
-
-    /**
-     * Basic test of Layer defineModulesWithManyLoaders where one of the
-     * modules is a service provider module.
-     *
-     * Test scenario:
-     *    m1 requires m2 and m3
-     *    m1 uses S
-     *    m4 provides S with ...
-     */
-    public void testServicesWithManyLoaders() throws Exception {
-
-        Configuration cf = resolveAndBind("m1");
-
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-
-        Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl);
-
-        checkLayer(layer, "m1", "m2", "m3", "m4");
-
-        ClassLoader cl1 = layer.findLoader("m1");
-        ClassLoader cl2 = layer.findLoader("m2");
-        ClassLoader cl3 = layer.findLoader("m3");
-        ClassLoader cl4 = layer.findLoader("m4");
-
-        assertTrue(cl1.getParent() == scl);
-        assertTrue(cl2.getParent() == scl);
-        assertTrue(cl3.getParent() == scl);
-        assertTrue(cl4.getParent() == scl);
-        assertTrue(cl2 != cl1);
-        assertTrue(cl3 != cl1);
-        assertTrue(cl3 != cl2);
-        assertTrue(cl4 != cl1);
-        assertTrue(cl4 != cl2);
-        assertTrue(cl4 != cl3);
-
-        Class<?> serviceType = cl1.loadClass("p.Service");
-        assertTrue(serviceType.getClassLoader() == cl1);
-
-        // Test that the service provider can be located via any of
-        // the class loaders in the layer
-        for (Module m : layer.modules()) {
-            ClassLoader loader = m.getClassLoader();
-            Iterator<?> iter = ServiceLoader.load(serviceType, loader).iterator();
-            Object provider = iter.next();
-            assertTrue(serviceType.isInstance(provider));
-            assertTrue(provider.getClass().getClassLoader() == cl4);
-            assertFalse(iter.hasNext());
-        }
-
-    }
-
-
-    /**
-     * Tests that the class loaders created by defineModulesWithXXX delegate
-     * to the given parent class loader.
-     */
-    public void testDelegationToParent() throws Exception {
-
-        Configuration cf = resolve("m1");
-
-        ClassLoader parent = this.getClass().getClassLoader();
-        String cn = this.getClass().getName();
-
-        // one loader
-        Layer layer = Layer.boot().defineModulesWithOneLoader(cf, parent);
-        testLoad(layer, cn);
-
-         // one loader with boot loader as parent
-        layer = Layer.boot().defineModulesWithOneLoader(cf, null);
-        testLoadFail(layer, cn);
-
-        // many loaders
-        layer = Layer.boot().defineModulesWithManyLoaders(cf, parent);
-        testLoad(layer, cn);
-
-        // many loader with boot loader as parent
-        layer = Layer.boot().defineModulesWithManyLoaders(cf, null);
-        testLoadFail(layer, cn);
-
-    }
-
-
-    /**
-     * Test defineModulesWithXXX when modules that have overlapping packages.
-     *
-     * Test scenario:
-     *   m1 exports p
-     *   m2 exports p
-     */
-    public void testOverlappingPackages() {
-
-        ModuleDescriptor descriptor1
-            = ModuleDescriptor.newModule("m1").exports("p").build();
-
-        ModuleDescriptor descriptor2
-            = ModuleDescriptor.newModule("m2").exports("p").build();
-
-        ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2);
-
-        Configuration cf = Layer.boot()
-            .configuration()
-            .resolve(finder, ModuleFinder.of(), Set.of("m1", "m2"));
-
-        // cannot define both module m1 and m2 to the same class loader
-        try {
-            Layer.boot().defineModulesWithOneLoader(cf, null);
-            assertTrue(false);
-        } catch (LayerInstantiationException expected) { }
-
-        // should be okay to have one module per class loader
-        Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, null);
-        checkLayer(layer, "m1", "m2");
-
-    }
-
-
-    /**
-     * Test Layer defineModulesWithXXX with split delegation.
-     *
-     * Test scenario:
-     *   layer1: m1 exports p, m2 exports p
-     *   layer2: m3 reads m1, m4 reads m2
-     */
-    public void testSplitDelegation() {
-
-        ModuleDescriptor descriptor1
-            = ModuleDescriptor.newModule("m1").exports("p").build();
-
-        ModuleDescriptor descriptor2
-            = ModuleDescriptor.newModule("m2").exports("p").build();
-
-        ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2);
-
-        Configuration cf1 = Layer.boot()
-            .configuration()
-            .resolve(finder1, ModuleFinder.of(), Set.of("m1", "m2"));
-
-        Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, null);
-        checkLayer(layer1, "m1", "m2");
-
-        ModuleDescriptor descriptor3
-            = ModuleDescriptor.newModule("m3").requires("m1").build();
-
-        ModuleDescriptor descriptor4
-            = ModuleDescriptor.newModule("m4").requires("m2").build();
-
-        ModuleFinder finder2 = ModuleUtils.finderOf(descriptor3, descriptor4);
-
-        Configuration cf2 = cf1.resolve(finder2, ModuleFinder.of(),
-                                                Set.of("m3", "m4"));
-
-        // package p cannot be supplied by two class loaders
-        try {
-            layer1.defineModulesWithOneLoader(cf2, null);
-            assertTrue(false);
-        } catch (LayerInstantiationException expected) { }
-
-        // no split delegation when modules have their own class loader
-        Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
-        checkLayer(layer2, "m3", "m4");
-
-    }
-
-
-    /**
-     * Test Layer defineModulesWithXXX when the modules that override same
-     * named modules in the parent layer.
-     *
-     * Test scenario:
-     *   layer1: m1, m2, m3 => same loader
-     *   layer2: m1, m2, m4 => same loader
-     */
-    public void testOverriding1() throws Exception {
-
-        Configuration cf1 = resolve("m1");
-
-        Layer layer1 = Layer.boot().defineModulesWithOneLoader(cf1, null);
-        checkLayer(layer1, "m1", "m2", "m3");
-
-        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(),
-                                                Set.of("m1"));
-
-        Layer layer2 = layer1.defineModulesWithOneLoader(cf2, null);
-        checkLayer(layer2, "m1", "m2", "m3");
-        invoke(layer1, "m1", "p.Main");
-
-        ClassLoader loader1 = layer1.findLoader("m1");
-        ClassLoader loader2 = layer1.findLoader("m2");
-        ClassLoader loader3 = layer1.findLoader("m3");
-
-        ClassLoader loader4 = layer2.findLoader("m1");
-        ClassLoader loader5 = layer2.findLoader("m2");
-        ClassLoader loader6 = layer2.findLoader("m3");
-
-        assertTrue(loader1 == loader2);
-        assertTrue(loader1 == loader3);
-
-        assertTrue(loader4 == loader5);
-        assertTrue(loader4 == loader6);
-        assertTrue(loader4 != loader1);
-
-        assertTrue(loader1.loadClass("p.Main").getClassLoader() == loader1);
-        assertTrue(loader1.loadClass("q.Hello").getClassLoader() == loader1);
-        assertTrue(loader1.loadClass("w.Hello").getClassLoader() == loader1);
-
-        assertTrue(loader4.loadClass("p.Main").getClassLoader() == loader4);
-        assertTrue(loader4.loadClass("q.Hello").getClassLoader() == loader4);
-        assertTrue(loader4.loadClass("w.Hello").getClassLoader() == loader4);
-
-    }
-
-
-    /**
-     * Test Layer defineModulesWithXXX when the modules that override same
-     * named modules in the parent layer.
-     *
-     * Test scenario:
-     *   layer1: m1, m2, m3 => loader pool
-     *   layer2: m1, m2, m3 => loader pool
-     */
-    public void testOverriding2() throws Exception {
-
-        Configuration cf1 = resolve("m1");
-
-        Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, null);
-        checkLayer(layer1, "m1", "m2", "m3");
-
-        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(),
-                                                Set.of("m1"));
-
-        Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
-        checkLayer(layer2, "m1", "m2", "m3");
-        invoke(layer1, "m1", "p.Main");
-
-        ClassLoader loader1 = layer1.findLoader("m1");
-        ClassLoader loader2 = layer1.findLoader("m2");
-        ClassLoader loader3 = layer1.findLoader("m3");
-
-        ClassLoader loader4 = layer2.findLoader("m1");
-        ClassLoader loader5 = layer2.findLoader("m2");
-        ClassLoader loader6 = layer2.findLoader("m3");
-
-        assertTrue(loader4 != loader1);
-        assertTrue(loader5 != loader2);
-        assertTrue(loader6 != loader3);
-
-        assertTrue(loader1.loadClass("p.Main").getClassLoader() == loader1);
-        assertTrue(loader1.loadClass("q.Hello").getClassLoader() == loader2);
-        assertTrue(loader1.loadClass("w.Hello").getClassLoader() == loader3);
-
-        // p.Main is not visible via loader2
-        try {
-            loader2.loadClass("p.Main");
-            assertTrue(false);
-        } catch (ClassNotFoundException expected) { }
-
-        // w.Hello is not visible via loader2
-        try {
-            loader2.loadClass("w.Hello");
-            assertTrue(false);
-        } catch (ClassNotFoundException expected) { }
-
-        // p.Main is not visible via loader3
-        try {
-            loader3.loadClass("p.Main");
-            assertTrue(false);
-        } catch (ClassNotFoundException expected) { }
-
-        // q.Hello is not visible via loader3
-        try {
-            loader3.loadClass("q.Hello");
-            assertTrue(false);
-        } catch (ClassNotFoundException expected) { }
-
-
-        assertTrue(loader4.loadClass("p.Main").getClassLoader() == loader4);
-        assertTrue(loader5.loadClass("q.Hello").getClassLoader() == loader5);
-        assertTrue(loader6.loadClass("w.Hello").getClassLoader() == loader6);
-
-        // p.Main is not visible via loader5
-        try {
-            loader5.loadClass("p.Main");
-            assertTrue(false);
-        } catch (ClassNotFoundException expected) { }
-
-        // w.Hello is not visible via loader5
-        try {
-            loader5.loadClass("w.Hello");
-            assertTrue(false);
-        } catch (ClassNotFoundException expected) { }
-
-        // p.Main is not visible via loader6
-        try {
-            loader6.loadClass("p.Main");
-            assertTrue(false);
-        } catch (ClassNotFoundException expected) { }
-
-        // q.Hello is not visible via loader6
-        try {
-            loader6.loadClass("q.Hello");
-            assertTrue(false);
-        } catch (ClassNotFoundException expected) { }
-
-    }
-
-
-    /**
-     * Test Layer defineModulesWithXXX when the modules that override same
-     * named modules in the parent layer.
-     *
-     * layer1: m1, m2, m3 => same loader
-     * layer2: m1, m3 => same loader
-     */
-    public void testOverriding3() throws Exception {
-
-        Configuration cf1 = resolve("m1");
-
-        Layer layer1 = Layer.boot().defineModulesWithOneLoader(cf1, null);
-        checkLayer(layer1, "m1", "m2", "m3");
-
-        ModuleFinder finder = finderFor("m1", "m3");
-
-        Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(),
-                                                Set.of("m1"));
-
-        Layer layer2 = layer1.defineModulesWithOneLoader(cf2, null);
-        checkLayer(layer2, "m1", "m3");
-        invoke(layer1, "m1", "p.Main");
-
-        ClassLoader loader1 = layer1.findLoader("m1");
-        ClassLoader loader2 = layer2.findLoader("m1");
-
-        assertTrue(loader1.loadClass("p.Main").getClassLoader() == loader1);
-        assertTrue(loader1.loadClass("q.Hello").getClassLoader() == loader1);
-        assertTrue(loader1.loadClass("w.Hello").getClassLoader() == loader1);
-
-        assertTrue(loader2.loadClass("p.Main").getClassLoader() == loader2);
-        assertTrue(loader2.loadClass("q.Hello").getClassLoader() == loader1);
-        assertTrue(loader2.loadClass("w.Hello").getClassLoader() == loader2);
-
-    }
-
-
-    /**
-     * Test Layer defineModulesWithXXX when the modules that override same
-     * named modules in the parent layer.
-     *
-     * layer1: m1, m2, m3 => loader pool
-     * layer2: m1, m3 => loader pool
-     */
-    public void testOverriding4() throws Exception {
-
-        Configuration cf1 = resolve("m1");
-
-        Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, null);
-        checkLayer(layer1, "m1", "m2", "m3");
-
-        ModuleFinder finder = finderFor("m1", "m3");
-
-        Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(),
-                                                Set.of("m1"));
-
-        Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
-        checkLayer(layer2, "m1", "m3");
-        invoke(layer1, "m1", "p.Main");
-
-        ClassLoader loader1 = layer1.findLoader("m1");
-        ClassLoader loader2 = layer1.findLoader("m2");
-        ClassLoader loader3 = layer1.findLoader("m3");
-
-        ClassLoader loader4 = layer2.findLoader("m1");
-        ClassLoader loader5 = layer2.findLoader("m2");
-        ClassLoader loader6 = layer2.findLoader("m3");
-
-        assertTrue(loader4 != loader1);
-        assertTrue(loader5 == loader2);  // m2 not overridden
-        assertTrue(loader6 != loader3);
-
-        assertTrue(loader1.loadClass("p.Main").getClassLoader() == loader1);
-        assertTrue(loader1.loadClass("q.Hello").getClassLoader() == loader2);
-        assertTrue(loader1.loadClass("w.Hello").getClassLoader() == loader3);
-
-        assertTrue(loader2.loadClass("q.Hello").getClassLoader() == loader2);
-
-        assertTrue(loader3.loadClass("w.Hello").getClassLoader() == loader3);
-
-        assertTrue(loader4.loadClass("p.Main").getClassLoader() == loader4);
-        assertTrue(loader4.loadClass("q.Hello").getClassLoader() == loader2);
-        assertTrue(loader4.loadClass("w.Hello").getClassLoader() == loader6);
-
-        assertTrue(loader6.loadClass("w.Hello").getClassLoader() == loader6);
-
-    }
-
-
-    /**
-     * Basic test of resource loading with a class loader created by
-     * Layer.defineModulesWithOneLoader.
-     */
-    public void testResourcesOneLoader() throws Exception {
-        Configuration cf = resolve("m1");
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl);
-        ClassLoader loader = layer.findLoader("m1");
-        testResourceLoading(loader, "p/Main.class");
-    }
-
-    /**
-     * Basic test of resource loading with a class loader created by
-     * Layer.defineModulesWithOneLoader.
-     */
-    public void testResourcesManyLoaders() throws Exception {
-        Configuration cf = resolve("m1");
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl);
-        ClassLoader loader = layer.findLoader("m1");
-        testResourceLoading(loader, "p/Main.class");
-    }
-
-    /**
-     * Test that a resource is located by a class loader.
-     */
-    private void testResourceLoading(ClassLoader loader, String name)
-        throws IOException
-    {
-        URL url = loader.getResource(name);
-        assertNotNull(url);
-
-        try (InputStream in = loader.getResourceAsStream(name)) {
-            assertNotNull(in);
-        }
-
-        Enumeration<URL> urls = loader.getResources(name);
-        assertTrue(urls.hasMoreElements());
-    }
-
-
-    // -- supporting methods --
-
-
-    /**
-     * Resolve the given modules, by name, and returns the resulting
-     * Configuration.
-     */
-    private static Configuration resolve(String... roots) {
-        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        return Layer.boot()
-            .configuration()
-            .resolve(finder, ModuleFinder.of(), Set.of(roots));
-    }
-
-    /**
-     * Resolve the given modules, by name, and returns the resulting
-     * Configuration.
-     */
-    private static Configuration resolveAndBind(String... roots) {
-        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        return Layer.boot()
-            .configuration()
-            .resolveAndBind(finder, ModuleFinder.of(), Set.of(roots));
-    }
-
-
-    /**
-     * Invokes the static void main(String[]) method on the given class
-     * in the given module.
-     */
-    private static void invoke(Layer layer, String mn, String mc) throws Exception {
-        ClassLoader loader = layer.findLoader(mn);
-        Class<?> c = loader.loadClass(mc);
-        Method mainMethod = c.getMethod("main", String[].class);
-        mainMethod.invoke(null, (Object)new String[0]);
-    }
-
-
-    /**
-     * Checks that the given layer contains exactly the expected modules
-     * (by name).
-     */
-    private void checkLayer(Layer layer, String ... expected) {
-        Set<String> names = layer.modules().stream()
-                .map(Module::getName)
-                .collect(Collectors.toSet());
-        assertTrue(names.size() == expected.length);
-        for (String name : expected) {
-            assertTrue(names.contains(name));
-        }
-    }
-
-
-    /**
-     * Test that a class can be loaded via the class loader of all modules
-     * in the given layer.
-     */
-    static void testLoad(Layer layer, String cn) throws Exception {
-        for (Module m : layer.modules()) {
-            ClassLoader l = m.getClassLoader();
-            l.loadClass(cn);
-        }
-    }
-
-
-    /**
-     * Test that a class cannot be loaded via any of the class loaders of
-     * the modules in the given layer.
-     */
-    static void testLoadFail(Layer layer, String cn) throws Exception {
-        for (Module m : layer.modules()) {
-            ClassLoader l = m.getClassLoader();
-            try {
-                l.loadClass(cn);
-                assertTrue(false);
-            } catch (ClassNotFoundException expected) { }
-        }
-    }
-
-
-    /**
-     * Returns a ModuleFinder that only finds the given test modules
-     */
-    static ModuleFinder finderFor(String... names) {
-
-        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-
-        Map<String, ModuleReference> mrefs = new HashMap<>();
-        for (String name : names) {
-            Optional<ModuleReference> omref = finder.find(name);
-            assert omref.isPresent();
-            mrefs.put(name, omref.get());
-        }
-
-        return new ModuleFinder() {
-            @Override
-            public Optional<ModuleReference> find(String name) {
-                ModuleReference mref = mrefs.get(name);
-                return Optional.ofNullable(mref);
-            }
-            @Override
-            public Set<ModuleReference> findAll() {
-                return mrefs.values().stream().collect(Collectors.toSet());
-            }
-        };
-    }
-
-}
--- a/jdk/test/java/lang/reflect/Layer/LayerControllerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @library /lib/testlibrary
- * @build LayerControllerTest ModuleUtils
- * @run testng LayerControllerTest
- * @summary Basic tests for java.lang.reflect.Layer.Controller
- */
-
-import java.lang.module.Configuration;
-import java.lang.module.ModuleDescriptor;
-import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
-import java.util.List;
-import java.util.Set;
-
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-
-@Test
-public class LayerControllerTest {
-
-    /**
-     * Creates a Controller for a module layer containing modules m1 and m2.
-     * Module m1 contains p1, reads java.base, does not export/open any package
-     * Module m2 contains p2, reads java.base, does not export/open any package
-     */
-    private Layer.Controller createTestLayer() {
-        ModuleDescriptor descriptor1
-            = ModuleDescriptor.newModule("m1")
-                .packages(Set.of("p1"))
-                .requires("java.base")
-                .build();
-
-        ModuleDescriptor descriptor2
-            = ModuleDescriptor.newModule("m2")
-                .requires("java.base")
-                .packages(Set.of("p2"))
-                .build();
-
-        ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2);
-        Layer bootLayer = Layer.boot();
-
-        Configuration cf = bootLayer.configuration()
-                .resolve(finder, ModuleFinder.of(), Set.of("m1", "m2"));
-
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-
-        Layer.Controller controller
-                = Layer.defineModulesWithOneLoader(cf, List.of(bootLayer), scl);
-
-        Layer layer = controller.layer();
-
-        assertTrue(layer.modules().size() == 2);
-        assertTrue(layer.findModule("m1").isPresent());
-        assertTrue(layer.findModule("m2").isPresent());
-
-        return controller;
-    }
-
-    /**
-     * Basic test of Layer.Controller to update modules m1 and m2 to read and
-     * open packages to each other.
-     */
-    public void testBasic() {
-        Layer.Controller controller = createTestLayer();
-        Layer layer = controller.layer();
-        Module m1 = layer.findModule("m1").orElseThrow(RuntimeException::new);
-        Module m2 = layer.findModule("m2").orElseThrow(RuntimeException::new);
-
-        assertFalse(m1.canRead(m2));
-        assertFalse(m1.isExported("p1"));
-        assertFalse(m1.isOpen("p1"));
-        assertFalse(m1.isExported("p1", m2));
-        assertFalse(m1.isOpen("p1", m2));
-
-        assertFalse(m2.canRead(m1));
-        assertFalse(m2.isExported("p2"));
-        assertFalse(m2.isOpen("p2"));
-        assertFalse(m2.isExported("p2", m1));
-        assertFalse(m2.isOpen("p2", m1));
-
-        // update m1 to read m2
-        assertTrue(controller.addReads(m1, m2) == controller);
-        assertTrue(m1.canRead(m2));
-        assertFalse(m2.canRead(m1));
-
-        // update m2 to read m1
-        assertTrue(controller.addReads(m2, m1) == controller);
-        assertTrue(m1.canRead(m2));
-        assertTrue(m1.canRead(m1));
-
-        // update m1 to open p1 to m2
-        assertTrue(controller.addOpens(m1, "p1", m2) == controller);
-        assertTrue(m1.isExported("p1", m2));
-        assertTrue(m1.isOpen("p1", m2));
-        assertFalse(m1.isExported("p1"));
-        assertFalse(m1.isOpen("p1"));
-
-        // update m2 to open p2 to m1
-        assertTrue(controller.addOpens(m2, "p2", m1) == controller);
-        assertTrue(m2.isExported("p2", m1));
-        assertTrue(m2.isOpen("p2", m1));
-        assertFalse(m2.isExported("p2"));
-        assertFalse(m2.isOpen("p2"));
-    }
-
-    /**
-     * Test invalid argument handling
-     */
-    public void testBadArguments() {
-        Layer.Controller controller = createTestLayer();
-        Layer layer = controller.layer();
-        Module m1 = layer.findModule("m1").orElseThrow(RuntimeException::new);
-        Module m2 = layer.findModule("m2").orElseThrow(RuntimeException::new);
-        Module base = Object.class.getModule();
-
-        // java.base is not in layer
-        try {
-            controller.addReads(base, m2);
-            assertTrue(false);
-        } catch (IllegalArgumentException expected) { }
-
-        // java.base is not in layer
-        try {
-            controller.addOpens(base, "java.lang", m2);
-            assertTrue(false);
-        } catch (IllegalArgumentException expected) { }
-
-        // m1 does not contain java.lang
-        try {
-            controller.addOpens(m1, "java.lang", m2);
-            assertTrue(false);
-        } catch (IllegalArgumentException expected) { }
-    }
-
-    /**
-     * Test null handling
-     */
-    public void testNulls() {
-        Layer.Controller controller = createTestLayer();
-        Layer layer = controller.layer();
-        Module m1 = layer.findModule("m1").orElseThrow(RuntimeException::new);
-        Module m2 = layer.findModule("m2").orElseThrow(RuntimeException::new);
-        assertTrue(m1 != null);
-        assertTrue(m2 != null);
-
-        try {
-            controller.addReads(null, m2);
-            assertTrue(false);
-        } catch (NullPointerException expected) { }
-
-        try {
-            controller.addReads(m1, null);
-            assertTrue(false);
-        } catch (NullPointerException expected) { }
-
-        try {
-            controller.addOpens(null, "p1", m2);
-            assertTrue(false);
-        } catch (NullPointerException expected) { }
-
-        try {
-            controller.addOpens(m1, null, m2);
-            assertTrue(false);
-        } catch (NullPointerException expected) { }
-
-        try {
-            controller.addOpens(m1, "p1", null);
-            assertTrue(false);
-        } catch (NullPointerException expected) { }
-    }
-}
--- a/jdk/test/java/lang/reflect/Layer/layertest/Test.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Supporting class for tests of java.lang.reflect.Layer.
- */
-
-package layertest;
-
-public class Test { }
-
--- a/jdk/test/java/lang/reflect/Layer/src/m1/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-module m1 {
-    requires m2;
-    requires m3;
-    exports p;
-    uses p.Service;
-}
--- a/jdk/test/java/lang/reflect/Layer/src/m1/p/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-import java.net.URL;
-
-public class Main {
-    public static void main(String[] args) {
-
-        URL url1 = Main.class.getResource("Main.class");
-        if (url1 == null) throw new RuntimeException();
-        URL url2 = Main.class.getResource("/p/Main.class");
-        if (url2 == null) throw new RuntimeException();
-
-        q.Hello.hello();
-        w.Hello.hello();
-    }
-}
--- a/jdk/test/java/lang/reflect/Layer/src/m1/p/Service.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public interface Service { }
--- a/jdk/test/java/lang/reflect/Layer/src/m2/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-module m2 {
-    exports q;
-}
--- a/jdk/test/java/lang/reflect/Layer/src/m2/q/Hello.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package q;
-
-import java.net.URL;
-
-public class Hello {
-
-    public static void hello() {
-
-        URL url1 = Hello.class.getResource("Hello.class");
-        if (url1 == null) throw new RuntimeException();
-        URL url2 = Hello.class.getResource("/q/Hello.class");
-        if (url2 == null) throw new RuntimeException();
-
-        System.out.println("Hello!");
-    }
-
-}
--- a/jdk/test/java/lang/reflect/Layer/src/m3/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-module m3 {
-    // qualified export
-    exports w to m1;
-}
--- a/jdk/test/java/lang/reflect/Layer/src/m3/w/Hello.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package w;
-
-import java.net.URL;
-
-public class Hello {
-
-    public static void hello() {
-
-        URL url1 = Hello.class.getResource("Hello.class");
-        if (url1 == null) throw new RuntimeException();
-        URL url2 = Hello.class.getResource("/w/Hello.class");
-        if (url2 == null) throw new RuntimeException();
-
-        System.out.println("Hello!");
-    }
-
-}
--- a/jdk/test/java/lang/reflect/Layer/src/m4/impl/ServiceImpl.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package impl;
-
-public class ServiceImpl implements p.Service {
-}
--- a/jdk/test/java/lang/reflect/Layer/src/m4/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-module m4 {
-    requires m1;
-    provides p.Service with impl.ServiceImpl;
-}
--- a/jdk/test/java/lang/reflect/Module/AddExportsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @modules java.base/jdk.internal.misc
- *          java.desktop
- * @run main/othervm --add-exports=java.desktop/sun.awt=java.base AddExportsTest
- * @run main/othervm --add-exports=java.desktop/sun.awt=ALL-UNNAMED AddExportsTest
- * @summary Test Module isExported methods with exports changed by -AddExportsTest
- */
-
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
-import java.util.Optional;
-import java.util.stream.Stream;
-
-import jdk.internal.misc.VM;
-
-public class AddExportsTest {
-    /*
-     * jtreg sets -Dtest.modules system property to the internal APIs
-     * specified at @modules tag.  The test will exclude --add-exports set
-     * for @modules.
-     */
-    private static final String TEST_MODULES = System.getProperty("test.modules");
-
-    public static void main(String[] args) {
-
-        Optional<String> oaddExports = Stream.of(VM.getRuntimeArguments())
-            .filter(arg -> arg.startsWith("--add-exports="))
-            .filter(arg -> !arg.equals("--add-exports=" + TEST_MODULES + "=ALL-UNNAMED"))
-            .map(arg -> arg.substring("--add-exports=".length(), arg.length()))
-            .findFirst();
-
-        assertTrue(oaddExports.isPresent());
-
-        Layer bootLayer = Layer.boot();
-
-        Module unnamedModule = AddExportsTest.class.getModule();
-        assertFalse(unnamedModule.isNamed());
-
-        for (String expr : oaddExports.get().split(",")) {
-
-            String[] s = expr.split("=");
-            assertTrue(s.length == 2);
-
-            // $MODULE/$PACKAGE
-            String[] moduleAndPackage = s[0].split("/");
-            assertTrue(moduleAndPackage.length == 2);
-
-            String mn = moduleAndPackage[0];
-            String pn = moduleAndPackage[1];
-
-            // source module
-            Module source;
-            Optional<Module> om = bootLayer.findModule(mn);
-            assertTrue(om.isPresent(), mn + " not in boot layer");
-            source = om.get();
-
-            // package should not be exported unconditionally
-            assertFalse(source.isExported(pn),
-                        pn + " should not be exported unconditionally");
-
-            // $TARGET
-            String tn = s[1];
-            if ("ALL-UNNAMED".equals(tn)) {
-
-                // package is exported to all unnamed modules
-                assertTrue(source.isExported(pn, unnamedModule),
-                           pn + " should be exported to all unnamed modules");
-
-            } else {
-
-                om = bootLayer.findModule(tn);
-                assertTrue(om.isPresent());
-                Module target = om.get();
-
-                // package should be exported to target module
-                assertTrue(source.isExported(pn, target),
-                           pn + " should be exported to " + target);
-
-                // package should not be exported to unnamed modules
-                assertFalse(source.isExported(pn, unnamedModule),
-                            pn + " should not be exported to unnamed modules");
-
-            }
-
-        }
-    }
-
-    static void assertTrue(boolean cond) {
-        if (!cond) throw new RuntimeException();
-    }
-
-    static void assertTrue(boolean cond, String msg) {
-        if (!cond) throw new RuntimeException(msg);
-    }
-
-    static void assertFalse(boolean cond) {
-        if (cond) throw new RuntimeException();
-    }
-
-    static void assertFalse(boolean cond, String msg) {
-        if (cond) throw new RuntimeException(msg);
-    }
-
-}
--- a/jdk/test/java/lang/reflect/Module/AnnotationsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.module.Configuration;
-import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
-import java.nio.file.Files;
-import java.nio.file.Path;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import jdk.internal.module.ClassFileAttributes;
-import jdk.internal.org.objectweb.asm.AnnotationVisitor;
-import jdk.internal.org.objectweb.asm.Attribute;
-import jdk.internal.org.objectweb.asm.ClassReader;
-import jdk.internal.org.objectweb.asm.ClassVisitor;
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.Opcodes;
-
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-
-/**
- * @test
- * @modules java.base/jdk.internal.org.objectweb.asm
- *          java.base/jdk.internal.module
- *          java.xml
- * @run testng AnnotationsTest
- * @summary Basic test of annotations on modules
- */
-
-public class AnnotationsTest {
-
-    /**
-     * Test that there are no annotations on an unnamed module.
-     */
-    @Test
-    public void testUnnamedModule() {
-        Module module = this.getClass().getModule();
-        assertTrue(module.getAnnotations().length == 0);
-    }
-
-    /**
-     * Test loading a module with a RuntimeVisibleAnnotation attribute.
-     * The test copies the module-info.class for java.xml, adds the attribute,
-     * and then loads the updated module.
-     */
-    @Test
-    public void testNamedModule() throws IOException {
-
-        // "deprecate" java.xml
-        Path dir = Files.createTempDirectory("mods");
-        deprecateModule("java.xml", true, "9", dir);
-
-        // "load" the cloned java.xml
-        Module module = loadModule(dir, "java.xml");
-
-        // check the annotation is present
-        assertTrue(module.isAnnotationPresent(Deprecated.class));
-        Deprecated d = module.getAnnotation(Deprecated.class);
-        assertNotNull(d, "@Deprecated not found");
-        assertTrue(d.forRemoval());
-        assertEquals(d.since(), "9");
-        Annotation[] a = module.getAnnotations();
-        assertTrue(a.length == 1);
-        assertTrue(a[0] instanceof Deprecated);
-    }
-
-
-    /**
-     * Copy the module-info.class for the given module, add the
-     * Deprecated annotation, and write the updated module-info.class
-     * to a directory.
-     */
-    static void deprecateModule(String name,
-                                boolean forRemoval,
-                                String since,
-                                Path output) throws IOException {
-        Module module = Layer.boot().findModule(name).orElse(null);
-        assertNotNull(module, name + " not found");
-
-        InputStream in = module.getResourceAsStream("module-info.class");
-        assertNotNull(in, "No module-info.class for " + name);
-
-        try (in) {
-            ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS
-                                             + ClassWriter.COMPUTE_FRAMES);
-
-            ClassVisitor cv = new ClassVisitor(Opcodes.ASM5, cw) { };
-
-            ClassReader cr = new ClassReader(in);
-
-            List<Attribute> attrs = new ArrayList<>();
-            attrs.add(new ClassFileAttributes.ModuleAttribute());
-            attrs.add(new ClassFileAttributes.ModulePackagesAttribute());
-            attrs.add(new ClassFileAttributes.ModuleTargetAttribute());
-            cr.accept(cv, attrs.toArray(new Attribute[0]), 0);
-
-            AnnotationVisitor annotationVisitor
-                = cv.visitAnnotation("Ljava/lang/Deprecated;", true);
-            annotationVisitor.visit("forRemoval", forRemoval);
-            annotationVisitor.visit("since", since);
-            annotationVisitor.visitEnd();
-
-            byte[] bytes = cw.toByteArray();
-            Path mi = output.resolve("module-info.class");
-            Files.write(mi, bytes);
-        }
-    }
-
-    /**
-     * Load the module of the given name in the given directory into a
-     * child layer.
-     */
-    static Module loadModule(Path dir, String name) throws IOException {
-        ModuleFinder finder = ModuleFinder.of(dir);
-
-        Layer bootLayer = Layer.boot();
-
-        Configuration cf = bootLayer.configuration()
-                .resolve(finder, ModuleFinder.of(), Set.of(name));
-
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
-
-        Module module = layer.findModule(name).orElse(null);
-        assertNotNull(module, name + " not loaded");
-        return module;
-    }
-}
--- a/jdk/test/java/lang/reflect/Module/BasicModuleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-/*
- * 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
- * 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.module.ModuleDescriptor.Exports;
-import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
-import java.nio.file.spi.FileSystemProvider;  // service type in java.base
-import java.util.function.Predicate;
-import java.util.stream.Stream;
-import javax.print.PrintServiceLookup;        // service type in java.desktop
-
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-
-/*
- * @test
- * @summary Basic test of java.lang.reflect.Module
- * @modules java.desktop java.xml
- * @run testng BasicModuleTest
- */
-
-public class BasicModuleTest {
-
-    /**
-     * Tests that the given module reads all modules in the boot Layer.
-     */
-    private void testReadsAllBootModules(Module m) {
-        Layer bootLayer = Layer.boot();
-        bootLayer.configuration()
-            .modules()
-            .stream()
-            .map(ResolvedModule::name)
-            .map(bootLayer::findModule)
-            .forEach(target -> assertTrue(m.canRead(target.get())));
-    }
-
-    /**
-     * Returns {@code true} if the array contains the given object.
-     */
-    private <T> boolean contains(T[] array, T obj) {
-        return Stream.of(array).anyMatch(obj::equals);
-    }
-
-    /**
-     * Returns a {@code Predicate} to test if a package is exported.
-     */
-    private Predicate<Exports> doesExport(String pn) {
-        return e -> (e.source().equals(pn) && !e.isQualified());
-    }
-
-
-
-    @Test
-    public void testThisModule() {
-        Module thisModule = BasicModuleTest.class.getModule();
-        Module baseModule = Object.class.getModule();
-
-        assertFalse(thisModule.isNamed());
-        assertTrue(thisModule.getName() == null);
-        assertTrue(thisModule.getDescriptor() == null);
-        assertTrue(thisModule.getLayer() == null);
-        assertTrue(thisModule.toString().startsWith("unnamed module "));
-
-        ClassLoader thisLoader = BasicModuleTest.class.getClassLoader();
-        assertTrue(thisLoader == thisModule.getClassLoader());
-        assertTrue(thisLoader.getUnnamedModule() == thisModule);
-
-        // unnamed modules read all other modules
-        ClassLoader cl;
-        cl = ClassLoader.getPlatformClassLoader();
-        assertTrue(thisModule.canRead(cl.getUnnamedModule()));
-        cl = ClassLoader.getSystemClassLoader();
-        assertTrue(thisModule.canRead(cl.getUnnamedModule()));
-        testReadsAllBootModules(thisModule);
-
-        // unnamed modules export all packages
-        assertTrue(thisModule.isExported(""));
-        assertTrue(thisModule.isExported("", thisModule));
-        assertTrue(thisModule.isExported("", baseModule));
-        assertTrue(thisModule.isExported("p"));
-        assertTrue(thisModule.isExported("p", thisModule));
-        assertTrue(thisModule.isExported("p", baseModule));
-
-        // this test is in the unnamed package
-        assertTrue(contains(thisModule.getPackages(), ""));
-    }
-
-
-    @Test
-    public void testUnnamedModules() {
-        Module thisModule = BasicModuleTest.class.getModule();
-        Module baseModule = Object.class.getModule();
-
-        ClassLoader loader1 = ClassLoader.getSystemClassLoader();
-        ClassLoader loader2 = loader1.getParent();
-
-        Module m1 = loader1.getUnnamedModule();
-        Module m2 = loader2.getUnnamedModule();
-
-        assertTrue(m1 != m2);
-
-        assertFalse(m1.isNamed());
-        assertFalse(m2.isNamed());
-
-        assertTrue(m1.getLayer() == null);
-        assertTrue(m2.getLayer() == null);
-
-        assertTrue(m1.toString().startsWith("unnamed module "));
-        assertTrue(m2.toString().startsWith("unnamed module "));
-
-        // unnamed module reads all modules
-        assertTrue(m1.canRead(m2));
-        assertTrue(m2.canRead(m1));
-
-        testReadsAllBootModules(m1);
-        testReadsAllBootModules(m2);
-
-        assertTrue(m1.isExported(""));
-        assertTrue(m1.isExported("", thisModule));
-        assertTrue(m1.isExported("", baseModule));
-        assertTrue(m1.isExported("p"));
-        assertTrue(m1.isExported("p", thisModule));
-        assertTrue(m1.isExported("p", baseModule));
-    }
-
-
-
-    @Test
-    public void testBaseModule() {
-        Module base = Object.class.getModule();
-        Module thisModule = BasicModuleTest.class.getModule();
-
-        // getName
-        assertTrue(base.getName().equals("java.base"));
-
-        // getDescriptor
-        assertTrue(base.getDescriptor().exports().stream()
-                .anyMatch(doesExport("java.lang")));
-
-        // getClassLoader
-        assertTrue(base.getClassLoader() == null);
-
-        // getLayer
-        assertTrue(base.getLayer() == Layer.boot());
-
-        // toString
-        assertEquals(base.toString(), "module java.base");
-
-        // getPackages
-        assertTrue(contains(base.getPackages(), "java.lang"));
-
-        // canRead
-        assertTrue(base.canRead(base));
-        assertFalse(base.canRead(thisModule));
-
-        // addReads
-        try {
-            base.addReads(thisModule);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        assertFalse(base.canRead(thisModule));
-
-        // isExported
-        assertTrue(base.isExported("java.lang"));
-        assertTrue(base.isExported("java.lang", thisModule));
-        assertTrue(base.isExported("java.lang", base));
-        assertFalse(base.isExported("jdk.internal.misc"));
-        assertFalse(base.isExported("jdk.internal.misc", thisModule));
-        assertTrue(base.isExported("jdk.internal.misc", base));
-        assertFalse(base.isExported("java.wombat"));
-        assertFalse(base.isExported("java.wombat", thisModule));
-        assertFalse(base.isExported("java.wombat", base));
-
-        // addExports
-        try {
-            base.addExports("java.lang", thisModule);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        try {
-            base.addExports("jdk.internal.misc", thisModule);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        assertFalse(base.isExported("jdk.internal.misc"));
-        assertFalse(base.isExported("jdk.internal.misc", thisModule));
-
-        // isOpen
-        assertFalse(base.isOpen("java.lang"));
-        assertFalse(base.isOpen("java.lang", thisModule));
-        assertTrue(base.isOpen("java.lang", base));
-        assertFalse(base.isOpen("jdk.internal.misc"));
-        assertFalse(base.isOpen("jdk.internal.misc", thisModule));
-        assertTrue(base.isOpen("jdk.internal.misc", base));
-        assertFalse(base.isOpen("java.wombat"));
-        assertFalse(base.isOpen("java.wombat", thisModule));
-        assertFalse(base.isOpen("java.wombat", base));
-
-        // addOpens
-        try {
-            base.addOpens("jdk.internal.misc", thisModule);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        assertFalse(base.isOpen("jdk.internal.misc"));
-        assertFalse(base.isOpen("jdk.internal.misc", thisModule));
-
-        // canUse
-        assertTrue(base.canUse(FileSystemProvider.class));
-        assertFalse(base.canUse(Thread.class));
-
-        // addUses
-        try {
-            base.addUses(FileSystemProvider.class);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        try {
-            base.addUses(Thread.class);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        assertFalse(base.canUse(Thread.class));
-    }
-
-
-    @Test
-    public void testDesktopModule() {
-        Module desktop = java.awt.Component.class.getModule();
-        Module base = Object.class.getModule();
-        Module xml = javax.xml.XMLConstants.class.getModule();
-        Module thisModule = BasicModuleTest.class.getModule();
-
-        // name
-        assertTrue(desktop.getName().equals("java.desktop"));
-
-        // descriptor
-        assertTrue(desktop.getDescriptor().exports().stream()
-                   .anyMatch(doesExport("java.awt")));
-
-        // getClassLoader
-        assertTrue(desktop.getClassLoader() == null);
-
-        // getLayer
-        assertTrue(desktop.getLayer() == Layer.boot());
-
-        // toString
-        assertEquals(desktop.toString(), "module java.desktop");
-
-        // getPackages
-        assertTrue(contains(desktop.getPackages(), "java.awt"));
-        assertTrue(contains(desktop.getPackages(), "sun.awt"));
-
-        // canRead
-        assertTrue(desktop.canRead(base));
-        assertTrue(desktop.canRead(xml));
-
-        // addReads
-        try {
-            desktop.addReads(thisModule);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        assertFalse(desktop.canRead(thisModule));
-
-        // isExported
-        assertTrue(desktop.isExported("java.awt"));
-        assertTrue(desktop.isExported("java.awt", thisModule));
-        assertFalse(desktop.isExported("sun.awt"));
-        assertFalse(desktop.isExported("sun.awt", thisModule));
-        assertTrue(desktop.isExported("sun.awt", desktop));
-        assertFalse(desktop.isExported("java.wombat"));
-        assertFalse(desktop.isExported("java.wombat", thisModule));
-        assertFalse(desktop.isExported("java.wombat", base));
-
-        // addExports
-        try {
-            desktop.addExports("java.awt", thisModule);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        try {
-            desktop.addExports("sun.awt", thisModule);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        assertFalse(desktop.isExported("sun.awt"));
-        assertFalse(desktop.isExported("sun.awt", thisModule));
-
-        // isOpen
-        assertFalse(desktop.isOpen("java.awt"));
-        assertFalse(desktop.isOpen("java.awt", thisModule));
-        assertTrue(desktop.isOpen("java.awt", desktop));
-        assertFalse(desktop.isOpen("sun.awt"));
-        assertFalse(desktop.isOpen("sun.awt", thisModule));
-        assertTrue(desktop.isOpen("sun.awt", desktop));
-        assertFalse(desktop.isOpen("java.wombat"));
-        assertFalse(desktop.isOpen("java.wombat", thisModule));
-        assertFalse(desktop.isOpen("java.wombat", desktop));
-
-        // addOpens
-        try {
-            base.addOpens("sun.awt", thisModule);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        assertFalse(desktop.isOpen("sun.awt"));
-        assertFalse(desktop.isOpen("sun.awt", thisModule));
-
-        // canUse
-        assertTrue(base.canUse(FileSystemProvider.class));
-        assertFalse(base.canUse(Thread.class));
-
-        // addUses
-        try {
-            desktop.addUses(PrintServiceLookup.class);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        try {
-            desktop.addUses(Thread.class);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-        assertFalse(desktop.canUse(Thread.class));
-    }
-
-}
--- a/jdk/test/java/lang/reflect/Module/WithSecurityManager.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @modules jdk.compiler
- * @summary Test java.lang.reflect.Module methods that specify permission checks
- * @run main/othervm -Djava.security.policy=${test.src}/allow.policy WithSecurityManager allow
- * @run main/othervm WithSecurityManager deny
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.module.Configuration;
-import java.lang.module.ModuleFinder;
-import java.lang.module.ModuleReference;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
-import java.util.Collections;
-import java.util.Optional;
-import java.util.Set;
-
-/**
- * Test java.lang.reflect.Module methods that specify permission checks.
- */
-
-public class WithSecurityManager {
-
-    // a module that will be loaded into a child layer
-    static final String ANOTHER_MODULE          = "jdk.compiler";
-    static final String ANOTHER_MODULE_RESOURCE = "com/sun/tools/javac/Main.class";
-
-    public static void main(String[] args) throws IOException {
-        boolean allow = args[0].equals("allow");
-
-        // base module, in the boot layer
-        Module base = Object.class.getModule();
-
-        // another module, in a child layer
-        Module other = loadModuleInChildLayer(ANOTHER_MODULE);
-        assertTrue(other.getLayer() != Layer.boot());
-
-        System.setSecurityManager(new SecurityManager());
-
-        test(base, "java/lang/Object.class", allow);
-        test(other, ANOTHER_MODULE_RESOURCE, allow);
-    }
-
-    /**
-     * Test the permission checks by invoking methods on the given module.
-     *
-     * If {@code allow} is {@code true} then the permission checks should succeed.
-     */
-    static void test(Module m, String name, boolean allow) throws IOException {
-
-        // test Module::getClassLoader
-        System.out.format("Test getClassLoader on %s ...%n", m);
-        try {
-            ClassLoader cl = m.getClassLoader();
-            System.out.println(cl);
-            if (!allow)
-                assertTrue("getClassLoader should have failed", false);
-        } catch (SecurityException e) {
-            System.out.println(e + " thrown");
-            if (allow)
-                throw e;
-        }
-
-        // test Module::getResourceAsStream
-        System.out.format("Test getResourceAsStream(\"%s\") on %s ...%n", name, m);
-        try (InputStream in = m.getResourceAsStream(name)) {
-            System.out.println(in);
-            if (allow && (in == null))
-                assertTrue(name + " not found", false);
-            if (!allow && (in != null))
-                assertTrue(name + " should not be found", false);
-        }
-
-    }
-
-    /**
-     * Create a module layer that contains the given system module.
-     */
-    static Module loadModuleInChildLayer(String mn) {
-        Optional<ModuleReference> omref = ModuleFinder.ofSystem().find(mn);
-        assertTrue("module " + mn + " not a system module", omref.isPresent());
-
-        // create a ModuleFinder that only finds this module
-        ModuleReference mref = omref.get();
-        ModuleFinder finder = new ModuleFinder() {
-            @Override
-            public Optional<ModuleReference> find(String name) {
-                if (name.equals(mn))
-                    return Optional.of(mref);
-                else
-                    return Optional.empty();
-            }
-
-            @Override
-            public Set<ModuleReference> findAll() {
-                return Collections.singleton(mref);
-            }
-        };
-
-        // create a child configuration and layer with this module
-        Layer bootLayer = Layer.boot();
-        Configuration cf = bootLayer
-            .configuration()
-            .resolve(finder, ModuleFinder.of(), Set.of(ANOTHER_MODULE));
-        Layer layer = bootLayer.defineModulesWithOneLoader(cf, null);
-
-        Optional<Module> om = layer.findModule(mn);
-        assertTrue("module " + mn + " not in child layer", om.isPresent());
-        return om.get();
-    }
-
-    static void assertTrue(String msg, boolean e) {
-        if (!e)
-            throw new RuntimeException(msg);
-    }
-
-    static void assertTrue(boolean e) {
-        if (!e)
-            throw new RuntimeException();
-    }
-
-}
--- a/jdk/test/java/lang/reflect/Module/access/AccessTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.List;
-
-import static jdk.testlibrary.ProcessTools.executeTestJava;
-
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-
-/**
- * @test
- * @library /lib/testlibrary
- * @modules jdk.compiler
- * @build AccessTest CompilerUtils jdk.testlibrary.*
- * @run testng AccessTest
- * @summary Driver for test that checks access to access to types in
- *          exported and non-exported packages.
- */
-
-@Test
-public class AccessTest {
-
-    private static final String TEST_SRC = System.getProperty("test.src");
-
-    private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
-    private static final Path MODS_DIR = Paths.get("mods");
-
-
-    // the names of the modules in this test
-    private static List<String> modules = Arrays.asList("test", "target");
-
-
-    /**
-     * Compiles all modules used by the test
-     */
-    @BeforeTest
-    public void compileAll() throws Exception {
-        for (String mn : modules) {
-            Path src = SRC_DIR.resolve(mn);
-            Path mods = MODS_DIR.resolve(mn);
-            assertTrue(CompilerUtils.compile(src, mods));
-        }
-    }
-
-    /**
-     * Run the test
-     */
-    public void runTest() throws Exception {
-        int exitValue
-            = executeTestJava("--module-path", MODS_DIR.toString(),
-                              "--add-modules", "target",
-                              "-Dsun.reflect.enableStrictMode=true",
-                              "-m", "test/test.Main")
-                .outputTo(System.out)
-                .errorTo(System.out)
-                .getExitValue();
-
-        assertTrue(exitValue == 0);
-    }
-
-}
--- a/jdk/test/java/lang/reflect/Module/access/src/target/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-module target {
-    exports p1;
-    exports p2;
-}
--- a/jdk/test/java/lang/reflect/Module/access/src/target/p1/Helper.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p1;
-
-import java.lang.reflect.Module;
-
-/**
- * Helper class in target module to allow test invoke addExports[Private]
- */
-
-public class Helper {
-    Helper() { }
-
-    public static void addExports(String pn, Module who) {
-        Helper.class.getModule().addExports(pn, who);
-    }
-
-    public static void addOpens(String pn, Module who) {
-        Helper.class.getModule().addOpens(pn, who);
-    }
-}
--- a/jdk/test/java/lang/reflect/Module/access/src/target/p1/Public.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p1;
-
-public class Public {
-
-    // public constructor
-    public Public() { }
-
-    // non-public constructor
-    private Public(Void ignore) { }
-
-    // public field
-    public static Object f1;
-
-    // non-public field
-    private static Object f2;
-
-    // public method
-    public static void foo() { }
-
-    // non-public method
-    private static void bar() { }
-}
--- a/jdk/test/java/lang/reflect/Module/access/src/target/p2/NonPublic.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p2;
-
-class NonPublic {
-
-    // public constructor
-    public NonPublic() { }
-
-    // non-public constructor
-    private NonPublic(Void ignore) { }
-
-    // public field
-    public static Object f1;
-
-    // non-public field
-    private static Object f2;
-
-    // public method
-    public static void foo() { }
-
-    // non-public method
-    private static void bar() { }
-}
--- a/jdk/test/java/lang/reflect/Module/access/src/target/q1/Public.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package q1;
-
-public class Public {
-
-    // public constructor
-    public Public() { }
-
-    // non-public constructor
-    private Public(Void ignore) { }
-
-    // public field
-    public static Object f1;
-
-    // non-public field
-    private static Object f2;
-
-    // public method
-    public static void foo() { }
-
-    // non-public method
-    private static void bar() { }
-}
--- a/jdk/test/java/lang/reflect/Module/access/src/target/q2/NonPublic.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package q2;
-
-class NonPublic {
-
-    // public constructor
-    public NonPublic() { }
-
-    // non-public constructor
-    private NonPublic(Void ignore) { }
-
-    // public field
-    public static Object f1;
-
-    // non-public field
-    private static Object f2;
-
-    // public method
-    public static void foo() { }
-
-    // non-public method
-    private static void bar() { }
-}
--- a/jdk/test/java/lang/reflect/Module/access/src/test/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-module test { }
--- a/jdk/test/java/lang/reflect/Module/access/src/test/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,379 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package test;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Method;
-import java.lang.reflect.Module;
-
-/**
- * Test access to public/non-public members of public/non-public classes in
- * exported and non-exported packages.
- */
-
-public class Main {
-
-    public static void main(String[] args) throws Exception {
-        testPublicClassInExportedPackage();
-        testNonPublicClassInExportedPackage();
-        testPublicClassInNonExportedPackage();
-        testNonPublicClassInNonExportedPackage();
-    }
-
-    static void testPublicClassInExportedPackage() throws Exception {
-        Module thisModule = Main.class.getModule();
-        Module targetModule = getTargetModule();
-
-        assertTrue(targetModule.isExported("p1"));
-        assertTrue(targetModule.isExported("p1", thisModule));
-        assertTrue(targetModule.isExported("p1", targetModule));
-
-        assertFalse(targetModule.isOpen("p1"));
-        assertFalse(targetModule.isOpen("p1", thisModule));
-        assertTrue(targetModule.isOpen("p1", targetModule));
-
-        Class<?> clazz = Class.forName("p1.Public");
-        Constructor<?> ctor1 = clazz.getConstructor();   // public
-        Constructor<?> ctor2 = clazz.getDeclaredConstructor(Void.class); // non-public
-
-        Field f1 = clazz.getField("f1");    // public
-        Field f2 = clazz.getDeclaredField("f2");    // non-public
-
-        Method m1 = clazz.getMethod("foo");  // public
-        Method m2 = clazz.getDeclaredMethod("bar");  // non-public
-
-        tryAccessConstructor(ctor1, true);
-        tryAccessConstructor(ctor2, false);
-        tryAccessMethod(m1, true);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, true);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, true);
-        trySetAccessible(ctor2, false);
-        trySetAccessible(m1, true);
-        trySetAccessible(m2, false);
-        trySetAccessible(f1, true);
-        trySetAccessible(f2, false);
-
-        targetAddOpens("p1", thisModule);
-
-        tryAccessConstructor(ctor1, true);
-        tryAccessConstructor(ctor2, false);
-        tryAccessMethod(m1, true);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, true);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, true);
-        trySetAccessible(ctor2, true);
-        trySetAccessible(m1, true);
-        trySetAccessible(m2, true);
-        trySetAccessible(f1, true);
-        trySetAccessible(f2, true);
-    }
-
-    static void testNonPublicClassInExportedPackage() throws Exception {
-        Module thisModule = Main.class.getModule();
-        Module targetModule = getTargetModule();
-
-        assertTrue(targetModule.isExported("p2"));
-        assertTrue(targetModule.isExported("p2", thisModule));
-        assertTrue(targetModule.isExported("p2", targetModule));
-
-        assertFalse(targetModule.isOpen("p2"));
-        assertFalse(targetModule.isOpen("p2", thisModule));
-        assertTrue(targetModule.isOpen("p1", targetModule));
-
-        Class<?> clazz = Class.forName("p2.NonPublic");
-        Constructor<?> ctor1 = clazz.getConstructor();
-        Constructor<?> ctor2 = clazz.getDeclaredConstructor(Void.class);
-
-        Field f1 = clazz.getField("f1");    // public
-        Field f2 = clazz.getDeclaredField("f2");    // non-public
-
-        Method m1 = clazz.getMethod("foo");  // public
-        Method m2 = clazz.getDeclaredMethod("bar");  // non-public
-
-        tryAccessConstructor(ctor1, false);
-        tryAccessConstructor(ctor2, false);
-        tryAccessMethod(m1, false);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, false);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, false);
-        trySetAccessible(ctor2, false);
-        trySetAccessible(m1, false);
-        trySetAccessible(m2, false);
-        trySetAccessible(f1, false);
-        trySetAccessible(f2, false);
-
-        targetAddExports("p2", thisModule);
-
-        tryAccessConstructor(ctor1, false);
-        tryAccessConstructor(ctor2, false);
-        tryAccessMethod(m1, false);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, false);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, false);
-        trySetAccessible(ctor2, false);
-        trySetAccessible(m1, false);
-        trySetAccessible(m2, false);
-        trySetAccessible(f1, false);
-        trySetAccessible(f2, false);
-
-        targetAddOpens("p2", thisModule);
-
-        tryAccessConstructor(ctor1, false);
-        tryAccessConstructor(ctor2, false);
-        tryAccessMethod(m1, false);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, false);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, true);
-        trySetAccessible(ctor2, true);
-        trySetAccessible(m1, true);
-        trySetAccessible(m2, true);
-        trySetAccessible(f1, true);
-        trySetAccessible(f2, true);
-    }
-
-    static void testPublicClassInNonExportedPackage() throws Exception {
-        Module thisModule = Main.class.getModule();
-        Module targetModule = getTargetModule();
-
-        assertFalse(targetModule.isExported("q1"));
-        assertFalse(targetModule.isExported("q1", thisModule));
-        assertTrue(targetModule.isExported("q1", targetModule));
-
-        assertFalse(targetModule.isOpen("q1"));
-        assertFalse(targetModule.isOpen("q1", thisModule));
-        assertTrue(targetModule.isOpen("q1", targetModule));
-
-        Class<?> clazz = Class.forName("q1.Public");
-        Constructor<?> ctor1 = clazz.getConstructor();  // public
-        Constructor<?> ctor2 = clazz.getDeclaredConstructor(Void.class);  // non-public
-
-        Field f1 = clazz.getField("f1");    // public
-        Field f2 = clazz.getDeclaredField("f2");    // non-public
-
-        Method m1 = clazz.getMethod("foo");  // public
-        Method m2 = clazz.getDeclaredMethod("bar");  // non-public
-
-        tryAccessConstructor(ctor1, false);
-        tryAccessConstructor(ctor2, false);
-        tryAccessMethod(m1, false);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, false);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, false);
-        trySetAccessible(ctor2, false);
-        trySetAccessible(m1, false);
-        trySetAccessible(m2, false);
-        trySetAccessible(f1, false);
-        trySetAccessible(f2, false);
-
-        targetAddExports("q1", thisModule);
-
-        tryAccessConstructor(ctor1, true);
-        tryAccessConstructor(ctor2, false);
-        tryAccessMethod(m1, true);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, true);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, true);
-        trySetAccessible(ctor2, false);
-        trySetAccessible(m1, true);
-        trySetAccessible(m2, false);
-        trySetAccessible(f1, true);
-        trySetAccessible(f2, false);
-
-        targetAddOpens("q1", thisModule);
-
-        tryAccessConstructor(ctor1, true);
-        tryAccessConstructor(ctor1, false);
-        tryAccessMethod(m1, true);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, true);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, true);
-        trySetAccessible(ctor2, true);
-        trySetAccessible(m1, true);
-        trySetAccessible(m2, true);
-        trySetAccessible(f1, true);
-        trySetAccessible(f2, true);
-    }
-
-    static void testNonPublicClassInNonExportedPackage() throws Exception {
-        Module thisModule = Main.class.getModule();
-        Module targetModule = getTargetModule();
-
-        assertFalse(targetModule.isExported("q2"));
-        assertFalse(targetModule.isExported("q2", thisModule));
-        assertTrue(targetModule.isExported("q2", targetModule));
-
-        assertFalse(targetModule.isOpen("q2"));
-        assertFalse(targetModule.isOpen("q2", thisModule));
-        assertTrue(targetModule.isOpen("q2", targetModule));
-
-        Class<?> clazz = Class.forName("q2.NonPublic");
-        Constructor<?> ctor1 = clazz.getConstructor();  // public
-        Constructor<?> ctor2 = clazz.getDeclaredConstructor(Void.class);  // non-public
-
-        Field f1 = clazz.getField("f1");    // public
-        Field f2 = clazz.getDeclaredField("f2");    // non-public
-
-        Method m1 = clazz.getMethod("foo");  // public
-        Method m2 = clazz.getDeclaredMethod("bar");  // non-public
-
-        tryAccessConstructor(ctor1, false);
-        tryAccessConstructor(ctor2, false);
-        tryAccessMethod(m1, false);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, false);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, false);
-        trySetAccessible(ctor2, false);
-        trySetAccessible(m1, false);
-        trySetAccessible(m2, false);
-        trySetAccessible(f1, false);
-        trySetAccessible(f2, false);
-
-        targetAddExports("q2", thisModule);
-
-        tryAccessConstructor(ctor1, false);
-        tryAccessConstructor(ctor2, false);
-        tryAccessMethod(m1, false);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, false);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, false);
-        trySetAccessible(ctor2, false);
-        trySetAccessible(m1, false);
-        trySetAccessible(m2, false);
-        trySetAccessible(f1, false);
-        trySetAccessible(f2, false);
-
-        targetAddOpens("q2", thisModule);
-
-        tryAccessConstructor(ctor1, false);
-        tryAccessConstructor(ctor2, false);
-        tryAccessMethod(m1, false);
-        tryAccessMethod(m2, false);
-        tryAccessObjectField(f1, false);
-        tryAccessObjectField(f2, false);
-
-        trySetAccessible(ctor1, true);
-        trySetAccessible(m1, true);
-        trySetAccessible(m2, true);
-        trySetAccessible(f1, true);
-        trySetAccessible(f2, true);
-    }
-
-
-    static Module getTargetModule() {
-        return Layer.boot().findModule("target").get();
-    }
-
-    static void tryAccessConstructor(Constructor<?> ctor, boolean shouldSucceed) {
-        try {
-            ctor.newInstance();
-            assertTrue(shouldSucceed);
-        } catch (Exception e) {
-            assertFalse(shouldSucceed);
-        }
-    }
-
-    static void tryAccessMethod(Method method, boolean shouldSucceed) {
-        try {
-            method.invoke(null);
-            assertTrue(shouldSucceed);
-        } catch (Exception e) {
-            e.printStackTrace();
-            assertFalse(shouldSucceed);
-        }
-    }
-
-    static void tryAccessObjectField(Field f, boolean shouldSucceed) {
-        try {
-            f.get(null);
-            assertTrue(shouldSucceed);
-        } catch (Exception e) {
-            assertFalse(shouldSucceed);
-        }
-        try {
-            f.set(null, new Object());
-            assertTrue(shouldSucceed);
-        } catch (Exception e) {
-            assertFalse(shouldSucceed);
-        }
-    }
-
-    static void trySetAccessible(AccessibleObject ao, boolean shouldSucceed) {
-        try {
-            ao.setAccessible(true);
-            assertTrue(shouldSucceed);
-        } catch (Exception e) {
-            assertFalse(shouldSucceed);
-        }
-    }
-
-    /**
-     * Update target module to export a package to the given module.
-     */
-    static void targetAddExports(String pn, Module who) throws Exception {
-        Class<?> helper = Class.forName("p1.Helper");
-        Method m = helper.getMethod("addExports", String.class, Module.class);
-        m.invoke(null, pn, who);
-    }
-
-    /**
-     * Update target module to open a package to the given module.
-     */
-    static void targetAddOpens(String pn, Module who) throws Exception {
-        Class<?> helper = Class.forName("p1.Helper");
-        Method m = helper.getMethod("addOpens", String.class, Module.class);
-        m.invoke(null, pn, who);
-    }
-
-    static void assertTrue(boolean expr) {
-        if (!expr) throw new RuntimeException();
-    }
-
-    static void assertFalse(boolean expr) {
-        assertTrue(!expr);
-    }
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/Driver.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * 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
- * @build test/* m1/* m2/* m3/* m4/*
- * @run testng/othervm test/test.Main
- * @summary Basic test case for Module::addXXX methods
- */
--- a/jdk/test/java/lang/reflect/Module/addXXX/m1/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-module m1 {
-    exports p1;
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/m1/p1/C.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package p1;
-
-public class C {
-    public C() { }
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/m2/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-module m2 {
-    exports p2;
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/m2/p2/C.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package p2;
-
-import java.lang.reflect.Module;
-
-public class C {
-
-    public static void export(String pn, Module m) {
-        C.class.getModule().addExports(pn, m);
-    }
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/m2/p2/internal/C.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package p2.internal;
-
-public class C {
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/m3/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-module m3 {
-    exports p3 to test;
-    opens p3 to test;
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/m3/p3/C.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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 p3;
-
-public class C {
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/m4/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-module m4 {
-    exports p4;
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/m4/p4/C.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * 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 p4;
-
-import java.lang.reflect.Constructor;
-
-public class C {
-    public static Object tryNewInstance(Class<?> clazz) throws Exception {
-        Constructor<?> ctor = clazz.getDeclaredConstructor();
-        return ctor.newInstance();
-    }
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/test/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-module test {
-    exports test to testng;
-
-    requires m2;
-    requires m3;
-    requires m4;
-    requires testng;
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/test/test/C.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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 test;
-
-public class C { }
--- a/jdk/test/java/lang/reflect/Module/addXXX/test/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
- * 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 test;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Module;
-import java.util.ServiceConfigurationError;
-import java.util.ServiceLoader;
-
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-
-/**
- * Basic test case for Module::addXXXX methods
- */
-
-@Test
-public class Main {
-
-    /**
-     * Test Module::addReads
-     *
-     *     module test { }
-     *
-     *     module m1 {
-     *         exports p1;
-     *     }
-     */
-    public void testAddReads() throws Throwable {
-        Module thisModule = Main.class.getModule();
-        Class<?> clazz = Class.forName("p1.C");
-        Module m1 = clazz.getModule();
-
-        // test does not read m1
-        assertFalse(thisModule.canRead(m1));
-        MethodHandles.Lookup lookup = MethodHandles.lookup();
-        MethodType mt = MethodType.methodType(void.class);
-        try {
-            lookup.findConstructor(clazz, mt);
-            assertTrue(false);
-        } catch (IllegalAccessException expected) { }
-
-        // update test to read m1
-        Module result = thisModule.addReads(m1);
-        assertTrue(result== thisModule);
-        assertTrue(thisModule.canRead(m1));
-        MethodHandle mh = lookup.findConstructor(clazz, mt);
-        Object obj = mh.invoke();
-
-        // attempt to update m1 to read test
-        try {
-            m1.addReads(thisModule);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-    }
-
-
-    /**
-     * Test Module::addExports
-     *
-     *     module test {
-     *         requires m2;
-     *     }
-     *     module m2 {
-     *         exports p2;
-     *         contains package p2.internal;
-     *     }
-     */
-    public void testAddExports() throws Exception {
-        Module thisModule = Main.class.getModule();
-        Module m2 = p2.C.class.getModule();
-        Class<?> targetClass = Class.forName("p2.internal.C");
-        String p2Internal = targetClass.getPackageName();
-        assertTrue(targetClass.getModule() == m2);
-
-        // m2 does not export p2.internal to test
-        assertFalse(m2.isExported(p2Internal, thisModule));
-        Constructor<?> ctor = targetClass.getDeclaredConstructor();
-        try {
-            ctor.newInstance();
-            assertTrue(false);
-        } catch (IllegalAccessException expected) { }
-
-        // update m2 to export p2.internal to test
-        p2.C.export(p2Internal, thisModule);
-        assertTrue(m2.isExported(p2Internal, thisModule));
-        ctor.newInstance(); // should succeed
-
-        // attempt to update m2 to export a package to test
-        try {
-            m2.addExports("p2.other", thisModule);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-    }
-
-    /**
-     * Test Module::addOpens
-     *
-     *     module test {
-     *         requires m3;
-     *         requires m4;
-     *     }
-     *
-     *     module m3 {
-     *         exports p3 to test;
-     *         opens p3 to test;
-     *     }
-     *
-     *     module m4 {
-     *         exports p4;
-     *     }
-     */
-    public void testAddOpens() throws Exception {
-        Module thisModule = Main.class.getModule();
-        Module m3 = p3.C.class.getModule();
-        Module m4 = p4.C.class.getModule();
-
-        // test does not open package test to m4
-        assertFalse(thisModule.isOpen("test", m4));
-        try {
-            p4.C.tryNewInstance(test.C.class);
-            assertTrue(false);
-        } catch (IllegalAccessException expected) { }
-
-        // open test to m4
-        thisModule.addOpens("test", m4);
-        p4.C.tryNewInstance(test.C.class);  // should succeed
-
-
-        // m3 does not open p3 to m4
-        assertFalse(m3.isOpen("p3", m4));
-        try {
-            p4.C.tryNewInstance(p3.C.class);
-            assertTrue(false);
-        } catch (IllegalAccessException expected) { }
-
-
-        // m3 opens p3 to test => test allowed to open m3/p3 to m4
-        assertTrue(m3.isOpen("p3", thisModule));
-        m3.addOpens("p3", m4);
-        assertTrue(m3.isOpen("p3", m4));
-        p4.C.tryNewInstance(p3.C.class);   // should succeed
-
-
-        // attempt to update m4 to open package to m3
-        try {
-            m4.addOpens("p4", m3);
-            assertTrue(false);
-        } catch (IllegalCallerException expected) { }
-    }
-
-
-    /**
-     * Test Module::addUses
-     */
-    public void testAddUses() {
-        Module thisModule = Main.class.getModule();
-
-        assertFalse(thisModule.canUse(Service.class));
-        try {
-            ServiceLoader.load(Service.class);
-            assertTrue(false);
-        } catch (ServiceConfigurationError expected) { }
-
-        Module result = thisModule.addUses(Service.class);
-        assertTrue(result== thisModule);
-
-        assertTrue(thisModule.canUse(Service.class));
-        ServiceLoader.load(Service.class); // no exception
-    }
-
-}
--- a/jdk/test/java/lang/reflect/Module/addXXX/test/test/Service.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * 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 test;
-
-/**
- * Simple service type
- */
-public interface Service { }
--- a/jdk/test/java/lang/reflect/Module/allow.policy	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-grant {
-    permission java.lang.RuntimePermission "getClassLoader";
-    permission java.lang.RuntimePermission "accessSystemModules";
-    permission java.io.FilePermission "${java.home}/modules/-", "read";    // exploded build
-};
--- a/jdk/test/java/lang/reflect/Module/annotation/Basic.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @library src
- * @build m/* Basic
- * @run testng/othervm Basic
- * @summary Basic test for annotations on modules
- */
-
-import java.lang.reflect.Module;
-import java.util.Arrays;
-
-import p.annotation.Foo;
-import p.annotation.Bar;
-import p.annotation.Baz;
-
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-
-public class Basic {
-
-    final Module module = Foo.class.getModule();
-
-    /**
-     * {@code @Foo} does not have RUNTIME retention policy.
-     */
-    @Test
-    public void testInvisibleAnnotation() {
-        assertFalse(module.isAnnotationPresent(Foo.class));
-        assertNull(module.getAnnotation(Foo.class));
-    }
-
-    /**
-     * {@code @Bar} has RUNTIME retention policy and value "bar"
-     */
-    @Test
-    public void testBarAnnotation() {
-        assertTrue(module.isAnnotationPresent(Bar.class));
-        Bar bar = module.getAnnotation(Bar.class);
-        assertNotNull(bar);
-        assertEquals(bar.value(), "bar");
-    }
-
-    /**
-     * {@code @Baz} has RUNTIME retention policy has a repeating value
-     */
-    @Test
-    public void testBazAnnotation() {
-        assertTrue(module.isAnnotationPresent(Baz.class));
-        Baz baz = module.getAnnotation(Baz.class);
-        assertNotNull(baz);
-        String[] expected = { "one", "two", "three" };
-        assertTrue(Arrays.equals(baz.value(), expected));
-    }
-}
--- a/jdk/test/java/lang/reflect/Module/annotation/src/m/module-info.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import p.annotation.*;
-
-@Foo
-@Bar("bar")
-@Baz({"one", "two", "three"})
-module m {
-    exports p.annotation;
-}
--- a/jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Bar.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.MODULE;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value={MODULE})
-public @interface Bar {
-   String value();
-}
--- a/jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Baz.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.MODULE;
-
-@Target(value={MODULE})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Baz {
-   String[] value();
-}
--- a/jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Foo.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p.annotation;
-
-import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.MODULE;
-
-@Target(value={MODULE})
-public @interface Foo {}
--- a/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Proxy;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -88,12 +87,12 @@
     @Test
     public void testNoReadAccess() throws Exception {
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Layer bootLayer = Layer.boot();
+        ModuleLayer bootLayer = ModuleLayer.boot();
         Configuration cf = bootLayer
                 .configuration()
                 .resolveAndBind(ModuleFinder.of(), finder, modules);
         ClassLoader parentLoader = this.getClass().getClassLoader();
-        Layer layer = bootLayer.defineModulesWithOneLoader(cf, parentLoader);
+        ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, parentLoader);
 
         ClassLoader loader = layer.findLoader("m1");
         Class<?>[] interfaces = new Class<?>[] {
--- a/jdk/test/java/lang/reflect/Proxy/ProxyForMethodHandle.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/reflect/Proxy/ProxyForMethodHandle.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Module;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
--- a/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,7 +24,6 @@
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
 import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Proxy;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -70,18 +69,18 @@
     }
 
     /**
-     * Test proxy implementing interfaces in a Layer defined in
+     * Test proxy implementing interfaces in a layer defined in
      * an unnamed module
      */
     @Test
     public void testProxyInUnnamed() throws Exception {
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Layer bootLayer = Layer.boot();
+        ModuleLayer bootLayer = ModuleLayer.boot();
         Configuration cf = bootLayer
                 .configuration()
                 .resolveAndBind(ModuleFinder.of(), finder, Arrays.asList(modules));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
+        ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
 
         ClassLoader loader = layer.findLoader("m1");
 
@@ -110,12 +109,12 @@
     @Test
     public void testProxyInDynamicModule() throws Exception {
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Layer bootLayer = Layer.boot();
+        ModuleLayer bootLayer = ModuleLayer.boot();
         Configuration cf = bootLayer
                 .configuration()
                 .resolveAndBind(ModuleFinder.of(), finder, Arrays.asList(modules));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
+        ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
 
         ClassLoader loader = layer.findLoader("m1");
 
@@ -140,12 +139,12 @@
     @Test
     public void testNoReadAccess() throws Exception {
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Layer bootLayer = Layer.boot();
+        ModuleLayer bootLayer = ModuleLayer.boot();
         Configuration cf = bootLayer
                 .configuration()
                 .resolveAndBind(ModuleFinder.of(), finder, Arrays.asList(modules));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
+        ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
 
         ClassLoader loader = layer.findLoader("m1");
 
--- a/jdk/test/java/lang/reflect/Proxy/ProxyModuleMapping.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/reflect/Proxy/ProxyModuleMapping.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Module;
 import java.lang.reflect.Proxy;
 
 /*
--- a/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,7 +25,6 @@
 
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.lang.reflect.Module;
 import static jdk.test.ProxyTest.*;
 
 public class Main {
--- a/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/ProxyTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/ProxyTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Module;
 import java.lang.reflect.Proxy;
 import java.util.Arrays;
 
--- a/jdk/test/java/lang/reflect/WeakPairMap/Driver.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @bug 8888888
- * @summary Functional test for WeakPairMap
- * @build java.base/java.lang.reflect.WeakPairMapTest
- * @run main Driver
- */
-public class Driver {
-    public static void main(String[] args) {
-        java.lang.reflect.WeakPairMapTest.main(args);
-    }
-}
--- a/jdk/test/java/lang/reflect/WeakPairMap/java.base/java/lang/reflect/WeakPairMapTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang.reflect;
-
-import java.lang.ref.Reference;
-import java.util.Objects;
-
-/**
- * Functional test for WeakPairMap
- *
- * @author Peter Levart
- */
-public class WeakPairMapTest {
-    public static void main(String[] args) {
-        WeakPairMap<Object, Object, String> pm = new WeakPairMap<>();
-        Object key1 = new Object();
-        Object key2 = new Object();
-
-        // check for emptiness
-        assertEquals(pm.containsKeyPair(key1, key2), false);
-        assertEquals(pm.get(key1, key2), null);
-
-        // check for NPE(s)
-        for (Object k1 : new Object[]{null, key1}) {
-            for (Object k2 : new Object[]{null, key2}) {
-                for (String v : new String[]{null, "abc"}) {
-
-                    if (k1 != null && k2 != null && v != null) {
-                        // skip non-null args
-                        continue;
-                    }
-
-                    try {
-                        pm.put(k1, k2, v);
-                        throw new AssertionError("Unexpected code path, k1=" +
-                                                 k1 + ", k2=" + k2 + ", v=" + v);
-                    } catch (NullPointerException e) {
-                        // expected
-                    }
-
-                    try {
-                        pm.putIfAbsent(k1, k2, v);
-                        throw new AssertionError("Unexpected code path, k1=" +
-                                                 k1 + ", k2=" + k2 + ", v=" + v);
-                    } catch (NullPointerException e) {
-                        // expected
-                    }
-
-                    if (k1 != null && k2 != null) {
-                        // skip non-null args
-                        continue;
-                    }
-
-                    try {
-                        pm.computeIfAbsent(k1, k2, (_k1, _k2) -> v);
-                        throw new AssertionError("Unexpected code path, k1=" +
-                                                 k1 + ", k2=" + k2 + ", v=" + v);
-                    } catch (NullPointerException e) {
-                        // expected
-                    }
-
-                    try {
-                        pm.containsKeyPair(k1, k2);
-                        throw new AssertionError("Unexpected code path, k1=" +
-                                                 k1 + ", k2=" + k2);
-                    } catch (NullPointerException e) {
-                        // expected
-                    }
-
-                    try {
-                        pm.get(k1, k2);
-                        throw new AssertionError("Unexpected code path, k1=" +
-                                                 k1 + ", k2=" + k2);
-                    } catch (NullPointerException e) {
-                        // expected
-                    }
-                }
-            }
-        }
-
-        // how much to wait when it is expected for entry to be retained
-        final long retentionTimeout = 500L;
-        // how much to wait when it is expected for entry to be removed
-        final long cleanupTimeout = 30_000L;
-
-        // check insertion
-        assertEquals(pm.putIfAbsent(key1, key2, "abc"), null);
-        assertEquals(pm.get(key1, key2), "abc");
-
-        // check retention while both keys are still reachable
-        assertEquals(gcAndWaitRemoved(pm, "abc", retentionTimeout), false);
-        assertEquals(pm.get(key1, key2), "abc");
-
-        // check cleanup when both keys are unreachable
-        key1 = null;
-        key2 = null;
-        assertEquals(gcAndWaitRemoved(pm, "abc", cleanupTimeout), true);
-
-        // new insertion
-        key1 = new Object();
-        key2 = new Object();
-        assertEquals(pm.putIfAbsent(key1, key2, "abc"), null);
-        assertEquals(pm.get(key1, key2), "abc");
-
-        // check retention while both keys are still reachable
-        assertEquals(gcAndWaitRemoved(pm, "abc", retentionTimeout), false);
-        assertEquals(pm.get(key1, key2), "abc");
-
-        // check cleanup when 1st key is unreachable
-        key1 = null;
-        assertEquals(gcAndWaitRemoved(pm, "abc", cleanupTimeout), true);
-        Reference.reachabilityFence(key2);
-
-        // new insertion
-        key1 = new Object();
-        key2 = new Object();
-        assertEquals(pm.putIfAbsent(key1, key2, "abc"), null);
-        assertEquals(pm.get(key1, key2), "abc");
-
-        // check retention while both keys are still reachable
-        assertEquals(gcAndWaitRemoved(pm, "abc", retentionTimeout), false);
-        assertEquals(pm.get(key1, key2), "abc");
-
-        // check cleanup when 2nd key is unreachable
-        key2 = null;
-        assertEquals(gcAndWaitRemoved(pm, "abc", cleanupTimeout), true);
-        Reference.reachabilityFence(key1);
-    }
-
-    /**
-     * Trigger GC and wait for at most {@code millis} ms for given value to
-     * be removed from given WeakPairMap.
-     *
-     * @return true if element has been removed or false if not
-     */
-    static <V> boolean gcAndWaitRemoved(WeakPairMap<?, ?, V> pm, V value,
-                                        long millis) {
-        System.gc();
-        for (int i = 0; i < (millis + 99) / 100 && pm.values().contains(value); i++) {
-            try {
-                Thread.sleep(100L);
-            } catch (InterruptedException e) {
-                throw new AssertionError("Interrupted");
-            }
-        }
-        return !pm.values().contains(value);
-    }
-
-    static void assertEquals(Object actual, Object expected) {
-        if (!Objects.equals(actual, expected)) {
-            throw new AssertionError("Expected: " + expected + ", actual: " + actual);
-        }
-    }
-}
--- a/jdk/test/java/nio/channels/Selector/OutOfBand.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/nio/channels/Selector/OutOfBand.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,9 @@
 
 /* @test
  * @bug 6213702
+ * @requires (os.family != "mac") | (os.version == "10.10.5")
+ *    | (os.simpleVersion != "10.8" & os.simpleVersion != "10.9"
+ *        & os.simpleVersion != "10.10")
  * @summary OOB data causes a SocketChannel, with OOBINLINE disabled, to be
  *    selected
  */
--- a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,10 @@
  */
 
 /* @test
- * @summary Test socketchannel vector IO
- * @library ..
+ * @summary Test socketchannel vector IO (use -Dseed=X to set PRNG seed)
+ * @library .. /lib/testlibrary/
+ * @build jdk.testlibrary.RandomFactory
+ * @run main VectorIO
  * @key randomness
  */
 
@@ -32,11 +34,11 @@
 import java.nio.*;
 import java.nio.channels.*;
 import java.util.*;
-
+import jdk.testlibrary.RandomFactory;
 
 public class VectorIO {
 
-    static Random generator = new Random();
+    private static Random generator = RandomFactory.getRandom();
 
     static int testSize;
 
@@ -100,8 +102,6 @@
     static class Server
         extends TestThread
     {
-        static Random generator = new Random();
-
         final int testSize;
         final ServerSocketChannel ssc;
 
--- a/jdk/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.Random;
 
 
@@ -46,6 +47,9 @@
     final DatagramChannel peer;
     final int port;
 
+    final AtomicBoolean isClosed = new AtomicBoolean();
+    final AtomicBoolean isInterrupted = new AtomicBoolean();
+
     public AdaptorCloseAndInterrupt() {
         listener = null;
         peer = null;
@@ -96,6 +100,7 @@
 
             try {
                 sc.socket().getInputStream().read(new byte[100]);
+                System.err.format("close() was invoked: %s%n", isClosed.get());
                 throw new RuntimeException("read should not have completed");
             } catch (ClosedChannelException expected) {}
 
@@ -119,7 +124,10 @@
                 sc.socket().getInputStream().read(new byte[100]);
                 throw new RuntimeException("read should not have completed");
             } catch (ClosedByInterruptException expected) {
-                Thread.currentThread().interrupted();
+                System.out.format("interrupt() was invoked: %s%n",
+                    isInterrupted.get());
+                System.out.format("scReadAsyncInterrupt was interrupted: %s%n",
+                    Thread.currentThread().interrupted());
             }
 
             if (!sc.socket().isClosed())
@@ -140,6 +148,7 @@
 
         try {
             dc.socket().receive(new DatagramPacket(new byte[100], 100));
+            System.err.format("close() was invoked: %s%n", isClosed.get());
             throw new RuntimeException("receive should not have completed");
         } catch (ClosedChannelException expected) {}
 
@@ -159,7 +168,16 @@
             dc.socket().receive(new DatagramPacket(new byte[100], 100));
             throw new RuntimeException("receive should not have completed");
         } catch (ClosedByInterruptException expected) {
-            Thread.currentThread().interrupted();
+            System.out.format("interrupt() was invoked: %s%n",
+                isInterrupted.get());
+            System.out.format("dcReceiveAsyncInterrupt was interrupted: %s%n",
+                Thread.currentThread().interrupted());
+        } catch (SocketTimeoutException unexpected) {
+            System.err.format("Receive thread interrupt invoked: %s%n",
+                isInterrupted.get());
+            System.err.format("Receive thread was interrupted: %s%n",
+                Thread.currentThread().isInterrupted());
+            throw unexpected;
         }
 
         if (!dc.socket().isClosed())
@@ -175,6 +193,7 @@
 
         try {
             ssc.socket().accept();
+            System.err.format("close() was invoked: %s%n", isClosed.get());
             throw new RuntimeException("accept should not have completed");
         } catch (ClosedChannelException expected) {}
 
@@ -193,7 +212,10 @@
             ssc.socket().accept();
             throw new RuntimeException("accept should not have completed");
         } catch (ClosedByInterruptException expected) {
-            Thread.currentThread().interrupted();
+            System.out.format("interrupt() was invoked: %s%n",
+                isInterrupted.get());
+            System.out.format("ssAcceptAsyncInterrupt was interrupted: %s%n",
+                Thread.currentThread().interrupted());
         }
 
         if (!ssc.socket().isClosed())
@@ -204,6 +226,7 @@
         AdaptorCloseAndInterrupt.pool.schedule(new Callable<Void>() {
             public Void call() throws Exception {
                 sc.close();
+                isClosed.set(true);
                 return null;
             }
         }, new Random().nextInt(1000), TimeUnit.MILLISECONDS);
@@ -214,6 +237,7 @@
         AdaptorCloseAndInterrupt.pool.schedule(new Callable<Void>() {
             public Void call() throws Exception {
                 current.interrupt();
+                isInterrupted.set(true);
                 return null;
             }
         }, new Random().nextInt(1000), TimeUnit.MILLISECONDS);
--- a/jdk/test/java/security/Provider/DefaultProviderList.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/security/Provider/DefaultProviderList.java	Mon Apr 10 08:31:37 2017 -0700
@@ -33,7 +33,6 @@
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.ServiceLoader;
-import java.lang.reflect.Module;
 
 public class DefaultProviderList {
 
--- a/jdk/test/java/util/ResourceBundle/modules/cache/src/test/jdk/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/ResourceBundle/modules/cache/src/test/jdk/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 package jdk.test;
 
-import java.lang.reflect.Module;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
@@ -56,4 +55,4 @@
             jdk.test.util.Bundles.getBundle();
         }
     }
-}
\ No newline at end of file
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8177980
+ * @library /lib/testlibrary
+ * @modules jdk.compiler
+ * @build CompilerUtils jdk.testlibrary.ProcessTools CaseInsensitiveNameClash
+ * @run testng CaseInsensitiveNameClash
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import jdk.testlibrary.ProcessTools;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+public class CaseInsensitiveNameClash {
+
+    private static final String TEST_SRC = System.getProperty("test.src");
+
+    private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
+    private static final Path MODS_DIR = Paths.get("mods");
+
+    private static final String MODULE = "resbundle";
+    private static final String MAIN_CLASS = MODULE + "/jdk.test.Main";
+
+    /**
+     * Compiles the module used by the test
+     */
+    @BeforeTest
+    public void compileAll() throws Exception {
+        Path msrc = SRC_DIR.resolve(MODULE);
+        assertTrue(CompilerUtils.compile(msrc, MODS_DIR,
+                                         "--module-source-path", SRC_DIR.toString()));
+        Path propsFile = Paths.get("jdk", "test", "main.properties");
+        Files.copy(msrc.resolve(propsFile), MODS_DIR.resolve(MODULE).resolve(propsFile));
+    }
+
+    @Test
+    public void test() throws Exception {
+        assertTrue(ProcessTools.executeTestJava("--module-path", MODS_DIR.toString(),
+                                                "-m", MAIN_CLASS)
+                               .outputTo(System.out)
+                               .errorTo(System.out)
+                               .getExitValue() == 0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/jdk/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test;
+
+import java.util.ResourceBundle;
+
+public class Main {
+    public static void main(String[] args) throws Exception {
+        ResourceBundle bundle = ResourceBundle.getBundle("jdk.test.main");
+        if (!bundle.getString("key").equals("value")) {
+            throw new RuntimeException("Expected: value but get " + bundle.getString("key"));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/jdk/test/main.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,1 @@
+key=value
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module resbundle {
+}
--- a/jdk/test/java/util/ResourceBundle/modules/security/src/test/jdk/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/ResourceBundle/modules/security/src/test/jdk/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,7 +24,6 @@
 package jdk.test;
 
 import p1.Bundle;
-import java.lang.reflect.Module;
 import java.util.ResourceBundle;
 
 public class Main {
--- a/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithNoModuleArg.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithNoModuleArg.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 package jdk.embargo;
 
-import java.lang.reflect.Module;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
--- a/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithUnnamedModuleArg.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithUnnamedModuleArg.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 package jdk.embargo;
 
-import java.lang.reflect.Module;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
--- a/jdk/test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 package jdk.pkg.test;
 
-import java.lang.reflect.Module;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
--- a/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithNoModuleArg.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithNoModuleArg.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 package jdk.test;
 
-import java.lang.reflect.Module;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
--- a/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithUnnamedModuleArg.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithUnnamedModuleArg.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 package jdk.test;
 
-import java.lang.reflect.Module;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
--- a/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -33,7 +33,6 @@
 
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -87,14 +86,14 @@
     private List<Provider> loadProviders(Path mp, String moduleName) throws Exception {
         ModuleFinder finder = ModuleFinder.of(mp);
 
-        Layer bootLayer = Layer.boot();
+        ModuleLayer bootLayer = ModuleLayer.boot();
 
         Configuration cf = bootLayer.configuration()
                 .resolveAndBind(finder, ModuleFinder.of(), Set.of(moduleName));
 
         ClassLoader scl = ClassLoader.getSystemClassLoader();
 
-        Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl);
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
 
         Class<?> service = layer.findLoader(moduleName).loadClass(TEST_SERVICE);
 
--- a/jdk/test/java/util/ServiceLoader/modules/Basic.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/ServiceLoader/modules/Basic.java	Mon Apr 10 08:31:37 2017 -0700
@@ -34,7 +34,6 @@
 
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -229,7 +228,7 @@
      */
     @Test
     public void testWithCustomLayer1() {
-        Layer layer = createCustomLayer("bananascript");
+        ModuleLayer layer = createCustomLayer("bananascript");
 
         ClassLoader loader = layer.findLoader("bananascript");
         List<ScriptEngineFactory> providers
@@ -258,7 +257,7 @@
      */
     @Test
     public void testWithCustomLayer2() {
-        Layer layer = createCustomLayer("bananascript");
+        ModuleLayer layer = createCustomLayer("bananascript");
 
         List<ScriptEngineFactory> factories
             = collectAll(ServiceLoader.load(layer, ScriptEngineFactory.class));
@@ -293,7 +292,7 @@
      */
     @Test
     public void testWithCustomLayer3() {
-        Layer bootLayer = Layer.boot();
+        ModuleLayer bootLayer = ModuleLayer.boot();
         Configuration cf0 = bootLayer.configuration();
 
         // boot layer should contain "bananascript"
@@ -313,12 +312,12 @@
 
         // layer1
         Configuration cf1 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of());
-        Layer layer1 = bootLayer.defineModulesWithOneLoader(cf1, scl);
+        ModuleLayer layer1 = bootLayer.defineModulesWithOneLoader(cf1, scl);
         assertTrue(layer1.modules().size() == 1);
 
         // layer2
         Configuration cf2 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of());
-        Layer layer2 = bootLayer.defineModulesWithOneLoader(cf2, scl);
+        ModuleLayer layer2 = bootLayer.defineModulesWithOneLoader(cf2, scl);
         assertTrue(layer2.modules().size() == 1);
 
         // layer3 with layer1 and layer2 as parents
@@ -326,7 +325,8 @@
                 List.of(cf1, cf2),
                 ModuleFinder.of(),
                 Set.of());
-        Layer layer3 = Layer.defineModulesWithOneLoader(cf3, List.of(layer1, layer2), scl).layer();
+        ModuleLayer layer3
+            = ModuleLayer.defineModulesWithOneLoader(cf3, List.of(layer1, layer2), scl).layer();
         assertTrue(layer3.modules().size() == 1);
 
 
@@ -390,12 +390,12 @@
     @Test(expectedExceptions = { NullPointerException.class })
     public void testLoadNull3() {
         class S { }
-        ServiceLoader.load((Layer) null, S.class);
+        ServiceLoader.load((ModuleLayer) null, S.class);
     }
 
     @Test(expectedExceptions = { NullPointerException.class })
     public void testLoadNull4() {
-        ServiceLoader.load(Layer.empty(), null);
+        ServiceLoader.load(ModuleLayer.empty(), null);
     }
 
     @Test(expectedExceptions = { NullPointerException.class })
@@ -404,19 +404,19 @@
     }
 
     /**
-     * Create a custom Layer by resolving the given module names. The modules
+     * Create a custom layer by resolving the given module names. The modules
      * are located in the {@code ${test.classes}/modules} directory.
      */
-    private Layer createCustomLayer(String... modules) {
+    private ModuleLayer createCustomLayer(String... modules) {
         Path dir = Paths.get(System.getProperty("test.classes", "."), "modules");
         ModuleFinder finder = ModuleFinder.of(dir);
         Set<String> roots = new HashSet<>();
         Collections.addAll(roots, modules);
-        Layer bootLayer = Layer.boot();
+        ModuleLayer bootLayer = ModuleLayer.boot();
         Configuration parent = bootLayer.configuration();
         Configuration cf = parent.resolve(finder, ModuleFinder.of(), roots);
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
+        ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
         assertTrue(layer.modules().size() == 1);
         return layer;
     }
--- a/jdk/test/java/util/logging/LocalizedLevelName.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/logging/LocalizedLevelName.java	Mon Apr 10 08:31:37 2017 -0700
@@ -21,7 +21,6 @@
  * questions.
  */
 
-import java.lang.reflect.Module;
 import java.util.*;
 import java.util.logging.*;
 
--- a/jdk/test/java/util/logging/modules/pkgs/p3/test/ResourceBundleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/logging/modules/pkgs/p3/test/ResourceBundleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 package p3.test;
 
-import java.lang.reflect.Module;
 import java.util.logging.Logger;
 import java.util.MissingResourceException;
 import java.util.PropertyResourceBundle;
--- a/jdk/test/java/util/spi/ResourceBundleControlProvider/test/jdk/test/ResourceBundleDelegate.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/java/util/spi/ResourceBundleControlProvider/test/jdk/test/ResourceBundleDelegate.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 package jdk.test;
 
-import java.lang.reflect.Module;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
--- a/jdk/test/javax/management/ImplementationVersion/ImplVersionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ImplementationVersion/ImplVersionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,7 @@
  * test codebase has the java permission to read the "java.runtime.version"
  * system property.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean ImplVersionTest ImplVersionCommand
  * @run build ImplVersionTest ImplVersionCommand ImplVersionReader
  * @run main ImplVersionTest
--- a/jdk/test/javax/management/Introspector/AnnotationSecurityTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/AnnotationSecurityTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,10 @@
  * @summary Test that having a security manager doesn't trigger a
  *          NotCompliantMBeanException
  * @author Daniel Fuchs, Yves Joan
- * @modules java.management
+ *
+ * @modules java.desktop
+ *          java.management
+ *
  * @run clean AnnotationSecurityTest Described UnDescribed DescribedMBean
  *            UnDescribedMBean SqeDescriptorKey DescribedMX DescribedMXBean
  * @run build AnnotationSecurityTest Described UnDescribed DescribedMBean
--- a/jdk/test/javax/management/Introspector/AnnotationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/AnnotationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that annotations in Standard MBean interfaces
  * correctly produce Descriptor entries
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean AnnotationTest
  * @run build AnnotationTest
  * @run main AnnotationTest
--- a/jdk/test/javax/management/Introspector/ChangingNotifsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/ChangingNotifsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Check that Standard MBeans can change their MBeanNotificationInfo[]
  * and MXBeans cannot
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ChangingNotifsTest
  * @run build ChangingNotifsTest
  * @run main ChangingNotifsTest
--- a/jdk/test/javax/management/Introspector/ClassLeakTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/ClassLeakTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4909536
  * @summary Ensure that the Introspector does not retain refs to classes
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ClassLeakTest
  * @run build ClassLeakTest
  * @run main ClassLeakTest
--- a/jdk/test/javax/management/Introspector/DuplicateGetterTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/DuplicateGetterTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Test that an MBean interface can inherit two methods with
  * the same signature from two unrelated parent interfaces
  * @author Eamonn McManus
- * @modules java.management
  */
 
 import java.util.*;
--- a/jdk/test/javax/management/Introspector/FeatureOrderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/FeatureOrderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
  * @summary Test that attributes and operations appear in the same order
  * in MBeanInfo as they did in the Standard MBean or MXBean Interface.
  * @author Eamonn McManus
- * @modules java.management
  */
 
 /*
--- a/jdk/test/javax/management/Introspector/GetMBeanInfoExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/GetMBeanInfoExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that the exception thrown by DynamicMBean.getMBeanInfo()
  *          keeps the init cause.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean GetMBeanInfoExceptionTest
  * @run build GetMBeanInfoExceptionTest
  * @run main GetMBeanInfoExceptionTest
--- a/jdk/test/javax/management/Introspector/IdenticalMBeanInfoTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/IdenticalMBeanInfoTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Check that MBeans with the same class have identical MBeanInfo
  * unless they are NotificationBroadcasters
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean IdenticalMBeanInfoTest
  * @run build IdenticalMBeanInfoTest
  * @run main IdenticalMBeanInfoTest
--- a/jdk/test/javax/management/Introspector/ImmutableNotificationInfoTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/ImmutableNotificationInfoTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Check that a StandardMBean has immutableInfo=true if it is
  * a NotificationBroadcasterSupport that doesn't override getNotificationInfo()
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ImmutableNotificationInfoTest
  * @run build ImmutableNotificationInfoTest
  * @run main ImmutableNotificationInfoTest
--- a/jdk/test/javax/management/Introspector/InvokeGettersTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/InvokeGettersTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6317101
  * @summary Test that the jmx.invoke.getters system property works
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean InvokeGettersTest
  * @run build InvokeGettersTest
  * @run main InvokeGettersTest
--- a/jdk/test/javax/management/Introspector/IsMethodTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/IsMethodTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4947001 4954369 4954409 4954410
  * @summary Test that "Boolean isX()" and "int isX()" define operations
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean IsMethodTest
  * @run build IsMethodTest
  * @run main IsMethodTest
--- a/jdk/test/javax/management/Introspector/LegacyConstructorPropertiesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/LegacyConstructorPropertiesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -37,8 +37,10 @@
  *          j.b.ConstructorProperties and j.m.ConstructorProperties annotations
  *          only j.m.ConstructorProperties annotation is considered.
  * @author Jaroslav Bachorik
- * @modules java.management
- *          java.desktop
+ *
+ * @modules java.desktop
+ *          java.management
+ *
  * @run main LegacyConstructorPropertiesTest
  */
 
--- a/jdk/test/javax/management/Introspector/NotAnMBeanTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/NotAnMBeanTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4914805
  * @summary Ensure that the right exception is thrown for illegal MBeans
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean NotAnMBeanTest
  * @run build NotAnMBeanTest
  * @run main NotAnMBeanTest
--- a/jdk/test/javax/management/Introspector/NotCompliantCauseTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/NotCompliantCauseTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that NotCompliantMBeanException has a cause in case of
  *          type mapping problems.
  * @author Daniel Fuchs, Alexander Shusherov
- * @modules java.management
+ *
  * @run clean NotCompliantCauseTest
  * @run build NotCompliantCauseTest
  * @run main NotCompliantCauseTest
@@ -40,7 +40,6 @@
  */
 
 import java.util.Random;
-import java.util.logging.Logger;
 
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
@@ -55,12 +54,6 @@
 public class NotCompliantCauseTest {
 
     /**
-     * A logger for this class.
-     **/
-    private static final Logger LOG =
-            Logger.getLogger(NotCompliantCauseTest.class.getName());
-
-    /**
      * Creates a new instance of NotCompliantCauseTest
      */
     public NotCompliantCauseTest() {
--- a/jdk/test/javax/management/Introspector/SetWrongTypeAttributeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/SetWrongTypeAttributeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Check that setting the wrong type of an attribute in a Standard
  * MBean or MXBean causes InvalidAttributeValueException
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean SetWrongTypeAttributeTest
  * @run build SetWrongTypeAttributeTest
  * @run main SetWrongTypeAttributeTest
--- a/jdk/test/javax/management/Introspector/UnregisterMBeanExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/Introspector/UnregisterMBeanExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  *          the supplied MBean although DynamicMBean.getMBeanInfo() throws
  *          a runtime exception.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean UnregisterMBeanExceptionTest
  * @run build UnregisterMBeanExceptionTest
  * @run main UnregisterMBeanExceptionTest
--- a/jdk/test/javax/management/MBeanInfo/EqualExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanInfo/EqualExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5071110
  * @summary Test whether an null descriptor will cause an NullPointerException.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean EqualExceptionTest
  * @run build EqualExceptionTest
  * @run main EqualExceptionTest
--- a/jdk/test/javax/management/MBeanInfo/MBeanInfoEqualsNPETest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanInfo/MBeanInfoEqualsNPETest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -36,7 +36,7 @@
  * @bug 8023954
  * @summary Test that MBean*Info.equals do not throw NPE
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean MBeanInfoEqualsNPETest
  * @run build MBeanInfoEqualsNPETest
  * @run main MBeanInfoEqualsNPETest
--- a/jdk/test/javax/management/MBeanInfo/MBeanInfoEqualsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanInfo/MBeanInfoEqualsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4719923
  * @summary Test that MBeanInfo.equals works even for mutable subclasses
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean MBeanInfoEqualsTest
  * @run build MBeanInfoEqualsTest
  * @run main MBeanInfoEqualsTest
--- a/jdk/test/javax/management/MBeanInfo/MBeanInfoHashCodeNPETest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanInfo/MBeanInfoHashCodeNPETest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -35,7 +35,7 @@
  * @bug 8023669
  * @summary Test that hashCode()throws NullPointerException
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean MBeanInfoHashCodeNPETest
  * @run build MBeanInfoHashCodeNPETest
  * @run main MBeanInfoHashCodeNPETest
--- a/jdk/test/javax/management/MBeanInfo/NullInfoArraysTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanInfo/NullInfoArraysTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that an MBeanInfo works even if it is deserialized from
  * an implementation where its array fields can be null.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean NullInfoArraysTest
  * @run build NullInfoArraysTest
  * @run main NullInfoArraysTest
--- a/jdk/test/javax/management/MBeanInfo/SerializationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanInfo/SerializationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6288100
  * @summary Test the new serialization/deserialization methods.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean SerializationTest
  * @run build SerializationTest
  * @run main SerializationTest
--- a/jdk/test/javax/management/MBeanInfo/SerializationTest1.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanInfo/SerializationTest1.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6783290
  * @summary Test correct reading of an empty Descriptor.
  * @author Jaroslav Bachorik
- * @modules java.management
+ *
  * @run clean SerializationTest1
  * @run build SerializationTest1
  * @run main SerializationTest1
--- a/jdk/test/javax/management/MBeanInfo/TooManyFooTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanInfo/TooManyFooTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that a method inherited from two different interfaces
  *          appears only once in MBeanInfo.
  * @author dfuchs
- * @modules java.management
+ *
  * @run clean TooManyFooTest
  * @run build TooManyFooTest
  * @run main TooManyFooTest
@@ -55,12 +55,6 @@
  */
 public class TooManyFooTest {
 
-    /**
-     * A logger for this class.
-     **/
-    private static final Logger LOG =
-            Logger.getLogger(TooManyFooTest.class.getName());
-
     public static class NumberHolder {
         public Integer getNumber() { return 0;}
         public void setNumber(Integer n) {};
--- a/jdk/test/javax/management/MBeanServer/AttributeListTypeSafeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/AttributeListTypeSafeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 6336968
  * @summary Test adding non-Attribute values to an AttributeList.
  * @author Eamonn McManus
- * @modules java.management
  */
 
 import java.util.Collections;
--- a/jdk/test/javax/management/MBeanServer/MBeanExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/MBeanExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,8 +28,7 @@
  * RuntimeMBeanException and (for Standard MBeans) that checked exceptions
  * are wrapped in MBeanException
  * @author Eamonn McManus
- * @modules java.management
- * @compile MBeanExceptionTest.java
+ *
  * @run main MBeanExceptionTest
  */
 
--- a/jdk/test/javax/management/MBeanServer/MBeanFallbackTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/MBeanFallbackTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -33,7 +33,7 @@
  *          It needs to be a separate class because the "jdk.jmx.mbeans.allowNonPublic"
  *          system property must be set before c.s.j.m.MBeanAnalyzer has been loaded.
  * @author Jaroslav Bachorik
- * @modules java.management
+ *
  * @run clean MBeanFallbackTest
  * @run build MBeanFallbackTest
  * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true MBeanFallbackTest
--- a/jdk/test/javax/management/MBeanServer/MBeanServerInvocationHandlerExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/MBeanServerInvocationHandlerExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5092515
  * @summary Test how to unwrap a user specific exception
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean MBeanServerInvocationHandlerExceptionTest
  * @run build MBeanServerInvocationHandlerExceptionTest
  * @run main MBeanServerInvocationHandlerExceptionTest
--- a/jdk/test/javax/management/MBeanServer/MBeanTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/MBeanTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,7 +31,7 @@
  * @bug 8010285
  * @summary General MBean test.
  * @author Jaroslav Bachorik
- * @modules java.management
+ *
  * @run clean MBeanTest
  * @run build MBeanTest
  * @run main MBeanTest
--- a/jdk/test/javax/management/MBeanServer/NewMBeanListenerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/NewMBeanListenerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4757273
  * @summary Test that registered notification is sent early enough
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean NewMBeanListenerTest
  * @run build NewMBeanListenerTest
  * @run main NewMBeanListenerTest
--- a/jdk/test/javax/management/MBeanServer/NotifDeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/NotifDeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4757273
  * @summary Test deadlock in MBeanServerDelegate listeners
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean NotifDeadlockTest
  * @run build NotifDeadlockTest
  * @run main NotifDeadlockTest
--- a/jdk/test/javax/management/MBeanServer/PostExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/PostExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,8 +27,7 @@
  * @summary Check behaviour of MBeanServer when postRegister and postDeregister
  *          throw exceptions.
  * @author Daniel Fuchs
- * @modules java.management
- * @compile PostExceptionTest.java
+ *
  * @run main PostExceptionTest
  */
 
--- a/jdk/test/javax/management/MBeanServer/PostRegisterDeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/PostRegisterDeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6417044
  * @summary Test deadlock in MBeanRegistration.postRegister method
  * @author Eamonn McManus, Daniel Fuchs
- * @modules java.management
+ *
  * @run clean PostRegisterDeadlockTest
  * @run build PostRegisterDeadlockTest
  * @run main PostRegisterDeadlockTest
--- a/jdk/test/javax/management/MBeanServer/PostRegisterDeadlockTest2.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/PostRegisterDeadlockTest2.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6417044
  * @summary Test that a failing MBean registration does not lead to a deadlock
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run main PostRegisterDeadlockTest2
  */
 
--- a/jdk/test/javax/management/MBeanServer/PreDeregisterDeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/PreDeregisterDeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6318664
  * @summary Test deadlock in MBeanRegistration.preDeregister method
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean PreDeregisterDeadlockTest
  * @run build PreDeregisterDeadlockTest
  * @run main PreDeregisterDeadlockTest
--- a/jdk/test/javax/management/MBeanServer/PreRegisterTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServer/PreRegisterTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4911846
  * @summary Test that MBeanRegistration can change caller ObjectName
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean PreRegisterTest
  * @run build PreRegisterTest
  * @run main PreRegisterTest
--- a/jdk/test/javax/management/MBeanServerFactory/ReleaseMBeanServerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MBeanServerFactory/ReleaseMBeanServerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that the releaseMBeanServer(MBeanServer mbeanServer) method
  *          throws IllegalArgumentException as expected
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean ReleaseMBeanServerTest
  * @run build ReleaseMBeanServerTest
  * @run main ReleaseMBeanServerTest
--- a/jdk/test/javax/management/MustBeValidMBeanInfo/MustBeValidCommand.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/MustBeValidMBeanInfo/MustBeValidCommand.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  * IllegalArgumentException when attribute names, operation names, and
  * Java type names do not strictly follow the expected Java syntax.
  * @author Daniel Fuchs
- * @modules java.management
+ *
  * @run clean MustBeValidCommand
  * @run build MustBeValidCommand
  * @run main MustBeValidCommand
--- a/jdk/test/javax/management/ObjectInstance/MBeanInfoFailTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectInstance/MBeanInfoFailTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5001857
  * @summary Test queryNames() and queryMBeans() with a buggy DynamicMBean
  * @author Daniel Fuchs
- * @modules java.management
+ *
  * @run clean MBeanInfoFailTest
  * @run build MBeanInfoFailTest
  * @run main MBeanInfoFailTest
--- a/jdk/test/javax/management/ObjectInstance/ObjectInstanceNullTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectInstance/ObjectInstanceNullTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5015663
  * @summary Test ObjectInstance(name,null).hashCode() and .equals()
  * @author Daniel Fuchs
- * @modules java.management
+ *
  * @run clean ObjectInstanceNullTest
  * @run build ObjectInstanceNullTest
  * @run main ObjectInstanceNullTest
--- a/jdk/test/javax/management/ObjectInstance/ToStringMethodTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectInstance/ToStringMethodTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5080083
  * @summary Test new added method "toString"
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean ToStringMethodTest
  * @run build ToStringMethodTest
  * @run main ToStringMethodTest
--- a/jdk/test/javax/management/ObjectName/ApplyWildcardTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectName/ApplyWildcardTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test the ObjectName.apply(ObjectName) method
  *          with wildcards in the key properties value part.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean ApplyWildcardTest
  * @run build ApplyWildcardTest
  * @run main ApplyWildcardTest
--- a/jdk/test/javax/management/ObjectName/ComparatorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectName/ComparatorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5036680
  * @summary Test the ObjectName.compareTo() method.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean ComparatorTest
  * @run build ComparatorTest
  * @run main ComparatorTest
--- a/jdk/test/javax/management/ObjectName/DelegateNameWildcardNameTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectName/DelegateNameWildcardNameTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that MBeanServerDelegate.DELEGATE_NAME and ObjectName.WILDCARD
  *          public constants have been initialized properly.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean DelegateNameWildcardNameTest
  * @run build DelegateNameWildcardNameTest
  * @run main DelegateNameWildcardNameTest
--- a/jdk/test/javax/management/ObjectName/NullEmptyKeyValueTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectName/NullEmptyKeyValueTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6229396
  * @summary Test null/empty key/values in ObjectName constructors.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean NullEmptyKeyValueTest
  * @run build NullEmptyKeyValueTest
  * @run main NullEmptyKeyValueTest
--- a/jdk/test/javax/management/ObjectName/ObjectNameGetInstanceTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectName/ObjectNameGetInstanceTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4894801
  * @summary Test that ObjectName.getInstance(ObjectName) preserves key order
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ObjectNameGetInstanceTest
  * @run build ObjectNameGetInstanceTest
  * @run main ObjectNameGetInstanceTest
--- a/jdk/test/javax/management/ObjectName/RepositoryWildcardTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectName/RepositoryWildcardTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test if the repository supports correctly the use of
  *          wildcards in the ObjectName key properties value part.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean RepositoryWildcardTest
  * @run build RepositoryWildcardTest
  * @run main RepositoryWildcardTest
--- a/jdk/test/javax/management/ObjectName/SerialCompatTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectName/SerialCompatTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6211220 6616825
  * @summary Test that jmx.serial.form=1.0 works for ObjectName
  * @author Eamonn McManus, Daniel Fuchs
- * @modules java.management
+ *
  * @run clean SerialCompatTest
  * @run build SerialCompatTest
  * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true -Djmx.serial.form=1.0 SerialCompatTest
--- a/jdk/test/javax/management/ObjectName/ValueWildcardTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/ObjectName/ValueWildcardTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4716807
  * @summary Test wildcards in ObjectName key properties value part.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean ValueWildcardTest
  * @run build ValueWildcardTest
  * @run main ValueWildcardTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = java.management
+
--- a/jdk/test/javax/management/descriptor/DefaultDescriptorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/descriptor/DefaultDescriptorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6204469
  * @summary Test that MBean*Info can be constructed with default descriptor
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean DefaultDescriptorTest
  * @run build DefaultDescriptorTest
  * @run main DefaultDescriptorTest
--- a/jdk/test/javax/management/descriptor/DescriptorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/descriptor/DescriptorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6204469 6273765
  * @summary Test various aspects of the Descriptor interface
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean DescriptorTest
  * @run build DescriptorTest
  * @run main DescriptorTest
--- a/jdk/test/javax/management/descriptor/EqualsHashCodeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/descriptor/EqualsHashCodeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6255956
  * @summary Test equals and hashCode for descriptors
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean EqualsHashCodeTest
  * @run build EqualsHashCodeTest
  * @run main EqualsHashCodeTest
--- a/jdk/test/javax/management/descriptor/ImmutableArrayFieldTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/descriptor/ImmutableArrayFieldTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that immutability of ImmutableDescriptor cannot be
  * compromised by modifying field values that are arrays.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ImmutableArrayFieldTest
  * @run build ImmutableArrayFieldTest
  * @run main ImmutableArrayFieldTest
--- a/jdk/test/javax/management/descriptor/ImmutableDescriptorSerialTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/descriptor/ImmutableDescriptorSerialTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6204469
  * @summary Test ImmutableDescriptor serialization.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ImmutableDescriptorSerialTest
  * @run build ImmutableDescriptorSerialTest
  * @run main ImmutableDescriptorSerialTest
--- a/jdk/test/javax/management/descriptor/ImmutableDescriptorSetFieldsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/descriptor/ImmutableDescriptorSetFieldsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  * null name in it and calling setFields with a field names array with an
  * empty name in it throw the expected exceptions.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean ImmutableDescriptorSetFieldsTest
  * @run build ImmutableDescriptorSetFieldsTest
  * @run main ImmutableDescriptorSetFieldsTest
--- a/jdk/test/javax/management/descriptor/MBeanInfoInteropTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/descriptor/MBeanInfoInteropTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6204469
  * @summary Check that descriptors have not broken serial interop.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean MBeanInfoInteropTest SerializedInfo
  * @run build MBeanInfoInteropTest SerializedInfo
  * @run main MBeanInfoInteropTest SerializedInfo
--- a/jdk/test/javax/management/descriptor/UnionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/descriptor/UnionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6273752
  * @summary Test ImmutableDescriptor.union
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean UnionTest
  * @run build UnionTest
  * @run main UnionTest
--- a/jdk/test/javax/management/generified/GenericTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/generified/GenericTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4847959 6191402
  * @summary Test newly-generified APIs
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean GenericTest
  * @run build GenericTest
  * @run main GenericTest
--- a/jdk/test/javax/management/generified/ListTypeCheckTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/generified/ListTypeCheckTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6250772
  * @summary Test that *List objects are checked after asList is called.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ListTypeCheckTest
  * @run build ListTypeCheckTest
  * @run main ListTypeCheckTest
--- a/jdk/test/javax/management/loading/ArrayClassTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/loading/ArrayClassTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that array classes can be found in signatures always
  * and can be deserialized by the deprecated MBeanServer.deserialize method
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ArrayClassTest
  * @run build ArrayClassTest
  * @run main ArrayClassTest
--- a/jdk/test/javax/management/loading/DocumentRootTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/loading/DocumentRootTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test parsing error when the mlet file is
  *          located in the web server's document root.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean DocumentRootTest
  * @run build DocumentRootTest
  * @run main DocumentRootTest
--- a/jdk/test/javax/management/loading/GetMBeansFromURLTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/loading/GetMBeansFromURLTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  *          given MLet instance throws a ServiceNotFoundException exception
  *          with a non null cause.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean GetMBeansFromURLTest
  * @run build GetMBeansFromURLTest
  * @run main GetMBeansFromURLTest
--- a/jdk/test/javax/management/loading/LibraryLoader/LibraryLoaderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/loading/LibraryLoader/LibraryLoaderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that the same native library coming from the same jar file can
  * be loaded twice by two different MLets on the same JVM without conflict.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean LibraryLoaderTest
  * @run build LibraryLoaderTest
  * @run main/othervm LibraryLoaderTest
--- a/jdk/test/javax/management/loading/MLetCLR/MLetCommand.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/loading/MLetCLR/MLetCommand.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  * for the test codebase as it is executed by the MLet code using
  * doPrivileged.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean MLetCommand
  * @run build MLetCommand
  * @run main/othervm/java.security.policy=policy MLetCommand
--- a/jdk/test/javax/management/loading/MLetContentTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/loading/MLetContentTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4796780
  * @summary The class MLetContentTest becomes public
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean MLetContentTest
  * @run build MLetContentTest
  * @run main MLetContentTest
--- a/jdk/test/javax/management/loading/MletParserLocaleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/loading/MletParserLocaleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 7065236
  * @summary Checking MletParser for Locale insensitive strings
  * @author Harsha Wardhana B
- * @modules java.management
+ *
  * @run clean MletParserLocaleTest
  * @run build MletParserLocaleTest
  * @run main/othervm/timeout=5 MletParserLocaleTest mlet4.html
--- a/jdk/test/javax/management/loading/ParserInfiniteLoopTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/loading/ParserInfiniteLoopTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,7 @@
  * terminated with the corresponding '>' and an opening '<' for
  * the subsequent tag is encountered.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean ParserInfiniteLoopTest
  * @run build ParserInfiniteLoopTest
  * @run main/othervm/timeout=5 ParserInfiniteLoopTest mlet1.html
--- a/jdk/test/javax/management/loading/SystemClassLoaderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/loading/SystemClassLoaderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that a class can load MBeans from its class loader
  * (at least if it is the system class loader)
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean SystemClassLoaderTest
  * @run build SystemClassLoaderTest
  * @run main SystemClassLoaderTest
--- a/jdk/test/javax/management/modelmbean/AddAttributeChangeNotificationListenerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/AddAttributeChangeNotificationListenerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,7 +30,7 @@
  * no other attributes.
  * @author Yves Joan
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean AddAttributeChangeNotificationListenerTest
  * @run build AddAttributeChangeNotificationListenerTest
  * @run main AddAttributeChangeNotificationListenerTest
--- a/jdk/test/javax/management/modelmbean/DescriptorSupportSerialTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/DescriptorSupportSerialTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6332962
  * @summary Test that DescriptorSupport does not serialize targetObject
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean DescriptorSupportSerialTest
  * @run build DescriptorSupportSerialTest
  * @run main DescriptorSupportSerialTest
--- a/jdk/test/javax/management/modelmbean/DescriptorSupportTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/DescriptorSupportTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4883712 4869006 4894856 5016685
  * @summary Test that DescriptorSupport correctly validates fields
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean DescriptorSupportTest
  * @run build DescriptorSupportTest
  * @run main DescriptorSupportTest
--- a/jdk/test/javax/management/modelmbean/DescriptorSupportXMLLocaleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/DescriptorSupportXMLLocaleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 7065236
  * @summary Test for locale insensitive strings in DescriptorSupport class
  * @author Harsha Wardhana B
- * @modules java.management
+ *
  * @run clean DescriptorSupportXMLLocaleTest
  * @run build DescriptorSupportXMLLocaleTest
  * @run main DescriptorSupportXMLLocaleTest
--- a/jdk/test/javax/management/modelmbean/DescriptorSupportXMLTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/DescriptorSupportXMLTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that DescriptorSupport.toXMLString() can be used to
  * reconstruct an equivalent DescriptorSupport
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean DescriptorSupportXMLTest
  * @run build DescriptorSupportXMLTest
  * @run main DescriptorSupportXMLTest
--- a/jdk/test/javax/management/modelmbean/ExoticTargetTypeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/ExoticTargetTypeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that a custom ModelMBean implementation can have custom
  * targetType values in its ModelMBeanOperationInfo descriptors.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ExoticTargetTypeTest
  * @run build ExoticTargetTypeTest
  * @run main ExoticTargetTypeTest
--- a/jdk/test/javax/management/modelmbean/InfoSupportTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/InfoSupportTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,7 @@
  * that getDescriptors("mbean") works, and that default values for
  * MBean descriptors are correctly assigned.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean InfoSupportTest
  * @run build InfoSupportTest
  * @run main InfoSupportTest
--- a/jdk/test/javax/management/modelmbean/LoggingExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/LoggingExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,9 @@
  * when traces enabled and no attributes.
  * @author Luis-Miguel Alventosa
  * @author Paul Cheeseman
- * @modules java.management
+ *
+ * @modules java.logging
+ *          java.management
  */
 
 import java.util.logging.ConsoleHandler;
--- a/jdk/test/javax/management/modelmbean/ModelMBeanInfoSupport/GetAllDescriptorsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/ModelMBeanInfoSupport/GetAllDescriptorsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that  ModelMBeanInfoSupport.getDescriptors(null) also
  *          returns the MBean's descriptor.
  * @author Eamonn McManus, Daniel Fuchs
- * @modules java.management
+ *
  * @run clean GetAllDescriptorsTest
  * @run build GetAllDescriptorsTest
  * @run main/othervm/java.security.policy=policy  GetAllDescriptorsTest
--- a/jdk/test/javax/management/modelmbean/OnUnregisterTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/OnUnregisterTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Check that OnUnregister is an allowed value for persistPolicy
  * in ModelMBeanAttributeInfo
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean OnUnregisterTest
  * @run build OnUnregisterTest
  * @run main OnUnregisterTest
--- a/jdk/test/javax/management/modelmbean/RequiredModelMBeanGetAttributeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/RequiredModelMBeanGetAttributeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -36,7 +36,7 @@
  * - the declared name can be loaded by the value's class loader and
  *   produces a class to which the value can be assigned.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean RequiredModelMBeanGetAttributeTest
  * @run build RequiredModelMBeanGetAttributeTest
  * @run main RequiredModelMBeanGetAttributeTest
--- a/jdk/test/javax/management/modelmbean/RequiredModelMBeanMethodTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/RequiredModelMBeanMethodTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  * from the RequiredModelMBean class itself if they are not in the
  * ModelMBeanInfo
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean RequiredModelMBeanMethodTest
  * @run build RequiredModelMBeanMethodTest
  * @run main RequiredModelMBeanMethodTest
--- a/jdk/test/javax/management/modelmbean/RequiredModelMBeanSetAttributeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/RequiredModelMBeanSetAttributeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  * MBeanException wrapping a ServiceNotFoundException is thrown is setAttribute
  * called but no setMethod field has been provided.
  * @author Jean-Francois Denise
- * @modules java.management
+ *
  * @run clean RequiredModelMBeanSetAttributeTest
  * @run build RequiredModelMBeanSetAttributeTest
  * @run main RequiredModelMBeanSetAttributeTest
--- a/jdk/test/javax/management/modelmbean/SimpleModelMBean/SimpleModelMBeanCommand.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/modelmbean/SimpleModelMBean/SimpleModelMBeanCommand.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  * IllegalArgumentException when attribute names, operation names, and
  * Java type names do not strictly follow the expected Java syntax.
  * @author Eamonn McManus, Daniel Fuchs
- * @modules java.management
+ *
  * @run clean SimpleModelMBeanCommand
  * @run build SimpleModelMBeanCommand
  * @run main/othervm/java.security.policy=policy  SimpleModelMBeanCommand
--- a/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that no locks are held when a monitor attribute is sampled
  * or notif delivered.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean CounterMonitorDeadlockTest
  * @run build CounterMonitorDeadlockTest
  * @run main CounterMonitorDeadlockTest 1
--- a/jdk/test/javax/management/monitor/CounterMonitorInitThresholdTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/CounterMonitorInitThresholdTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  *          objects added before the counter monitor is started as well as by
  *          the observed objects which are added once the monitor is started.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean CounterMonitorInitThresholdTest
  * @run build CounterMonitorInitThresholdTest
  * @run main CounterMonitorInitThresholdTest
--- a/jdk/test/javax/management/monitor/CounterMonitorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/CounterMonitorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that the counter monitor, when running in difference mode,
  *          emits a notification every time the threshold is exceeded.
  * @author Luis-Miguel Alventosa, Shanliang JIANG
- * @modules java.management
+ *
  * @run clean CounterMonitorTest
  * @run build CounterMonitorTest
  * @run main CounterMonitorTest
--- a/jdk/test/javax/management/monitor/CounterMonitorThresholdTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/CounterMonitorThresholdTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6229368 8025207
  * @summary Wrong threshold value in CounterMonitor with offset and modulus.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean CounterMonitorThresholdTest
  * @run build CounterMonitorThresholdTest
  * @run main CounterMonitorThresholdTest
--- a/jdk/test/javax/management/monitor/DerivedGaugeMonitorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/DerivedGaugeMonitorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6683213
  * @summary Test that the initial derived gauge is (Integer)0
  * @author Daniel Fuchs
- * @modules java.management
+ *
  * @run clean DerivedGaugeMonitorTest
  * @run build DerivedGaugeMonitorTest
  * @run main DerivedGaugeMonitorTest
--- a/jdk/test/javax/management/monitor/GaugeMonitorDeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/GaugeMonitorDeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,8 +27,9 @@
  * @summary Test that no locks are held when a monitor attribute is sampled
  * or notif delivered.
  * @author Eamonn McManus
+ *
  * @library /lib/testlibrary
- * @modules java.management
+ *
  * @run clean GaugeMonitorDeadlockTest
  * @run build GaugeMonitorDeadlockTest
  * @run main GaugeMonitorDeadlockTest 1
--- a/jdk/test/javax/management/monitor/MultiMonitorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/MultiMonitorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,13 +24,13 @@
 /*
  * @test
  * @bug 4984057
+ * @key randomness
  * @summary Test that monitors can sample a large number of attributes
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean MultiMonitorTest
  * @run build MultiMonitorTest
  * @run main MultiMonitorTest
- * @key randomness
  */
 
 import java.util.*;
--- a/jdk/test/javax/management/monitor/NonComparableAttributeValueTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/NonComparableAttributeValueTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  *          jmx.monitor.error.type notification when the attribute
  *          being monitored returns a non comparable value.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean NonComparableAttributeValueTest
  * @run build NonComparableAttributeValueTest
  * @run main NonComparableAttributeValueTest
--- a/jdk/test/javax/management/monitor/NullAttributeValueTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/NullAttributeValueTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,7 @@
  *          being monitored returns a null value.
  * @author Luis-Miguel Alventosa
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean NullAttributeValueTest
  * @run build NullAttributeValueTest
  * @run main NullAttributeValueTest
--- a/jdk/test/javax/management/monitor/ReflectionExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/ReflectionExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,11 +24,11 @@
 /*
  * @test
  * @bug 6205072
+ * @key intermittent
  * @summary Test that the jmx.monitor.error.runtime monitor notification
  *          is emitted when getAttribute throws ReflectionException.
  * @author Luis-Miguel Alventosa
- * @key intermittent
- * @modules java.management
+ *
  * @run clean ReflectionExceptionTest MBeanServerBuilderImpl
  *            MBeanServerForwarderInvocationHandler
  * @run build ReflectionExceptionTest MBeanServerBuilderImpl
--- a/jdk/test/javax/management/monitor/RuntimeExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/RuntimeExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that the jmx.monitor.error.runtime monitor notification
  *          is emitted when getAttribute throws RuntimeException.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean RuntimeExceptionTest MBeanServerBuilderImpl
  *            MBeanServerForwarderInvocationHandler
  * @run build RuntimeExceptionTest MBeanServerBuilderImpl
--- a/jdk/test/javax/management/monitor/StartStopTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/StartStopTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,8 +27,9 @@
  * @summary Test that tasks are cancelled properly when
  *          monitors are started and stopped in a loop.
  * @author Luis-Miguel Alventosa
+ *
  * @library /lib/testlibrary
- * @modules java.management
+ *
  * @build jdk.testlibrary.*
  * @run clean StartStopTest
  * @run build StartStopTest
--- a/jdk/test/javax/management/monitor/StringMonitorDeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/StringMonitorDeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,11 +24,11 @@
 /*
  * @test
  * @bug 6303187
+ * @key intermittent
  * @summary Test that no locks are held when a monitor attribute is sampled
  * or notif delivered.
  * @author Eamonn McManus
- * @key intermittent
- * @modules java.management
+ *
  * @run clean StringMonitorDeadlockTest
  * @run build StringMonitorDeadlockTest
  * @run main StringMonitorDeadlockTest 1
--- a/jdk/test/javax/management/monitor/ThreadPoolAccTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/ThreadPoolAccTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that each thread in the thread pool runs
  *          in the context of the monitor.start() caller.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean ThreadPoolAccTest
  * @run build ThreadPoolAccTest
  * @run main ThreadPoolAccTest
--- a/jdk/test/javax/management/monitor/ThreadPoolTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/monitor/ThreadPoolTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that all monitors will be well started when sharing
  * a single thread pool.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean ThreadPoolTest
  * @run build ThreadPoolTest
  * @run main/othervm/timeout=300 ThreadPoolTest 1
--- a/jdk/test/javax/management/mxbean/AmbiguousConstructorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/AmbiguousConstructorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6175517 6278707
  * @summary Test that ambiguous ConstructorProperties annotations are detected.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean AmbiguousConstructorTest
  * @run build AmbiguousConstructorTest
  * @run main AmbiguousConstructorTest
--- a/jdk/test/javax/management/mxbean/ComparatorExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/ComparatorExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 6601652
  * @summary Test exception when SortedMap or SortedSet has non-null Comparator
  * @author Eamonn McManus
- * @modules java.management
  */
 
 import java.util.SortedMap;
--- a/jdk/test/javax/management/mxbean/ExceptionDiagnosisTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/ExceptionDiagnosisTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 6713777
  * @summary Test that exception messages include all relevant information
  * @author Eamonn McManus
- * @modules java.management
  */
 
 import javax.management.ConstructorParameters;
--- a/jdk/test/javax/management/mxbean/GenericTypeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/GenericTypeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6376416 6406447
  * @summary Test use of generic types in MXBeans (mostly illegal).
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run main GenericTypeTest
  */
 
--- a/jdk/test/javax/management/mxbean/InvalidMXBeanRegistrationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/InvalidMXBeanRegistrationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Ensure the registration of an invalid MXBean
  *          throws NotCompliantMBeanException.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean InvalidMXBeanRegistrationTest
  * @run build InvalidMXBeanRegistrationTest
  * @run main InvalidMXBeanRegistrationTest
--- a/jdk/test/javax/management/mxbean/LeakTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/LeakTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,7 +25,7 @@
  * @bug 6482247
  * @summary Test that creating MXBeans does not introduce memory leaks.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run build LeakTest RandomMXBeanTest MerlinMXBean TigerMXBean
  * @run main LeakTest
  */
--- a/jdk/test/javax/management/mxbean/MBeanOperationInfoTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/MBeanOperationInfoTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6359948
  * @summary Check that MXBean operations have the expected ReturnType in MBeanOperationInfo
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean MBeanOperationInfoTest
  * @run build MBeanOperationInfoTest
  * @run main MBeanOperationInfoTest
--- a/jdk/test/javax/management/mxbean/MXBeanAnnotationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/MXBeanAnnotationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6316491
  * @summary Check that the MXBean annotation works as advertised
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean MXBeanAnnotationTest
  * @run build MXBeanAnnotationTest
  * @run main MXBeanAnnotationTest
--- a/jdk/test/javax/management/mxbean/MXBeanFallbackTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/MXBeanFallbackTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  *          It needs to be a separate class because the "jdk.jmx.mbeans.allowNonPublic"
  *          system property must be set before c.s.j.m.MBeanAnalyzer has been loaded.
  * @author Jaroslav Bachorik
- * @modules java.management
+ *
  * @run clean MXBeanFallbackTest
  * @run build MXBeanFallbackTest
  * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true MXBeanFallbackTest
--- a/jdk/test/javax/management/mxbean/MXBeanFlagTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/MXBeanFlagTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6335337
  * @summary Test correctness of mxbean flag in descriptor.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean MXBeanFlagTest
  * @run build MXBeanFlagTest
  * @run main MXBeanFlagTest
--- a/jdk/test/javax/management/mxbean/MXBeanLoadingTest1.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/MXBeanLoadingTest1.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,8 +26,9 @@
  * @bug 8058865
  * @summary Checks correct collection of MXBean's class after unregistration
  * @author Olivier Lagneau
- * @modules java.management
+ *
  * @library /lib/testlibrary
+ *
  * @run main/othervm/timeout=300 MXBeanLoadingTest1
  */
 
--- a/jdk/test/javax/management/mxbean/MXBeanPreRegisterTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/MXBeanPreRegisterTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Ensure that preRegister etc are called, but not when wrapped
  * by the class StandardMBean
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean MXBeanPreRegisterTest
  * @run build MXBeanPreRegisterTest
  * @run main MXBeanPreRegisterTest
--- a/jdk/test/javax/management/mxbean/MXBeanRefTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/MXBeanRefTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6296433 6283873
  * @summary Test that inter-MXBean references work as expected.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean MXBeanRefTest
  * @run build MXBeanRefTest
  * @run main MXBeanRefTest
--- a/jdk/test/javax/management/mxbean/MiscTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/MiscTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  *          interfaceClassName, openType, originalType, StandardMBean,
  *          StandardEmitterMBean.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean MiscTest
  * @run build MiscTest
  * @run main MiscTest
--- a/jdk/test/javax/management/mxbean/OperationImpactTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/OperationImpactTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6320104
  * @summary Check that MXBean operations have impact UNKNOWN.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean OperationImpactTest
  * @run build OperationImpactTest
  * @run main OperationImpactTest
--- a/jdk/test/javax/management/mxbean/OverloadTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/OverloadTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6175517
  * @summary Test that MXBean interfaces can contain overloaded methods
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean OverloadTest
  * @run build OverloadTest
  * @run main OverloadTest
--- a/jdk/test/javax/management/mxbean/PreRegisterNameTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/PreRegisterNameTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 6448042
  * @summary Test that MXBeans can define their own names in preRegister
  * @author Eamonn McManus
- * @modules java.management
  */
 
 import java.lang.management.ManagementFactory;
--- a/jdk/test/javax/management/mxbean/PropertyNamesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/PropertyNamesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6175517
  * @summary Test the PropertyNames annotation with MXBeans
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean PropertyNamesTest
  * @run build PropertyNamesTest
  * @run main PropertyNamesTest
--- a/jdk/test/javax/management/mxbean/SameObjectTwoNamesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/SameObjectTwoNamesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  * names produces an exception
  * @author Alexander Shusherov
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run main SameObjectTwoNamesTest
  * @run main/othervm -Djmx.mxbean.multiname=true SameObjectTwoNamesTest
  */
--- a/jdk/test/javax/management/mxbean/StandardMBeanOverrideTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/StandardMBeanOverrideTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,7 @@
  *          getMBeanInfo and getNotificationInfo in StandardMBean and
  *          StandardEmitterMBean.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean StandardMBeanOverrideTest
  * @run build StandardMBeanOverrideTest
  * @run main StandardMBeanOverrideTest
--- a/jdk/test/javax/management/mxbean/ThreadMXBeanTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/ThreadMXBeanTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,13 +24,13 @@
 /*
  * @test
  * @bug 6305746
+ * @key randomness
  * @summary Test that the null values returned by the ThreadMXBean work.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ThreadMXBeanTest
  * @run build ThreadMXBeanTest
  * @run main ThreadMXBeanTest
- * @key randomness
  */
 
 import java.lang.management.*;
--- a/jdk/test/javax/management/mxbean/TypeNameTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/mxbean/TypeNameTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 6757225 6763051
  * @summary Test that type names in MXBeans match their spec.
  * @author Eamonn McManus
- * @modules java.management
  */
 
 import java.lang.reflect.Field;
--- a/jdk/test/javax/management/notification/BroadcasterSupportDeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/notification/BroadcasterSupportDeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that NotificationBroadcasterSupport can be subclassed
  * and used with synchronized(this) without causing deadlock
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean BroadcasterSupportDeadlockTest
  * @run build BroadcasterSupportDeadlockTest
  * @run main BroadcasterSupportDeadlockTest
--- a/jdk/test/javax/management/notification/FilterExceptionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/notification/FilterExceptionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6244855 6244863
  * @summary Exception thrown by NotificationFilter should be ignored
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean FilterExceptionTest
  * @run build FilterExceptionTest
  * @run main FilterExceptionTest
--- a/jdk/test/javax/management/notification/NotifExecutorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/notification/NotifExecutorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4661545
  * @summary Tests to use an executor to send notifications.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean NotifExecutorTest
  * @run build NotifExecutorTest
  * @run main NotifExecutorTest
--- a/jdk/test/javax/management/notification/NotifInfoTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/notification/NotifInfoTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4506105 6303698
  * @summary NotificationBroadcasterSupport should have a ctor with MBeanNotificationInfo[]
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean NotifInfoTest
  * @run build NotifInfoTest
  * @run main NotifInfoTest
--- a/jdk/test/javax/management/openmbean/ArrayTypeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/openmbean/ArrayTypeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5045358
  * @summary Test that Open MBeans support arrays of primitive types.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean ArrayTypeTest
  * @run build ArrayTypeTest
  * @run main ArrayTypeTest
--- a/jdk/test/javax/management/openmbean/BadConstraintTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/openmbean/BadConstraintTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that Open MBean attributes and parameters cannot have
  * illegal constraints like min greater than max
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean BadConstraintTest
  * @run build BadConstraintTest
  * @run main BadConstraintTest
--- a/jdk/test/javax/management/openmbean/CompositeDataStringTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/openmbean/CompositeDataStringTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 6610174
  * @summary Test that CompositeDataSupport.toString() represents arrays correctly
  * @author Eamonn McManus
- * @modules java.management
  */
 
 import javax.management.openmbean.ArrayType;
--- a/jdk/test/javax/management/openmbean/ConstraintTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/openmbean/ConstraintTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6204469
  * @summary Test that Open MBean attributes and parameters check constraints
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ConstraintTest
  * @run build ConstraintTest
  * @run main ConstraintTest
--- a/jdk/test/javax/management/openmbean/EqualsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/openmbean/EqualsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5072174
  * @summary Test CompositeDataSupport.equals with ArrayType
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean EqualsTest
  * @run build EqualsTest
  * @run main EqualsTest
--- a/jdk/test/javax/management/openmbean/IsValueTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/openmbean/IsValueTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 5072004
  * @summary Test new rules for isValue
  * @author Eamonn McManus
- * @modules java.management
  */
 
 import javax.management.openmbean.*;
--- a/jdk/test/javax/management/openmbean/NullConstructorParamsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/openmbean/NullConstructorParamsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 6434298
  * @summary Test IAE is thrown when typeName or description parameter is null for TabularType and CompositeType constructors
  * @author Joel FERAUD
- * @modules java.management
  */
 
 import javax.management.openmbean.*;
--- a/jdk/test/javax/management/openmbean/OpenMBeanInfoEqualsNPETest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/openmbean/OpenMBeanInfoEqualsNPETest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -41,7 +41,7 @@
  * @bug 8023529
  * @summary Test that OpenMBean*Info.equals do not throw NPE
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean OpenMBeanInfoEqualsNPETest
  * @run build OpenMBeanInfoEqualsNPETest
  * @run main OpenMBeanInfoEqualsNPETest
--- a/jdk/test/javax/management/openmbean/OpenMBeanInfoHashCodeNPETest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/openmbean/OpenMBeanInfoHashCodeNPETest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -40,7 +40,7 @@
  * @bug 8023529
  * @summary Test that OpenMBean*Info.hashCode do not throw NPE
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean OpenMBeanInfoHashCodeNPETest
  * @run build OpenMBeanInfoHashCodeNPETest
  * @run main OpenMBeanInfoHashCodeNPETest
--- a/jdk/test/javax/management/openmbean/OpenTypeDescriptorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/openmbean/OpenTypeDescriptorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  * @summary Test that Open*MBeanInfo classes include "openType" in descriptor
  *          and also test serial compatibility with Java 5.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean OpenTypeDescriptorTest
  * @run build OpenTypeDescriptorTest
  * @run main OpenTypeDescriptorTest
--- a/jdk/test/javax/management/proxy/JMXProxyFallbackTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/proxy/JMXProxyFallbackTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -34,7 +34,7 @@
  *          It needs to be a separate class because the "jdk.jmx.mbeans.allowNonPublic"
  *          system property must be set before c.s.j.m.MBeanAnalyzer has been loaded.
  * @author Jaroslav Bachorik
- * @modules java.management
+ *
  * @run clean JMXProxyFallbackTest
  * @run build JMXProxyFallbackTest
  * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true JMXProxyFallbackTest
--- a/jdk/test/javax/management/proxy/JMXProxyTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/proxy/JMXProxyTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -33,7 +33,7 @@
  * @summary Tests that javax.management.JMX creates proxies only for the
  *          compliant MBeans/MXBeans
  * @author Jaroslav Bachorik
- * @modules java.management
+ *
  * @run clean JMXProxyTest
  * @run build JMXProxyTest
  * @run main JMXProxyTest
--- a/jdk/test/javax/management/proxy/NotificationEmitterProxy.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/proxy/NotificationEmitterProxy.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @summary Test that we can create proxies which are NotificationEmitters.
  * @bug 6411747
  * @author Daniel Fuchs
- * @modules java.management
+ *
  * @run clean NotificationEmitterProxy
  * @run build NotificationEmitterProxy
  * @run main NotificationEmitterProxy
--- a/jdk/test/javax/management/proxy/ProxyObjectMethodsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/proxy/ProxyObjectMethodsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6177524
  * @summary Test how to execute the 3 Object methods by a Proxy.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean ProxyObjectMethodsTest
  * @run build ProxyObjectMethodsTest
  * @run main ProxyObjectMethodsTest
--- a/jdk/test/javax/management/query/CustomQueryTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/query/CustomQueryTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 6692027
  * @summary Check that custom subclasses of QueryEval can be serialized.
  * @author Eamonn McManus
- * @modules java.management
  */
 
 import java.io.ByteArrayInputStream;
--- a/jdk/test/javax/management/query/InstanceOfExpTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/query/InstanceOfExpTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5072174 6335848
  * @summary test the new method javax.management.Query.isInstanceOf("className")
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean InstanceOfExpTest
  * @run build InstanceOfExpTest
  * @run main InstanceOfExpTest
--- a/jdk/test/javax/management/query/QueryExpStringTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/query/QueryExpStringTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4886011
  * @summary Test that QueryExp.toString() is reversible
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean QueryExpStringTest
  * @run build QueryExpStringTest
  * @run main QueryExpStringTest
--- a/jdk/test/javax/management/query/QueryMatchTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/query/QueryMatchTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6266438
  * @summary Query.match code for character sequences like [a-z] is wrong.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean QueryMatchTest
  * @run build QueryMatchTest
  * @run main QueryMatchTest
--- a/jdk/test/javax/management/query/QuerySubstringTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/query/QuerySubstringTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Query.{initial,any,final}SubString fail if the
  *          matching constraint string contains wildcards.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean QuerySubstringTest
  * @run build QuerySubstringTest
  * @run main QuerySubstringTest
--- a/jdk/test/javax/management/relation/NonArrayListTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/relation/NonArrayListTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4848474
  * @summary Test that relation service doesn't require List params to be ArrayList
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean NonArrayListTest
  * @run build NonArrayListTest
  * @run main NonArrayListTest
--- a/jdk/test/javax/management/relation/RelationNotificationSeqNoTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/relation/RelationNotificationSeqNoTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 6701459
  * @summary Test sequence numbers in RelationService notifications.
  * @author Eamonn McManus
- * @modules java.management
  */
 
 /*
--- a/jdk/test/javax/management/relation/RelationNotificationSourceTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/relation/RelationNotificationSourceTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4892674
  * @summary Test that RelationNotification can be constructed with ObjectName.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean RelationNotificationSourceTest
  * @run build RelationNotificationSourceTest
  * @run main RelationNotificationSourceTest
--- a/jdk/test/javax/management/relation/RelationTypeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/relation/RelationTypeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4716675
  * @summary Test that relation type checking uses isInstanceOf
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean RelationTypeTest
  * @run build RelationTypeTest
  * @run main RelationTypeTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/remote/mandatory/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = java.management.rmi
+
--- a/jdk/test/javax/management/remote/mandatory/URLTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/URLTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5057532
  * @summary Tests that host names are parsed correctly in URLs
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean URLTest
  * @run build URLTest
  * @run main URLTest
--- a/jdk/test/javax/management/remote/mandatory/connection/AddressableTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/AddressableTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6238815
  * @summary test the new interface Addressable
  * @author Shanliang JIANG
- * @modules java.management.rmi
+ *
  * @run clean AddressableTest
  * @run build AddressableTest
  * @run main AddressableTest
--- a/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,10 +24,10 @@
 /*
  * @test
  * @bug 4940957 8025205
+ * @key intermittent
  * @summary Tests behaviour when connections break
  * @author Eamonn McManus
- * @key intermittent
- * @modules java.management.rmi
+ *
  * @run clean BrokenConnectionTest
  * @run build BrokenConnectionTest
  * @run main BrokenConnectionTest
--- a/jdk/test/javax/management/remote/mandatory/connection/CloseFailedClientTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/CloseFailedClientTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4921888
  * @summary Tests that we do not get a NullPointException.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean CloseFailedClientTest
  * @run build CloseFailedClientTest
  * @run main CloseFailedClientTest
--- a/jdk/test/javax/management/remote/mandatory/connection/CloseServerTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/CloseServerTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4838640
  * @summary test server close in different conditions.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean CloseServerTest
  * @run build CloseServerTest
  * @run main CloseServerTest
--- a/jdk/test/javax/management/remote/mandatory/connection/CloseUnconnectedTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/CloseUnconnectedTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4897052
  * @summary Tests that opening and immediately closing a connector works
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean CloseUnconnectedTest
  * @run build CloseUnconnectedTest
  * @run main CloseUnconnectedTest
--- a/jdk/test/javax/management/remote/mandatory/connection/CloseableTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/CloseableTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  *          the method "void close() throws IOException;" extend
  *          or implement the java.io.Closeable interface.
  * @author Luis-Miguel Alventosa
- * @modules java.management.rmi
+ *
  * @run clean CloseableTest
  * @run build CloseableTest
  * @run main CloseableTest
--- a/jdk/test/javax/management/remote/mandatory/connection/ConnectionListenerNullTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/ConnectionListenerNullTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4943248
  * @summary Tests that NullPointerException is thrown when listener is null.
  * @author Daniel Fuchs
- * @modules java.management.rmi
+ *
  * @run clean ConnectionListenerNullTest
  * @run build ConnectionListenerNullTest
  * @run main ConnectionListenerNullTest
--- a/jdk/test/javax/management/remote/mandatory/connection/ConnectionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/ConnectionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4865397
  * @summary Tests remote JMX connections
  * @author Eamonn McManus
- * @modules java.management.rmi
+ *
  * @run clean ConnectionTest
  * @run build ConnectionTest
  * @run main ConnectionTest
--- a/jdk/test/javax/management/remote/mandatory/connection/DaemonRMIExporterTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/DaemonRMIExporterTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,7 @@
  * @summary test the connector server option that causes it not to prevent the
  * VM from exiting
  * @author Shanliang JIANG, Eamonn McManus
- * @modules java.management.rmi
+ *
  * @run main/othervm DaemonRMIExporterTest
  */
 import java.util.Arrays;
--- a/jdk/test/javax/management/remote/mandatory/connection/DeadLockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/DeadLockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5039210
  * @summary test on a client notification deadlock.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean DeadLockTest
  * @run build DeadLockTest
  * @run main DeadLockTest
--- a/jdk/test/javax/management/remote/mandatory/connection/FailedConnectionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/FailedConnectionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @bug 4939578
  * @summary test to get an IOException.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean FailedConnectionTest
  * @run build FailedConnectionTest
  * @run main FailedConnectionTest
--- a/jdk/test/javax/management/remote/mandatory/connection/GetConnectionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/GetConnectionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4951414
  * @summary Try to get an IOException.
  * @author Shanliang JIANG
- * @modules java.management.rmi
+ *
  * @run clean GetConnectionTest
  * @run build GetConnectionTest
  * @run main GetConnectionTest
--- a/jdk/test/javax/management/remote/mandatory/connection/IIOPURLTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/IIOPURLTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4886799
  * @summary Check that IIOP URLs have /ior/ in the path
  * @author Eamonn McManus
- * @modules java.management.rmi
+ *
  * @run clean IIOPURLTest
  * @run build IIOPURLTest
  * @run main IIOPURLTest
--- a/jdk/test/javax/management/remote/mandatory/connection/JMXServiceURLLocaleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/JMXServiceURLLocaleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 7065236
  * @summary Test for locale insensitive strings in JMXServiceURL class
  * @author Harsha Wardhana B
- * @modules java.management
+ *
  * @run clean JMXServiceURLLocaleTest
  * @run build JMXServiceURLLocaleTest
  * @run main JMXServiceURLLocaleTest
--- a/jdk/test/javax/management/remote/mandatory/connection/MultiOpenCloseTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/MultiOpenCloseTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 1234567
  * @summary Open, connect then close multi-connectors.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean MultiOpenCloseTest
  * @run build MultiOpenCloseTest
  * @run main MultiOpenCloseTest
--- a/jdk/test/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -45,7 +45,7 @@
  * @bug 6697180
  * @summary test on a client notification deadlock.
  * @author Shanliang JIANG
- * @modules java.management.rmi
+ *
  * @run clean MultiThreadDeadLockTest
  * @run build MultiThreadDeadLockTest
  * @run main MultiThreadDeadLockTest
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIConnectionIdTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnectionIdTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4901808 7183800
  * @summary Check that RMI connection ids include IP address of a client network interface
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean RMIConnectionIdTest
  * @run build RMIConnectionIdTest
  * @run main RMIConnectionIdTest
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIConnectorLogAttributesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnectorLogAttributesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -55,6 +55,9 @@
  * @bug 8147857
  * @summary Tests whether RMIConnector logs attribute names correctly.
  * @author Severin Gehwolf
+ *
+ * @modules java.logging
+ *          java.management.rmi
  */
 public class RMIConnectorLogAttributesTest {
 
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIExitTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIExitTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @bug 4917237
  * @summary test that process exit immediately after stop() / close() called
  * @author Jean Francois Denise
- * @modules java.management.rmi
+ *
  * @run clean RMIExitTest
  * @run build RMIExitTest
  * @run main RMIExitTest
--- a/jdk/test/javax/management/remote/mandatory/connection/RMISerializeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMISerializeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @summary Tests to serialize RMIConnector
  * @bug 5032052
  * @author Shanliang JIANG
- * @modules java.management.rmi
+ *
  * @run clean RMISerializeTest
  * @run build RMISerializeTest
  * @run main RMISerializeTest
--- a/jdk/test/javax/management/remote/mandatory/connection/ReconnectTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connection/ReconnectTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4927217
  * @summary test to reconnect
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean ReconnectTest
  * @run build ReconnectTest
  * @run main ReconnectTest
--- a/jdk/test/javax/management/remote/mandatory/connectorServer/ConnectorStopDeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connectorServer/ConnectorStopDeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
  * @bug 6475157
  * @summary Tests deadlock in simultaneous connection and connector-server close
  * @author Eamonn McManus
- * @modules java.management.rmi
  */
 
 /* This test is somewhat dependent on implementation details.  If it suddenly
--- a/jdk/test/javax/management/remote/mandatory/connectorServer/JNDIFailureTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connectorServer/JNDIFailureTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Tests that JNDI bind failure doesn't leave an orphan RMI
  * Connector Server object
  * @author Eamonn McManus
- * @modules java.management.rmi
+ *
  * @run clean JNDIFailureTest
  * @run build JNDIFailureTest
  * @run main JNDIFailureTest
--- a/jdk/test/javax/management/remote/mandatory/connectorServer/MBSFPreStartPostStartTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/connectorServer/MBSFPreStartPostStartTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that setting an MBeanServerForwarder on an already
  *          started RMI connector server has the expected behavior.
  * @author Luis-Miguel Alventosa
- * @modules java.management.rmi
+ *
  * @run clean MBSFPreStartPostStartTest
  * @run build MBSFPreStartPostStartTest
  * @run main MBSFPreStartPostStartTest
--- a/jdk/test/javax/management/remote/mandatory/loading/DefaultProviderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/loading/DefaultProviderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4884913
  * @summary Tests that default protocols are loaded correctly
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean DefaultProviderTest
  * @run build DefaultProviderTest
  * @run main DefaultProviderTest
--- a/jdk/test/javax/management/remote/mandatory/loading/DeserializeEncodedURLTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/loading/DeserializeEncodedURLTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4924683
  * @summary Check RMI/JRMP stubs can be deserialized using user's loader
  * @author Eamonn McManus
- * @modules java.management.rmi
+ *
  * @run clean DeserializeEncodedURLTest SingleClassLoader
  * @run build DeserializeEncodedURLTest SingleClassLoader
  * @run main DeserializeEncodedURLTest
--- a/jdk/test/javax/management/remote/mandatory/loading/MethodResultTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/loading/MethodResultTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,8 +26,9 @@
  * @bug 4898478
  * @summary Tests client default class loader used before JSR 160 loader
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @library /lib/testlibrary
+ *
  * @run clean MethodResultTest
  * @run build MethodResultTest
  * @run main MethodResultTest
--- a/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,13 +24,13 @@
 /*
  * @test
  * @bug 4915825 4921009 4934965 4977469 8019584
+ * @key randomness
  * @summary Tests behavior when client or server gets object of unknown class
  * @author Eamonn McManus
- * @modules java.management.rmi
+ *
  * @run clean MissingClassTest SingleClassLoader
  * @run build MissingClassTest SingleClassLoader
  * @run main MissingClassTest
- * @key randomness
  */
 
 /*
--- a/jdk/test/javax/management/remote/mandatory/loading/RMIDownloadTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/loading/RMIDownloadTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 5021246
  * @summary Check that class downloading is supported by RMI connector
  * @author Eamonn McManus
- * @modules java.management.rmi
+ *
  * @run main RMIDownloadTest receive without
  * @run main RMIDownloadTest send without
  * @run main RMIDownloadTest receive with
--- a/jdk/test/javax/management/remote/mandatory/loading/TargetMBeanTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/loading/TargetMBeanTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4910428
  * @summary Tests target MBean class loader used before JSR 160 loader
  * @author Eamonn McManus
- * @modules java.management.rmi
+ *
  * @run clean TargetMBeanTest
  * @run build TargetMBeanTest
  * @run main TargetMBeanTest
--- a/jdk/test/javax/management/remote/mandatory/loading/UserClassLoaderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/loading/UserClassLoaderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6356458
  * @summary test to not lose a user classloader
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean UserClassLoaderTest
  * @run build UserClassLoaderTest
  * @run main UserClassLoaderTest
--- a/jdk/test/javax/management/remote/mandatory/notif/AddRemoveTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/AddRemoveTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @bug 4838640 4917194
  * @summary test on add/remove NotificationListener
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean AddRemoveTest
  * @run build AddRemoveTest
  * @run main AddRemoveTest
--- a/jdk/test/javax/management/remote/mandatory/notif/ConcurrentModificationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/ConcurrentModificationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 7120365
  * @summary test on Concurrent Modification
  * @author Shanliang JIANG
- * @modules java.management.rmi
+ *
  * @run main ConcurrentModificationTest
  */
 
--- a/jdk/test/javax/management/remote/mandatory/notif/DiffHBTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/DiffHBTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4911721
  * @summary test on add/remove NotificationListener
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean DiffHBTest
  * @run build DiffHBTest
  * @run main DiffHBTest
--- a/jdk/test/javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Check that the expected notification is received by the JMX
  *          client even when the domain in the ObjectName is not specified
  * @author Shanliang JIANG
- * @modules java.management.rmi
+ *
  * @run clean EmptyDomainNotificationTest
  * @run build EmptyDomainNotificationTest
  * @run main EmptyDomainNotificationTest
--- a/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,9 +26,9 @@
  * @bug 6338874
  * @summary Check that notification dispatch is not linear in number of MBeans.
  * @author Eamonn McManus
- * @modules java.management.rmi
  *
  * @library /lib/testlibrary
+ *
  * @run build jdk.testlibrary.* ListenerScaleTest
  * @run main ListenerScaleTest
  */
--- a/jdk/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,10 +23,10 @@
 
 /*
  * @test
+ * @bug 5022196 8132003
  * @summary Tests to send a not serializable notification.
- * @bug 5022196 8132003
  * @author Shanliang JIANG
- * @modules java.management.rmi
+ *
  * @run clean NotSerializableNotifTest
  * @run build NotSerializableNotifTest
  * @run main NotSerializableNotifTest
--- a/jdk/test/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6174229
  * @summary Verify the property name specifying server notification buffer size.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean NotifBufferSizePropertyNameTest
  * @run build NotifBufferSizePropertyNameTest
  * @run main NotifBufferSizePropertyNameTest
--- a/jdk/test/javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6199899
  * @summary Tests reconnection done by a fetching notif thread.
  * @author Shanliang JIANG
- * @modules java.management.rmi
+ *
  * @run clean NotifReconnectDeadlockTest
  * @run build NotifReconnectDeadlockTest
  * @run main NotifReconnectDeadlockTest
--- a/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferCreationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferCreationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 4934236
  * @summary Tests that NotificationBuffer is created when used.
  * @author jfd@...
- * @modules java.management.rmi
+ *
  * @run clean NotificationBufferCreationTest NotificationSender
  * @run build NotificationBufferCreationTest
  * @run main NotificationBufferCreationTest
--- a/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferDeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferDeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Tests NotificationBuffer doesn't hold locks when adding listeners,
  *  if test times out then deadlock is suspected.
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean NotificationBufferDeadlockTest
  * @run build NotificationBufferDeadlockTest
  * @run main NotificationBufferDeadlockTest
--- a/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,11 +24,11 @@
 /*
  * @test
  * @bug 5106721
+ * @key intermittent
  * @summary Check the emission of notifications when a Security Manager is
  * installed. Test the property "jmx.remote.x.check.notification.emission".
  * @author Luis-Miguel Alventosa
- * @key intermittent
- * @modules java.management.rmi
+ *
  * @run clean NotificationEmissionTest
  * @run build NotificationEmissionTest
  * @run main NotificationEmissionTest 1
--- a/jdk/test/javax/management/remote/mandatory/notif/RMINotifTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/RMINotifTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,9 +25,8 @@
  * @test
  * @bug 7654321
  * @summary Tests to receive notifications for opened and closed connections
-ions
  * @author sjiang
- * @modules java.management.rmi
+ *
  * @run clean RMINotifTest
  * @run build RMINotifTest
  * @run main RMINotifTest
--- a/jdk/test/javax/management/remote/mandatory/notif/ServerNotifs.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/ServerNotifs.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Tests the reception of the notifications for opened and closed
  * connections
  * @author sjiang
- * @modules java.management.rmi
+ *
  * @run clean ServerNotifs
  * @run build ServerNotifs
  * @run main ServerNotifs
--- a/jdk/test/javax/management/remote/mandatory/notif/UnexpectedNotifTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/notif/UnexpectedNotifTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Tests whether a listener receives notifs emitted before the
  * listener is registered.
  * @author Shanliang JIANG
- * @modules java.management.rmi
+ *
  * @run clean UnexpectedNotifTest
  * @run build UnexpectedNotifTest
  * @run main UnexpectedNotifTest
--- a/jdk/test/javax/management/remote/mandatory/passwordAccessFile/NonJMXPrincipalsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/passwordAccessFile/NonJMXPrincipalsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Tests that MBeanServerFileAccessController supports
  *          principals other than JMXPrincipal.
  * @author Luis-Miguel Alventosa
- * @modules java.management.rmi
+ *
  * @run clean NonJMXPrincipalsTest SimpleStandard SimpleStandardMBean
  * @run build NonJMXPrincipalsTest SimpleStandard SimpleStandardMBean
  * @run main NonJMXPrincipalsTest
--- a/jdk/test/javax/management/remote/mandatory/passwordAccessFile/PasswordAccessFileTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/passwordAccessFile/PasswordAccessFileTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Tests the use of the "jmx.remote.x.password.file" and
  *          "jmx.remote.x.access.file" environment map properties.
  * @author Luis-Miguel Alventosa
- * @modules java.management.rmi
+ *
  * @run clean PasswordAccessFileTest SimpleStandard SimpleStandardMBean
  * @run build PasswordAccessFileTest SimpleStandard SimpleStandardMBean
  * @run main PasswordAccessFileTest
--- a/jdk/test/javax/management/remote/mandatory/provider/ProviderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/provider/ProviderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,7 +24,7 @@
 /*
  * @test ProviderTest.java
  * @summary Tests jar services provider are called
- * @modules java.management.rmi
+ *
  * @run clean ProviderTest provider.JMXConnectorProviderImpl provider.JMXConnectorServerProviderImpl
  * @run build ProviderTest provider.JMXConnectorProviderImpl provider.JMXConnectorServerProviderImpl
  * @run main ProviderTest
--- a/jdk/test/javax/management/remote/mandatory/socketFactories/RMISocketFactoriesTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/socketFactories/RMISocketFactoriesTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 7654321
  * @summary Tests the use of the custom RMI socket factories.
  * @author Luis-Miguel Alventosa
- * @modules java.management.rmi
+ *
  * @run clean RMISocketFactoriesTest
  * @run build RMISocketFactoriesTest RMIClientFactory RMIServerFactory
  * @run main RMISocketFactoriesTest test_server_factory
--- a/jdk/test/javax/management/remote/mandatory/threads/ExecutorShutdownTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/threads/ExecutorShutdownTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 8141591
  * @summary Tests if notifications are received after executor is shutdown
  * @author Harsha Wardhana B
- * @modules java.management
+ *
  * @run clean ExecutorShutdownTest
  * @run build ExecutorShutdownTest
  * @run main ExecutorShutdownTest
--- a/jdk/test/javax/management/remote/mandatory/threads/ExecutorTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/threads/ExecutorTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6190873
  * @summary Tests that thread creation can use a user-supplied Executor
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean ExecutorTest
  * @run build ExecutorTest
  * @run main ExecutorTest
--- a/jdk/test/javax/management/remote/mandatory/threads/NoServerTimeoutTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/threads/NoServerTimeoutTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6192124
  * @summary Tests that you can turn off the server connection timeout thread
  * @author Eamonn McManus
- * @modules java.management
+ *
  * @run clean NoServerTimeoutTest
  * @run build NoServerTimeoutTest
  * @run main NoServerTimeoutTest
--- a/jdk/test/javax/management/remote/mandatory/version/ImplVersionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/remote/mandatory/version/ImplVersionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -29,7 +29,7 @@
  * test codebase has the java permission to read the "java.runtime.version"
  * system property.
  * @author Luis-Miguel Alventosa, Joel Feraud
- * @modules java.management
+ *
  * @run clean ImplVersionTest ImplVersionCommand
  * @run build ImplVersionTest ImplVersionCommand ImplVersionReader
  * @run main ImplVersionTest
--- a/jdk/test/javax/management/security/AvoidGetMBeanInfoCallsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/security/AvoidGetMBeanInfoCallsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Test that MBeanServer.queryNames doesn't call getMBeanInfo on every
  *          resultant MBean when there is no security manager installed.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean AvoidGetMBeanInfoCallsTest
  * @run build AvoidGetMBeanInfoCallsTest
  * @run main AvoidGetMBeanInfoCallsTest
--- a/jdk/test/javax/management/security/MBeanPermissionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/security/MBeanPermissionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6228749
  * @summary MBeanPermission(null,"") should throw IllegalArgumentException.
  * @author Luis-Miguel Alventosa
- * @modules java.management
+ *
  * @run clean MBeanPermissionTest
  * @run build MBeanPermissionTest
  * @run main MBeanPermissionTest
--- a/jdk/test/javax/management/standardmbean/DeadlockTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/standardmbean/DeadlockTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6331746
  * @summary Test a deadlock and will be blocked forever if the deadlock is present.
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run main DeadlockTest
  */
 
--- a/jdk/test/javax/management/timer/MissingNotificationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/timer/MissingNotificationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,13 +24,13 @@
 /*
  * @test
  * @bug 6809322
+ * @key randomness
  * @summary Test for missing notifications in a high concurrency environment
  * @author Jaroslav Bachorik
- * @modules java.management
+ *
  * @run clean MissingNotificationTest
  * @run build MissingNotificationTest
  * @run main MissingNotificationTest
- * @key randomness
  */
 
 import java.util.Date;
--- a/jdk/test/javax/management/timer/StartTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/management/timer/StartTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug 6659215
  * @summary Test on timer start method with past notifications
  * @author Shanliang JIANG
- * @modules java.management
+ *
  * @run clean StartTest
  * @run build StartTest
  * @run main StartTest
--- a/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java	Mon Apr 10 08:31:37 2017 -0700
@@ -39,7 +39,6 @@
 import com.sun.org.apache.xml.internal.serializer.EncodingInfo;
 import com.sun.org.apache.xml.internal.serializer.Encodings;
 import java.io.InputStreamReader;
-import java.lang.reflect.Module;
 import java.lang.reflect.Method;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
--- a/jdk/test/jdk/internal/jimage/JImageOpenTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/internal/jimage/JImageOpenTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -21,7 +21,6 @@
  * questions.
  */
 
-import java.lang.reflect.Layer;
 import java.net.URI;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
@@ -48,7 +47,7 @@
 
         final List<String> names = Files.walk(root)
                 .filter(p -> p.getNameCount() > 2)
-                .filter(p -> Layer.boot().findModule(p.getName(1).toString()).isPresent())
+                .filter(p -> ModuleLayer.boot().findModule(p.getName(1).toString()).isPresent())
                 .map(p -> p.subpath(2, p.getNameCount()))
                 .map(p -> p.toString())
                 .filter(s -> s.endsWith(".class") && !s.endsWith("module-info.class"))
--- a/jdk/test/jdk/internal/util/jar/TestVersionedStream.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/internal/util/jar/TestVersionedStream.java	Mon Apr 10 08:31:37 2017 -0700
@@ -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
@@ -40,7 +40,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UncheckedIOException;
-import java.net.URI;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -168,23 +167,23 @@
 
             // verify the contents
             Map<String,String> contents = new HashMap<>();
-            contents.put("p/Bar.class", "base/p/Bar.class\n");
-            contents.put("p/Main.class", "base/p/Main.class\n");
+            contents.put("p/Bar.class", "base/p/Bar.class");
+            contents.put("p/Main.class", "base/p/Main.class");
             switch (version.major()) {
                 case 8:
-                    contents.put("p/Foo.class", "base/p/Foo.class\n");
+                    contents.put("p/Foo.class", "base/p/Foo.class");
                     break;
                 case 9:
-                    contents.put("p/Foo.class", "v9/p/Foo.class\n");
+                    contents.put("p/Foo.class", "v9/p/Foo.class");
                     break;
                 case 10:
-                    contents.put("p/Foo.class", "v10/p/Foo.class\n");
-                    contents.put("q/Bar.class", "v10/q/Bar.class\n");
+                    contents.put("p/Foo.class", "v10/p/Foo.class");
+                    contents.put("q/Bar.class", "v10/q/Bar.class");
                     break;
                 case 11:
-                    contents.put("p/Bar.class", "v11/p/Bar.class\n");
-                    contents.put("p/Foo.class", "v11/p/Foo.class\n");
-                    contents.put("q/Bar.class", "v10/q/Bar.class\n");
+                    contents.put("p/Bar.class", "v11/p/Bar.class");
+                    contents.put("p/Foo.class", "v11/p/Foo.class");
+                    contents.put("q/Bar.class", "v10/q/Bar.class");
                     break;
                 default:
                     Assert.fail("Test out of date, please add more cases");
@@ -196,7 +195,7 @@
                 Assert.assertTrue(i != -1, name + " not in enames");
                 JarEntry je = versionedEntries.get(i);
                 try (InputStream is = jf.getInputStream(je)) {
-                    String s = new String(is.readAllBytes());
+                    String s = new String(is.readAllBytes()).replaceAll(System.lineSeparator(), "");
                     Assert.assertTrue(s.endsWith(e.getValue()), s);
                 } catch (IOException x) {
                     throw new UncheckedIOException(x);
@@ -208,16 +207,13 @@
     private void createFiles(String... files) {
         ArrayList<String> list = new ArrayList();
         Arrays.stream(files)
-                .map(f -> "file:///" + userdir + "/" + f)
-                .map(f -> URI.create(f))
-                .filter(u -> u != null)
-                .map(u -> Paths.get(u))
+                .map(f -> Paths.get(userdir.toAbsolutePath().toString(), f))
                 .forEach(p -> {
                     try {
                         Files.createDirectories(p.getParent());
                         Files.createFile(p);
                         list.clear();
-                        list.add(p.toString());
+                        list.add(p.toString().replace(File.separatorChar, '/'));
                         Files.write(p, list);
                     } catch (IOException x) {
                         throw new UncheckedIOException(x);
--- a/jdk/test/jdk/modules/etc/JdkQualifiedExportTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/etc/JdkQualifiedExportTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -40,7 +40,6 @@
 import java.lang.module.ModuleDescriptor.Opens;
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReference;
-import java.lang.reflect.Module;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
--- a/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,8 +31,6 @@
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReference;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.Set;
 import static java.util.stream.Collectors.toSet;
 
@@ -49,7 +47,7 @@
         = ModuleDescriptor.newModule(JAVA_BASE).build();
 
     private static final Set<ModuleDescriptor> MREFS
-            = Layer.boot().modules().stream().map(Module::getDescriptor)
+            = ModuleLayer.boot().modules().stream().map(Module::getDescriptor)
                 .collect(toSet());
 
     private void check(ModuleDescriptor md, ModuleDescriptor ref) {
@@ -69,7 +67,7 @@
 
     @Test
     public void checkLoaderDelegation() {
-        Layer boot = Layer.boot();
+        ModuleLayer boot = ModuleLayer.boot();
         MREFS.stream()
              .forEach(md -> md.requires().stream().forEach(req ->
                  {
--- a/jdk/test/jdk/modules/incubator/DefaultImage.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/incubator/DefaultImage.java	Mon Apr 10 08:31:37 2017 -0700
@@ -34,6 +34,9 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -41,13 +44,13 @@
 import java.util.stream.Stream;
 
 import org.testng.annotations.BeforeTest;
-import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static jdk.testlibrary.ProcessTools.executeCommand;
 import static org.testng.Assert.*;
 
+@Test
 public class DefaultImage {
     private static final String JAVA_HOME = System.getProperty("java.home");
     private static final Path TEST_SRC = Paths.get(System.getProperty("test.src"));
@@ -72,19 +75,13 @@
             .resultChecker(r -> r.assertOutputDoesNotContain("jdk.incubator"));
     }
 
-    @DataProvider(name = "tokens")
-    public Object[][] singleModuleValues() throws IOException {
-        return new Object[][]{ { "ALL-DEFAULT" }, { "ALL-SYSTEM"} };
-    }
-
-    @Test(dataProvider = "tokens")
-    public void testAddMods(String addModsToken) throws Throwable {
+    public void testAllDefault() throws Throwable {
         if (isExplodedBuild()) {
             System.out.println("Test cannot run on exploded build");
             return;
         }
 
-        java("--add-modules", addModsToken,
+        java("--add-modules", "ALL-DEFAULT",
              "-cp", CP_DIR.toString(),
              "listmods.ListModules")
             .assertSuccess()
@@ -92,6 +89,22 @@
             .resultChecker(r -> r.assertOutputDoesNotContain("jdk.incubator"));
     }
 
+    public void testAllSystem() throws Throwable {
+        if (isExplodedBuild()) {
+            System.out.println("Test cannot run on exploded build");
+            return;
+        }
+
+        if (containsAnyIncubatorModules()) {
+            java("--add-modules", "ALL-SYSTEM",
+                 "-cp", CP_DIR.toString(),
+                 "listmods.ListModules")
+                .assertSuccess()
+                .resultChecker(r -> r.assertOutputContains("java.base"))
+                .resultChecker(r -> r.assertOutputContains("jdk.incubator"));
+        }
+    }
+
     static ToolResult java(String... opts) throws Throwable {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         PrintStream ps = new PrintStream(baos);
@@ -155,4 +168,14 @@
         Path modulesPath = Paths.get(JAVA_HOME).resolve("lib").resolve("modules");
         return Files.notExists(modulesPath);
     }
+
+    static boolean containsAnyIncubatorModules() {
+        return ModuleFinder.ofSystem().findAll().stream()
+                .map(ModuleReference::descriptor)
+                .map(ModuleDescriptor::name)
+                .filter(mn -> mn.startsWith("jdk.incubator"))
+                .map(mn -> true)
+                .findAny()
+                .orElse(false);
+    }
 }
--- a/jdk/test/jdk/modules/incubator/ImageModules.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/incubator/ImageModules.java	Mon Apr 10 08:31:37 2017 -0700
@@ -98,7 +98,7 @@
               List.of("hello world", "message.converter", "java.base"),
               List.of("WARNING") },
             { "--do-not-resolve-by-default",
-              List.of("ALL-DEFAULT", "ALL-SYSTEM"),
+              List.of("ALL-DEFAULT"),
               ToolResult.ASSERT_FAILURE,
               List.of("java.base", "java.lang.ClassNotFoundException: converter.MessageConverter"),
               List.of("WARNING", "message.converter") },
@@ -109,7 +109,7 @@
                       "WARNING: Using incubator modules: message.converter"),
               List.of() },
             { "--do-not-resolve-by-default --warn-if-resolved=incubating",
-              List.of("ALL-DEFAULT", "ALL-SYSTEM"),
+              List.of("ALL-DEFAULT"),
               ToolResult.ASSERT_FAILURE,
               List.of("java.base", "java.lang.ClassNotFoundException: converter.MessageConverter"),
               List.of("WARNING", "message.converter") },
@@ -215,13 +215,13 @@
               List.of() },
             { "--do-not-resolve-by-default",
               "",
-              List.of("ALL-DEFAULT", "ALL-SYSTEM"),
+              List.of("ALL-DEFAULT"),
               ToolResult.ASSERT_FAILURE,
               List.of("java.lang.ClassNotFoundException: writer.MessageWriter", "java.base"),
               List.of("message.writer") },
             { "--do-not-resolve-by-default",
               "--do-not-resolve-by-default",
-              List.of("ALL-DEFAULT", "ALL-SYSTEM"),
+              List.of("ALL-DEFAULT"),
               ToolResult.ASSERT_FAILURE,
               List.of("java.lang.ClassNotFoundException: writer.MessageWriter", "java.base"),
               List.of("message.converter", "message.writer") },
@@ -239,7 +239,8 @@
               ToolResult.ASSERT_SUCCESS,
               List.of("HELLO CHEGAR !!!", "message.writer", "message.converter", "java.base",
                       "WARNING: Using incubator modules: message.converter"),
-              List.of() } };
+              List.of() }
+            };
         return values;
     }
 
--- a/jdk/test/jdk/modules/incubator/src/cp/listmods/ListModules.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/incubator/src/cp/listmods/ListModules.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,13 +23,11 @@
 
 package listmods;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import static java.util.stream.Collectors.joining;
 
 public class ListModules {
     public static void main(String[] args) throws Exception {
-        System.out.println(Layer.boot()
+        System.out.println(ModuleLayer.boot()
                                 .modules()
                                 .stream()
                                 .map(Module::getName)
--- a/jdk/test/jdk/modules/incubator/src/cp/test/ConvertToLowerCase.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/incubator/src/cp/test/ConvertToLowerCase.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,13 +23,11 @@
 
 package test;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import static java.util.stream.Collectors.joining;
 
 public class ConvertToLowerCase {
     public static void main(String[] args) {
-        System.out.println(Layer.boot()
+        System.out.println(ModuleLayer.boot()
                                 .modules()
                                 .stream()
                                 .map(Module::getName)
--- a/jdk/test/jdk/modules/incubator/src/cp/test/WriteUpperCase.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/incubator/src/cp/test/WriteUpperCase.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,13 +23,11 @@
 
 package test;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import static java.util.stream.Collectors.joining;
 
 public class WriteUpperCase {
     public static void main(String[] args) {
-        System.out.println(Layer.boot()
+        System.out.println(ModuleLayer.boot()
                                 .modules()
                                 .stream()
                                 .map(Module::getName)
--- a/jdk/test/jdk/modules/open/Basic.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/open/Basic.java	Mon Apr 10 08:31:37 2017 -0700
@@ -36,7 +36,6 @@
 import java.lang.module.ModuleDescriptor;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InaccessibleObjectException;
-import java.lang.reflect.Module;
 
 import org.testng.annotations.Test;
 import org.testng.annotations.BeforeTest;
--- a/jdk/test/jdk/modules/scenarios/automaticmodules/src/basictest/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/scenarios/automaticmodules/src/basictest/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,9 +23,6 @@
 
 package test;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
-
 import http.HttpServer;
 
 /**
@@ -47,8 +44,8 @@
         cl = ClassLoader.getSystemClassLoader();
         assertTrue(httpModule.canRead(cl.getUnnamedModule()));
 
-        // and read all modules in the boot Layer
-        Layer layer = Layer.boot();
+        // and read all modules in the boot layer
+        ModuleLayer layer = ModuleLayer.boot();
         layer.modules().forEach(m -> assertTrue(httpModule.canRead(m)));
 
         // run code in the automatic modue, ensures access is allowed
--- a/jdk/test/jdk/modules/scenarios/automaticmodules/src/sptest/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/scenarios/automaticmodules/src/sptest/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,8 +26,6 @@
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleDescriptor.Requires;
 import java.lang.module.ModuleDescriptor.Provides;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.Map;
 import java.util.Optional;
 import java.util.ServiceLoader;
@@ -36,7 +34,7 @@
 import javax.script.ScriptEngineFactory;
 
 /**
- * Test that the automatic module "bananascript" is in the boot Layer and
+ * Test that the automatic module "bananascript" is in the boot layer and
  * it behaves as a service provider.
  */
 
@@ -44,7 +42,7 @@
 
     public static void main(String[] args) throws Exception {
 
-        Optional<Module> om = Layer.boot().findModule("bananascript");
+        Optional<Module> om = ModuleLayer.boot().findModule("bananascript");
         assertTrue(om.isPresent());
 
         ModuleDescriptor descriptor = om.get().getDescriptor();
--- a/jdk/test/jdk/modules/scenarios/container/src/container/container/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/jdk/modules/scenarios/container/src/container/container/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,9 +27,7 @@
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Set;
@@ -43,7 +41,7 @@
     public static void main(String[] args) throws Exception {
 
         System.out.println("Boot layer");
-        Layer.boot()
+        ModuleLayer.boot()
              .modules()
              .stream()
              .map(Module::getName)
@@ -70,7 +68,7 @@
 
         ModuleFinder finder = ModuleFinder.of(paths);
 
-        Configuration cf = Layer.boot().configuration()
+        Configuration cf = ModuleLayer.boot().configuration()
             .resolveAndBind(finder,
                             ModuleFinder.of(),
                             Set.of(appModuleName));
@@ -81,9 +79,9 @@
           .sorted()
           .forEach(mn -> System.out.format("  %s%n", mn));
 
-        // reify the configuration as a Layer
+        // reify the configuration as a module layer
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl);
+        ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl);
 
         // invoke application main method
         ClassLoader loader = layer.findLoader(appModuleName);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/jvmstat/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = jdk.internal.jvmstat/sun.jvmstat.monitor
+
--- a/jdk/test/sun/jvmstat/monitor/HostIdentifier/HostIdentifierCreate.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/jvmstat/monitor/HostIdentifier/HostIdentifierCreate.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,8 +24,10 @@
 /*
  * @test
  * @bug 4990825
- * @modules jdk.internal.jvmstat/sun.jvmstat.monitor
  * @summary test that HostIdentifier objects get created as expected
+ *
+ * @modules java.xml
+ *          jdk.internal.jvmstat/sun.jvmstat.monitor
  */
 
 import java.io.*;
--- a/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java	Mon Apr 10 08:31:37 2017 -0700
@@ -40,9 +40,10 @@
  * @test
  * @bug 6672135
  * @summary setInterval() for local MonitoredHost and local MonitoredVm
- * @modules jdk.internal.jvmstat/sun.jvmstat.monitor
+ *
  * @library /lib/testlibrary
  * @library /test/lib
+ *
  * @build jdk.testlibrary.*
  * @build jdk.test.lib.apps.*
  * @run main TestPollingInterval
--- a/jdk/test/sun/jvmstat/monitor/VmIdentifier/VmIdentifierCreateResolve.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/jvmstat/monitor/VmIdentifier/VmIdentifierCreateResolve.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,8 +24,10 @@
 /*
  * @test
  * @bug 4990825
- * @modules jdk.internal.jvmstat/sun.jvmstat.monitor
  * @summary test that VmIdentifier objects get created as expected
+ *
+ * @modules java.xml
+ *          jdk.internal.jvmstat/sun.jvmstat.monitor
  */
 
 import java.io.*;
--- a/jdk/test/sun/jvmstat/perfdata/PrologSanity/PrologSizeSanityCheck.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/jvmstat/perfdata/PrologSanity/PrologSizeSanityCheck.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,9 +24,9 @@
 /*
  * @test
  * @bug 4990825
- * @modules jdk.internal.jvmstat/sun.jvmstat.monitor
+ * @summary prolog size and overflow sanity checks
+ *
  * @run main/othervm -XX:+UsePerfData PrologSizeSanityCheck
- * @summary prolog size and overflow sanity checks
  */
 
 import sun.jvmstat.monitor.*;
--- a/jdk/test/sun/management/HotspotClassLoadingMBean/GetClassInitializationTime.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/HotspotClassLoadingMBean/GetClassInitializationTime.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug     4858522
  * @summary Basic unit test of HotspotClassLoadingMBean.getClassInitializationTime()
  * @author  Steve Bohne
- * @modules java.management/sun.management
+ *
  * @run main/othervm -XX:+UsePerfData GetClassInitializationTime
  */
 
--- a/jdk/test/sun/management/HotspotClassLoadingMBean/GetClassLoadingTime.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/HotspotClassLoadingMBean/GetClassLoadingTime.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug     4858522
  * @summary Basic unit test of HotspotClassLoadingMBean.getClassLoadingTime()
  * @author  Steve Bohne
- * @modules java.management/sun.management
+ *
  * @build ClassToLoad0
  * @run main/othervm -XX:+UsePerfData GetClassLoadingTime
  */
--- a/jdk/test/sun/management/HotspotClassLoadingMBean/GetInitializedClassCount.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/HotspotClassLoadingMBean/GetInitializedClassCount.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug     4858522
  * @summary Basic unit test of HotspotClassLoadingMBean.getInitializedClassCount()
  * @author  Steve Bohne
- * @modules java.management/sun.management
+ *
  * @run main/othervm -XX:+UsePerfData GetInitializedClassCount
  */
 
--- a/jdk/test/sun/management/HotspotClassLoadingMBean/GetLoadedClassSize.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/HotspotClassLoadingMBean/GetLoadedClassSize.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug     4858522
  * @summary Basic unit test of HotspotClassLoadingMBean.getLoadedClassSize()
  * @author  Steve Bohne
- * @modules java.management/sun.management
+ *
  * @run main/othervm -XX:+UsePerfData GetLoadedClassSize
  */
 
--- a/jdk/test/sun/management/HotspotClassLoadingMBean/GetMethodDataSize.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/HotspotClassLoadingMBean/GetMethodDataSize.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug     4858522
  * @summary Basic unit test of HotspotClassLoadingMBean.getMethodDataSize()
  * @author  Steve Bohne
- * @modules java.management/sun.management
+ *
  * @run main/othervm -XX:+UsePerfData GetMethodDataSize
  */
 
--- a/jdk/test/sun/management/HotspotClassLoadingMBean/GetUnloadedClassSize.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/HotspotClassLoadingMBean/GetUnloadedClassSize.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug     4858522
  * @summary Basic unit test of HotspotClassLoadingMBean.getUnloadedClassSize()
  * @author  Steve Bohne
- * @modules java.management/sun.management
+ *
  * @run main/othervm -XX:+UsePerfData GetUnloadedClassSize
  */
 
--- a/jdk/test/sun/management/HotspotRuntimeMBean/GetSafepointCount.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/HotspotRuntimeMBean/GetSafepointCount.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug     4858522
  * @summary Basic unit test of HotspotClassLoadingMBean.getSafepointCount()
  * @author  Steve Bohne
- * @modules java.management/sun.management
+ *
  * @run main/othervm -XX:+UsePerfData GetSafepointCount
  */
 
--- a/jdk/test/sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,7 @@
  * @bug     4858522
  * @summary Basic unit test of HotspotRuntimeMBean.getSafepointSyncTime()
  * @author  Steve Bohne
- * @modules java.management/sun.management
+ *
  * @run main/othervm -XX:+UsePerfData GetSafepointSyncTime
  */
 
--- a/jdk/test/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,8 +24,8 @@
 /*
  * @test
  * @bug     4858522
- * @modules java.management/sun.management
  * @summary Basic unit test of HotspotRuntimeMBean.getTotalSafepointTime()
+ *
  * @run main/othervm -XX:+UsePerfData GetTotalSafepointTime
  */
 
--- a/jdk/test/sun/management/HotspotThreadMBean/GetInternalThreads.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/HotspotThreadMBean/GetInternalThreads.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,7 @@
  * @summary Basic Test for HotspotThreadMBean.getInternalThreadCount()
  *          and getInternalThreadCpuTime()
  * @author  Mandy Chung
- * @modules java.management/sun.management
+ *
  * @run main/othervm -XX:+UsePerfData GetInternalThreads
  */
 
--- a/jdk/test/sun/management/LazyCompositeDataTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/LazyCompositeDataTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -36,7 +36,6 @@
  * @test
  * @bug 8139870
  * @summary sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
- * @modules java.management/sun.management
  * @author Jaroslav Bachorik
  */
 
@@ -160,4 +159,5 @@
         }
         System.out.println("=== PASSED");
     }
-}
\ No newline at end of file
+}
+
--- a/jdk/test/sun/management/LoggingTest/LoggingWithJULTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/LoggingTest/LoggingWithJULTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,11 +26,14 @@
 /**
  * @test
  * @bug 8172971
- * @modules java.management java.logging
  * @summary Smoke test to check that logging in java.management works as expected.
+ * @author danielfuchs
+ *
+ * @modules java.management
+ *          java.logging
+ *
  * @build LoggingTest LoggingWithJULTest
  * @run main/othervm LoggingWithJULTest
- * @author danielfuchs
  */
 public class LoggingWithJULTest {
 
--- a/jdk/test/sun/management/LoggingTest/LoggingWithLoggerFinderTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/LoggingTest/LoggingWithLoggerFinderTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,13 +24,13 @@
 /**
  * @test
  * @bug 8172971
- * @modules java.management
  * @summary Smoke test to check that logging in java.management is performed
  *          through System.Logger. This test installs a LoggerFinder service
  *          provider and verifies that it gets the traces.
+ * @author danielfuchs
+ *
  * @build test.loggerfinder/test.loggerfinder.TestLoggerFinder LoggingTest LoggingWithLoggerFinderTest
  * @run main/othervm --add-modules test.loggerfinder LoggingWithLoggerFinderTest
- * @author danielfuchs
  */
 public class LoggingWithLoggerFinderTest {
 
--- a/jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
 import java.lang.System.Logger;
 import java.lang.System.Logger.Level;
 import java.lang.System.LoggerFinder;
-import java.lang.reflect.Module;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Optional;
--- a/jdk/test/sun/management/StackTraceElementCompositeData/CompatibilityTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/StackTraceElementCompositeData/CompatibilityTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -15,9 +15,9 @@
  * @test
  * @bug     8139587
  * @summary Check backward compatibility of StackTraceElementCompositeData
- * @modules java.management/sun.management
+ * @author  Jaroslav Bachorik
+ *
  * @run testng CompatibilityTest
- * @author  Jaroslav Bachorik
  */
 
 public class CompatibilityTest {
@@ -69,4 +69,5 @@
         assertNull(ste.getModuleName());
         assertNull(ste.getModuleVersion());
     }
-}
\ No newline at end of file
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = java.management/sun.management
+
--- a/jdk/test/sun/management/jdp/JdpDefaultsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jdp/JdpDefaultsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,8 +30,9 @@
 /*
  * @test JdpDefaultsTest
  * @summary Assert that we can read JDP packets from a multicast socket connection, on default IP and port.
+ *
  * @library /lib/testlibrary
- * @modules jdk.management.agent/sun.management.jdp
+ *
  * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
  * @run main/othervm JdpDefaultsTest
  */
--- a/jdk/test/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,14 +22,15 @@
  */
 
 /**
- *  @test JdpJmxRemoteDynamicPortTest.java
- *  @bug 8167337
- *  @summary Verify a non-zero value is assigned to jmxremote.port
- *           when VM is started with jmxremote.port=0.
- *  @library /lib/testlibrary
- *  @modules jdk.management.agent/sun.management.jdp
- *  @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpJmxRemoteDynamicPortTestCase DynamicLauncher
- *  @run main/othervm JdpJmxRemoteDynamicPortTest
+ * @test JdpJmxRemoteDynamicPortTest.java
+ * @bug 8167337
+ * @summary Verify a non-zero value is assigned to jmxremote.port
+ *          when VM is started with jmxremote.port=0.
+ *
+ * @library /lib/testlibrary
+ *
+ * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpJmxRemoteDynamicPortTestCase DynamicLauncher
+ * @run main/othervm JdpJmxRemoteDynamicPortTest
  */
 
 import java.lang.management.ManagementFactory;
--- a/jdk/test/sun/management/jdp/JdpOffTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jdp/JdpOffTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -31,8 +31,9 @@
 /*
  * @test JdpOffTest.java
  * @summary Assert that no JDP packets are sent to the default address and port.
+ *
  * @library /lib/testlibrary
- * @modules jdk.management.agent/sun.management.jdp
+ *
  * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOffTestCase DynamicLauncher
  * @run main/othervm JdpOffTest
  */
--- a/jdk/test/sun/management/jdp/JdpSpecificAddressTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jdp/JdpSpecificAddressTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,8 +30,9 @@
 /*
  * @test JdpSpecificAddressTest
  * @summary Assert that we can read JDP packets from a multicast socket connection, on specific IP and port.
+ *
  * @library /lib/testlibrary
- * @modules jdk.management.agent/sun.management.jdp
+ *
  * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
  * @run main/othervm JdpSpecificAddressTest
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/jdp/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,3 @@
+modules = jdk.management.agent/sun.management.jdp \
+          java.logging
+
--- a/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,15 +22,14 @@
  */
 
 /**
- *  @test LocalRMIServerSocketFactoryTest.java
- *  @bug 6774170
- *  @summary Connect to a server socket returned by the LocalRMIServerSocketFactory.
+ * @test LocalRMIServerSocketFactoryTest.java
+ * @bug 6774170
+ * @summary Connect to a server socket returned by the LocalRMIServerSocketFactory.
  *
- *  @author Daniel Fuchs
+ * @author Daniel Fuchs
  *
- *  @modules jdk.management.agent/sun.management.jmxremote
- *  @run compile -XDignore.symbol.file=true -g LocalRMIServerSocketFactoryTest.java
- *  @run main LocalRMIServerSocketFactoryTest
+ * @run compile -XDignore.symbol.file=true -g LocalRMIServerSocketFactoryTest.java
+ * @run main LocalRMIServerSocketFactoryTest
  */
 
 import sun.management.jmxremote.LocalRMIServerSocketFactory;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/jmxremote/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,3 @@
+modules = jdk.management.agent/jdk.internal.agent \
+          jdk.management.agent/sun.management.jmxremote
+
--- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -40,12 +40,16 @@
 /**
  * @test
  * @bug 6434402 8004926
+ * @author Jaroslav Bachorik
+ *
  * @library /lib/testlibrary
- * @modules jdk.management.agent/jdk.internal.agent
+ * @modules java.management
+ *          jdk.attach
+ *          jdk.management.agent/jdk.internal.agent
+ *
  * @build jdk.testlibrary.*
  * @build TestManager TestApplication CustomLauncherTest
  * @run main/othervm CustomLauncherTest
- * @author Jaroslav Bachorik
  */
 public class CustomLauncherTest {
     private static final  String TEST_CLASSPATH = System.getProperty("test.class.path");
--- a/jdk/test/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -48,9 +48,9 @@
  * @summary Test JMX agent host address binding. Same ports but different
  *          interfaces to bind to (using plain sockets and SSL sockets).
  *
- * @modules jdk.management.agent/jdk.internal.agent
- *          jdk.management.agent/sun.management.jmxremote
  * @library /lib/testlibrary
+ * @modules java.management.rmi
+ *
  * @build jdk.testlibrary.* JMXAgentInterfaceBinding
  * @run main/timeout=5 JMXInterfaceBindingTest
  */
--- a/jdk/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,11 @@
  * @summary Tests that the jvmstat counters published by the out-of-the-box
  *          management agent for the JMX connection details are correct.
  * @author Luis-Miguel Alventosa
- * @modules jdk.management.agent/jdk.internal.agent
+ *
+ * @modules java.management
+ *          jdk.attach
+ *          jdk.management.agent/jdk.internal.agent
+ *
  * @run clean JvmstatCountersTest
  * @run build JvmstatCountersTest
  * @run main/othervm/timeout=600 -XX:+UsePerfData JvmstatCountersTest 1
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -32,13 +32,17 @@
 
 /**
  * @test
- * @library /lib/testlibrary
  * @bug 5016507 6173612 6319776 6342019 6484550 8004926
  * @summary Start a managed VM and test that a management tool can connect
  *          without connection or username/password details.
  *          TestManager will attempt a connection to the address obtained from
  *          both agent properties and jvmstat buffer.
- * @modules jdk.management.agent/jdk.internal.agent
+ *
+ * @library /lib/testlibrary
+ * @modules java.management
+ *          jdk.attach
+ *          jdk.management.agent/jdk.internal.agent
+ *
  * @build jdk.testlibrary.* TestManager TestApplication
  * @run main/othervm/timeout=300 LocalManagementTest
  */
--- a/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,14 +25,14 @@
 
 /**
  * @test
- * @library /lib/testlibrary
  * @bug 6557093
  * @summary Check SSL config file permission for out-of-the-box management
- * @modules jdk.management.agent
+ * @author Taras Ledkov
+ *
+ * @library /lib/testlibrary
+ *
  * @build jdk.testlibrary.* AbstractFilePermissionTest Dummy
  * @run main/timeout=300 PasswordFilePermissionTest
- *
- * @author Taras Ledkov
  */
 public class PasswordFilePermissionTest extends AbstractFilePermissionTest {
 
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -24,12 +24,11 @@
 #
 # @test
 # @bug     6528083
+# @key intermittent
 # @summary Test RMI Bootstrap
 #
-# @key intermittent
 # @library /lib/testlibrary
-# @modules jdk.management.agent/jdk.internal.agent
-#          jdk.management.agent/sun.management.jmxremote
+#
 # @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
 # @run shell/timeout=300  RmiBootstrapTest.sh
 
@@ -44,7 +43,7 @@
 
 rm -rf ${TESTCLASSES}/ssl
 mkdir -p ${TESTCLASSES}/ssl
-cp -rf ${TESTSRC}/ssl/*store ${TESTCLASSES}/ssl 
+cp -rf ${TESTSRC}/ssl/*store ${TESTCLASSES}/ssl
 chmod -R 777 ${TESTCLASSES}/ssl
 
 DEBUGOPTIONS=""
@@ -56,7 +55,7 @@
 
 # Call the common generic test
 #
-# No need to since bug 4267864 is now fixed. 
+# No need to since bug 4267864 is now fixed.
 #
 echo -------------------------------------------------------------
 echo Launching test for `basename $0 .sh`
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -39,13 +39,14 @@
 
 /**
  * @test
- * @library /lib/testlibrary
  * @bug 6228231
  * @summary Test that RMI registry uses SSL.
- * @modules jdk.management.agent
+ * @author Luis-Miguel Alventosa, Taras Ledkov
+ *
+ * @library /lib/testlibrary
+ *
  * @build jdk.testlibrary.* RmiRegistrySslTestApp
  * @run main/timeout=300 RmiRegistrySslTest
- * @author Luis-Miguel Alventosa, Taras Ledkov
  */
 public class RmiRegistrySslTest {
     private final String TEST_CLASS_PATH = System.getProperty("test.class.path");
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -27,8 +27,7 @@
 # @summary Test RMI Bootstrap with SSL
 #
 # @library /lib/testlibrary
-# @modules jdk.management.agent/jdk.internal.agent
-#          jdk.management.agent/sun.management.jmxremote
+#
 # @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
 # @run shell/timeout=300  RmiSslBootstrapTest.sh
 
@@ -43,7 +42,7 @@
 
 rm -rf ${TESTCLASSES}/ssl
 mkdir -p ${TESTCLASSES}/ssl
-cp -rf ${TESTSRC}/ssl/*store ${TESTCLASSES}/ssl 
+cp -rf ${TESTSRC}/ssl/*store ${TESTCLASSES}/ssl
 chmod -R 777 ${TESTCLASSES}/ssl
 
 DEBUGOPTIONS=""
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh	Mon Apr 10 08:31:37 2017 -0700
@@ -24,10 +24,8 @@
 #
 # @test
 # @summary Test RMI Bootstrap with SSL and no keystore.
+# @bug 4932854
 #
-# @bug 4932854
-# @modules jdk.management.agent/jdk.internal.agent
-#          jdk.management.agent/sun.management.jmxremote
 # @build TestLogger RmiSslNoKeyStoreTest
 # @run shell/timeout=300  RmiSslNoKeyStoreTest.sh
 
@@ -42,7 +40,7 @@
 
 rm -rf ${TESTCLASSES}/ssl
 mkdir -p ${TESTCLASSES}/ssl
-cp -rf ${TESTSRC}/ssl/*store ${TESTCLASSES}/ssl 
+cp -rf ${TESTSRC}/ssl/*store ${TESTCLASSES}/ssl
 chmod -R 777 ${TESTCLASSES}/ssl
 
 DEBUGOPTIONS=""
--- a/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,14 +25,14 @@
 
 /**
  * @test
+ * @bug 6557093
+ * @summary Check SSL config file permission for out-of-the-box management
+ * @author Taras Ledkov
+ *
  * @library /lib/testlibrary
- * @bug 6557093
- * @modules jdk.management.agent
+ *
  * @build jdk.testlibrary.* Dummy AbstractFilePermissionTest
- * @summary Check SSL config file permission for out-of-the-box management
  * @run main/timeout=300 SSLConfigFilePermissionTest
- *
- * @author Taras Ledkov
  */
 public class SSLConfigFilePermissionTest extends AbstractFilePermissionTest {
 
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -53,13 +53,17 @@
 /**
  * @test
  * @bug 7110104
+ * @key randomness intermittent
+ * @summary Makes sure that enabling/disabling the management agent through JCMD
+ *          achieves the desired results
+ *
  * @library /lib/testlibrary
- * @modules jdk.management.agent/jdk.internal.agent
+ * @modules java.management
+ *          java.rmi
+ *          jdk.management.agent/jdk.internal.agent
+ *
  * @build jdk.testlibrary.* JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd
  * @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest
- * @summary Makes sure that enabling/disabling the management agent through JCMD
- *          achieves the desired results
- * @key randomness intermittent
  */
 public class JMXStartStopTest {
     private static final String TEST_APP_NAME = "TestApp";
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -38,11 +38,12 @@
 /**
  * @test
  * @bug 8075926
+ * @key intermittent
  * @summary Makes sure that the current management agent status is reflected
  *          in the related performance counters.
- * @key intermittent
+ *
  * @library /lib/testlibrary
- * @modules jdk.management.agent/jdk.internal.agent
+ *
  * @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
  * @run testng/othervm -XX:+UsePerfData JMXStatusPerfCountersTest
  */
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -37,8 +37,9 @@
  * @summary Performs a sanity test for the ManagementAgent.status diagnostic command.
  *          Management agent may be disabled, started (only local connections) and started.
  *          The test asserts that the expected text is being printed.
+ *
  * @library /lib/testlibrary
- * @modules jdk.management.agent/jdk.internal.agent
+ *
  * @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
  *        JMXStatusTest JMXStatus1Test JMXStatus2Test
  * @run testng/othervm -XX:+UsePerfData JMXStatus1Test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
+
+/*
+ * A SSL socket client.
+ */
+public class JSSEClient {
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("Client: arguments=" + String.join("; ", args));
+
+        int port = Integer.valueOf(args[0]);
+        String[] trustNames = args[1].split(TLSRestrictions.DELIMITER);
+        String[] certNames = args[2].split(TLSRestrictions.DELIMITER);
+        String constraint = args[3];
+
+        TLSRestrictions.setConstraint("Client", constraint);
+
+        SSLContext context = TLSRestrictions.createSSLContext(
+                trustNames, certNames);
+        SSLSocketFactory socketFactory = context.getSocketFactory();
+        try (SSLSocket socket = (SSLSocket) socketFactory.createSocket()) {
+            socket.connect(new InetSocketAddress("localhost", port),
+                    TLSRestrictions.TIMEOUT);
+            socket.setSoTimeout(TLSRestrictions.TIMEOUT);
+            System.out.println("Client: connected");
+
+            InputStream sslIS = socket.getInputStream();
+            OutputStream sslOS = socket.getOutputStream();
+            sslOS.write('C');
+            sslOS.flush();
+            sslIS.read();
+            System.out.println("Client: finished");
+        } catch (Exception e) {
+            throw new RuntimeException("Client: failed.", e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLServerSocket;
+import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SSLSocket;
+
+/*
+ * A SSL socket server.
+ */
+public class JSSEServer {
+
+    private SSLServerSocket server = null;
+
+    private Exception exception = null;
+
+    public JSSEServer(SSLContext context, String constraint,
+            boolean needClientAuth) throws Exception {
+        TLSRestrictions.setConstraint("Server", constraint);
+
+        SSLServerSocketFactory serverFactory = context.getServerSocketFactory();
+        server = (SSLServerSocket) serverFactory.createServerSocket(0);
+        server.setSoTimeout(TLSRestrictions.TIMEOUT);
+        server.setNeedClientAuth(needClientAuth); // for dual authentication
+        System.out.println("Server: port=" + getPort());
+    }
+
+    public void start() {
+        new Thread(new Runnable() {
+
+            @Override
+            public void run() {
+                try {
+                    System.out.println("Server: started");
+                    try (SSLSocket socket = (SSLSocket) server.accept()) {
+                        socket.setSoTimeout(TLSRestrictions.TIMEOUT);
+                        InputStream sslIS = socket.getInputStream();
+                        OutputStream sslOS = socket.getOutputStream();
+                        sslIS.read();
+                        sslOS.write('S');
+                        sslOS.flush();
+                        System.out.println("Server: finished");
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace(System.out);
+                    exception = e;
+                }
+            }
+        }).start();
+    }
+
+    public int getPort() {
+        return server.getLocalPort();
+    }
+
+    public Exception getException() {
+        return exception;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,544 @@
+/*
+ * 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.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.SocketTimeoutException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.security.KeyFactory;
+import java.security.KeyStore;
+import java.security.PrivateKey;
+import java.security.Security;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.util.Base64;
+import java.util.stream.Collectors;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLHandshakeException;
+import javax.net.ssl.TrustManagerFactory;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+/*
+ * @test
+ * @summary Verify the restrictions for certificate path on JSSE with custom trust store.
+ * @library /test/lib
+ * @compile JSSEClient.java
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions DEFAULT
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C1
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S1
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C2
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S2
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C3
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S3
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C4
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S4
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C5
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S5
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C6
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S6
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C7
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S7
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C8
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S8
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C9
+ * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S9
+ */
+public class TLSRestrictions {
+
+    private static final String TEST_CLASSES = System.getProperty("test.classes");
+    private static final char[] PASSWORD = "".toCharArray();
+    private static final String CERT_DIR = System.getProperty("cert.dir",
+            System.getProperty("test.src") + "/certs");
+
+    static final String PROP = "jdk.certpath.disabledAlgorithms";
+    static final String NOSHA1 = "MD2, MD5";
+    private static final String TLSSERVER = "SHA1 usage TLSServer";
+    private static final String TLSCLIENT = "SHA1 usage TLSClient";
+    static final String JDKCATLSSERVER = "SHA1 jdkCA & usage TLSServer";
+    static final String JDKCATLSCLIENT = "SHA1 jdkCA & usage TLSClient";
+
+    // This is a space holder in command arguments, and stands for none certificate.
+    static final String NONE_CERT = "NONE_CERT";
+
+    static final String DELIMITER = ",";
+    static final int TIMEOUT = 30000;
+
+    // It checks if java.security contains constraint "SHA1 jdkCA & usage TLSServer"
+    // for jdk.certpath.disabledAlgorithms by default.
+    private static void checkDefaultConstraint() {
+        System.out.println(
+                "Case: Checks the default value of jdk.certpath.disabledAlgorithms");
+        if (!Security.getProperty(PROP).contains(JDKCATLSSERVER)) {
+            throw new RuntimeException(String.format(
+                    "%s doesn't contain constraint \"%s\", the real value is \"%s\".",
+                    PROP, JDKCATLSSERVER, Security.getProperty(PROP)));
+        }
+    }
+
+    /*
+     * This method creates trust store and key store with specified certificates
+     * respectively. And then it creates SSL context with the stores.
+     * If trustNames contains NONE_CERT only, it does not create a custom trust
+     * store, but the default one in JDK.
+     *
+     * @param trustNames Trust anchors, which are used to create custom trust store.
+     *                   If null, no custom trust store is created and the default
+     *                   trust store in JDK is used.
+     * @param certNames Certificate chain, which is used to create key store.
+     *                  It cannot be null.
+     */
+    static SSLContext createSSLContext(String[] trustNames,
+            String[] certNames) throws Exception {
+        CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
+
+        TrustManagerFactory tmf = null;
+        if (trustNames != null && trustNames.length > 0
+                && !trustNames[0].equals(NONE_CERT)) {
+            KeyStore trustStore = KeyStore.getInstance("JKS");
+            trustStore.load(null, null);
+            for (int i = 0; i < trustNames.length; i++) {
+                try (InputStream is = new ByteArrayInputStream(
+                        loadCert(trustNames[i]).getBytes())) {
+                    Certificate trustCert = certFactory.generateCertificate(is);
+                    trustStore.setCertificateEntry("trustCert-" + i, trustCert);
+                }
+            }
+
+            tmf = TrustManagerFactory.getInstance("PKIX");
+            tmf.init(trustStore);
+        }
+
+        Certificate[] certChain = new Certificate[certNames.length];
+        for (int i = 0; i < certNames.length; i++) {
+            try (InputStream is = new ByteArrayInputStream(
+                    loadCert(certNames[i]).getBytes())) {
+                Certificate cert = certFactory.generateCertificate(is);
+                certChain[i] = cert;
+            }
+        }
+
+        PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec(
+                Base64.getMimeDecoder().decode(loadPrivKey(certNames[0])));
+        KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+        PrivateKey privKey = keyFactory.generatePrivate(privKeySpec);
+
+        KeyStore keyStore = KeyStore.getInstance("JKS");
+        keyStore.load(null, null);
+        keyStore.setKeyEntry("keyCert", privKey, PASSWORD, certChain);
+
+        KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509");
+        kmf.init(keyStore, PASSWORD);
+
+        SSLContext context = SSLContext.getInstance("TLS");
+        context.init(kmf.getKeyManagers(),
+                tmf == null ? null : tmf.getTrustManagers(), null);
+        return context;
+    }
+
+    /*
+     * This method sets jdk.certpath.disabledAlgorithms, and then retrieves
+     * and prints its value.
+     */
+    static void setConstraint(String side, String constraint) {
+        System.out.printf("%s: Old %s=%s%n", side, PROP,
+                Security.getProperty(PROP));
+        Security.setProperty(PROP, constraint);
+        System.out.printf("%s: New %s=%s%n", side, PROP,
+                Security.getProperty(PROP));
+    }
+
+    /*
+     * This method is used to run a variety of cases.
+     * It launches a server, and then takes a client to connect the server.
+     * Both of server and client use the same certificates.
+     *
+     * @param trustNames Trust anchors, which are used to create custom trust store.
+     *                   If null, the default trust store in JDK is used.
+     * @param certNames Certificate chain, which is used to create key store.
+     *                  It cannot be null. The first certificate is regarded as
+     *                  the end entity.
+     * @param serverConstraint jdk.certpath.disabledAlgorithms value on server side.
+     * @param clientConstraint jdk.certpath.disabledAlgorithms value on client side.
+     * @param needClientAuth If true, server side acquires client authentication;
+     *                       otherwise, false.
+     * @param pass If true, the connection should be blocked; otherwise, false.
+     */
+    static void testConstraint(String[] trustNames, String[] certNames,
+            String serverConstraint, String clientConstraint,
+            boolean needClientAuth, boolean pass) throws Exception {
+        String trustNameStr = trustNames == null ? ""
+                : String.join(DELIMITER, trustNames);
+        String certNameStr = certNames == null ? ""
+                : String.join(DELIMITER, certNames);
+
+        System.out.printf("Case:%n"
+                + "  trustNames=%s; certNames=%s%n"
+                + "  serverConstraint=%s; clientConstraint=%s%n"
+                + "  needClientAuth=%s%n"
+                + "  pass=%s%n%n",
+                trustNameStr, certNameStr,
+                serverConstraint, clientConstraint,
+                needClientAuth,
+                pass);
+
+        JSSEServer server = new JSSEServer(
+                createSSLContext(trustNames, certNames),
+                serverConstraint,
+                needClientAuth);
+        int port = server.getPort();
+        server.start();
+
+        // Run client on another JVM so that its properties cannot be in conflict
+        // with server's.
+        OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
+                "-Dcert.dir=" + CERT_DIR,
+                "-Djava.security.debug=certpath",
+                "-classpath",
+                TEST_CLASSES,
+                "JSSEClient",
+                port + "",
+                trustNameStr,
+                certNameStr,
+                clientConstraint);
+        int exitValue = outputAnalyzer.getExitValue();
+        String clientOut = outputAnalyzer.getOutput();
+
+        Exception serverException = server.getException();
+        if (serverException != null) {
+            System.out.println("Server: failed");
+        }
+
+        System.out.println("---------- Client output start ----------");
+        System.out.println(clientOut);
+        System.out.println("---------- Client output end ----------");
+
+        if (serverException instanceof SocketTimeoutException
+                || clientOut.contains("SocketTimeoutException")) {
+            System.out.println("The communication gets timeout and skips the test.");
+            return;
+        }
+
+        if (pass) {
+            if (serverException != null || exitValue != 0) {
+                throw new RuntimeException(
+                        "Unexpected failure. Operation was blocked.");
+            }
+        } else {
+            if (serverException == null && exitValue == 0) {
+                throw new RuntimeException(
+                        "Unexpected pass. Operation was allowed.");
+            }
+
+            // The test may encounter non-SSL issues, like network problem.
+            if (!(serverException instanceof SSLHandshakeException
+                    || clientOut.contains("SSLHandshakeException"))) {
+                throw new RuntimeException("Failure with unexpected exception.");
+            }
+        }
+    }
+
+    /*
+     * This method is used to run a variety of cases, which don't require client
+     * authentication by default.
+     */
+    static void testConstraint(String[] trustNames, String[] certNames,
+            String serverConstraint, String clientConstraint, boolean pass)
+            throws Exception {
+        testConstraint(trustNames, certNames, serverConstraint, clientConstraint,
+                false, pass);
+    }
+
+    public static void main(String[] args) throws Exception {
+        switch (args[0]) {
+        // Case DEFAULT only checks one of default settings for
+        // jdk.certpath.disabledAlgorithms in JDK/conf/security/java.security.
+        case "DEFAULT":
+            checkDefaultConstraint();
+            break;
+
+        // Cases C1 and S1 use SHA256 root CA in trust store,
+        // and use SHA256 end entity in key store.
+        // C1 only sets constraint "SHA1 usage TLSServer" on client side;
+        // S1 only sets constraint "SHA1 usage TLSClient" on server side with client auth.
+        // The connection of the both cases should not be blocked.
+        case "C1":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA256" },
+                    new String[] { "INTER_CA_SHA256-ROOT_CA_SHA256" },
+                    NOSHA1,
+                    TLSSERVER,
+                    true);
+            break;
+        case "S1":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA256" },
+                    new String[] { "INTER_CA_SHA256-ROOT_CA_SHA256" },
+                    TLSCLIENT,
+                    NOSHA1,
+                    true,
+                    true);
+            break;
+
+        // Cases C2 and S2 use SHA256 root CA in trust store,
+        // and use SHA1 end entity in key store.
+        // C2 only sets constraint "SHA1 usage TLSServer" on client side;
+        // S2 only sets constraint "SHA1 usage TLSClient" on server side with client auth.
+        // The connection of the both cases should be blocked.
+        case "C2":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA256" },
+                    new String[] { "INTER_CA_SHA1-ROOT_CA_SHA256" },
+                    NOSHA1,
+                    TLSSERVER,
+                    false);
+            break;
+        case "S2":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA256" },
+                    new String[] { "INTER_CA_SHA1-ROOT_CA_SHA256" },
+                    TLSCLIENT,
+                    NOSHA1,
+                    true,
+                    false);
+            break;
+
+        // Cases C3 and S3 use SHA1 root CA in trust store,
+        // and use SHA1 end entity in key store.
+        // C3 only sets constraint "SHA1 usage TLSServer" on client side;
+        // S3 only sets constraint "SHA1 usage TLSClient" on server side with client auth.
+        // The connection of the both cases should be blocked.
+        case "C3":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA1" },
+                    new String[] { "INTER_CA_SHA1-ROOT_CA_SHA1" },
+                    NOSHA1,
+                    TLSSERVER,
+                    false);
+            break;
+        case "S3":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA1" },
+                    new String[] { "INTER_CA_SHA1-ROOT_CA_SHA1" },
+                    TLSCLIENT,
+                    NOSHA1,
+                    true,
+                    false);
+            break;
+
+        // Cases C4 and S4 use SHA1 root CA as trust store,
+        // and use SHA256 end entity in key store.
+        // C4 only sets constraint "SHA1 usage TLSServer" on client side;
+        // S4 only sets constraint "SHA1 usage TLSClient" on server side with client auth.
+        // The connection of the both cases should not be blocked.
+        case "C4":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA1" },
+                    new String[] { "INTER_CA_SHA256-ROOT_CA_SHA1" },
+                    NOSHA1,
+                    TLSSERVER,
+                    true);
+            break;
+        case "S4":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA1" },
+                    new String[] { "INTER_CA_SHA256-ROOT_CA_SHA1" },
+                    TLSCLIENT,
+                    NOSHA1,
+                    true,
+                    true);
+            break;
+
+        // Cases C5 and S5 use SHA1 root CA in trust store,
+        // and use SHA256 intermediate CA and SHA256 end entity in key store.
+        // C5 only sets constraint "SHA1 usage TLSServer" on client side;
+        // S5 only sets constraint "SHA1 usage TLSClient" on server side with client auth.
+        // The connection of the both cases should not be blocked.
+        case "C5":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA1" },
+                    new String[] {
+                            "END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1",
+                            "INTER_CA_SHA256-ROOT_CA_SHA1" },
+                    NOSHA1,
+                    TLSSERVER,
+                    true);
+            break;
+        case "S5":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA1" },
+                    new String[] {
+                            "END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1",
+                            "INTER_CA_SHA256-ROOT_CA_SHA1" },
+                    TLSCLIENT,
+                    NOSHA1,
+                    true,
+                    true);
+            break;
+
+        // Cases C6 and S6 use SHA1 root CA as trust store,
+        // and use SHA1 intermediate CA and SHA256 end entity in key store.
+        // C6 only sets constraint "SHA1 usage TLSServer" on client side;
+        // S6 only sets constraint "SHA1 usage TLSClient" on server side with client auth.
+        // The connection of the both cases should be blocked.
+        case "C6":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA1" },
+                    new String[] {
+                            "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1",
+                            "INTER_CA_SHA1-ROOT_CA_SHA1" },
+                    NOSHA1,
+                    TLSSERVER,
+                    false);
+            break;
+        case "S6":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA1" },
+                    new String[] {
+                            "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1",
+                            "INTER_CA_SHA1-ROOT_CA_SHA1" },
+                    TLSCLIENT,
+                    NOSHA1,
+                    true,
+                    false);
+            break;
+
+        // Cases C7 and S7 use SHA256 root CA in trust store,
+        // and use SHA256 intermediate CA and SHA1 end entity in key store.
+        // C7 only sets constraint "SHA1 usage TLSServer" on client side;
+        // S7 only sets constraint "SHA1 usage TLSClient" on server side with client auth.
+        // The connection of the both cases should be blocked.
+        case "C7":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA256" },
+                    new String[] {
+                            "END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256",
+                            "INTER_CA_SHA256-ROOT_CA_SHA256" },
+                    NOSHA1,
+                    TLSSERVER,
+                    false);
+            break;
+        case "S7":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA256" },
+                    new String[] {
+                            "END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256",
+                            "INTER_CA_SHA256-ROOT_CA_SHA256" },
+                    TLSCLIENT,
+                    NOSHA1,
+                    true,
+                    false);
+            break;
+
+        // Cases C8 and S8 use SHA256 root CA in trust store,
+        // and use SHA1 intermediate CA and SHA256 end entity in key store.
+        // C8 only sets constraint "SHA1 usage TLSServer" on client side;
+        // S8 only sets constraint "SHA1 usage TLSClient" on server side with client auth.
+        // The connection of the both cases should be blocked.
+        case "C8":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA256" },
+                    new String[] {
+                            "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256",
+                            "INTER_CA_SHA1-ROOT_CA_SHA256" },
+                    NOSHA1,
+                    TLSSERVER,
+                    false);
+            break;
+        case "S8":
+            testConstraint(
+                    new String[] { "ROOT_CA_SHA256" },
+                    new String[] {
+                            "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256",
+                            "INTER_CA_SHA1-ROOT_CA_SHA256" },
+                    TLSCLIENT,
+                    NOSHA1,
+                    true,
+                    false);
+            break;
+
+        // Cases C9 and S9 use SHA256 root CA and SHA1 intermediate CA in trust store,
+        // and use SHA256 end entity in key store.
+        // C9 only sets constraint "SHA1 usage TLSServer" on client side;
+        // S9 only sets constraint "SHA1 usage TLSClient" on server side with client auth.
+        // The connection of the both cases should not be blocked.
+        case "C9":
+            testConstraint(
+                    new String[] {
+                            "ROOT_CA_SHA256",
+                            "INTER_CA_SHA1-ROOT_CA_SHA256" },
+                    new String[] {
+                            "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256" },
+                    NOSHA1,
+                    TLSSERVER,
+                    true);
+            break;
+        case "S9":
+            testConstraint(
+                    new String[] {
+                            "ROOT_CA_SHA256",
+                            "INTER_CA_SHA1-ROOT_CA_SHA256" },
+                    new String[] {
+                            "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256" },
+                    TLSCLIENT,
+                    NOSHA1,
+                    true,
+                    true);
+            break;
+        }
+
+        System.out.println("Case passed");
+        System.out.println("========================================");
+    }
+
+    private static String loadCert(String certName) {
+        try {
+            Path certFilePath = Paths.get(CERT_DIR, certName + ".cer");
+            return String.join("\n",
+                    Files.lines(certFilePath).filter((String line) -> {
+                        return !line.startsWith("Certificate")
+                                && !line.startsWith(" ");
+                    }).collect(Collectors.toList()));
+        } catch (IOException e) {
+            throw new RuntimeException("Load certificate failed", e);
+        }
+    }
+
+    private static String loadPrivKey(String certName) {
+        Path priveKeyFilePath = Paths.get(CERT_DIR, certName + "-PRIV.key");
+        try {
+            return new String(Files.readAllBytes(priveKeyFilePath));
+        } catch (IOException e) {
+            throw new RuntimeException("Load private key failed", e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCYQDZxHxNJV8dQ
+I6mfJjuIZxAe5CX9GCrS3Fajh5DXIQwdcvQ4s6YdKzwFn+8dUdspdNTnS+bWjfYw
+0iAbsMt6L6ewutaZf6aufh1EBYiwNOvN8C8Cx0iiE8NiBo833AYWHKhDC4qu63QR
+dYwb9j+Jg8t6p0lQ64sFLDN/RJOcWlaPQbJbSNBKePQR7WOFvdJgFAdQmQjL+ND6
+PSui9QByyXQ+3nfs7ID4paUxYbCrJMh5/AJqaT04DYDEumfmURUn5+ZOIqmqvI2I
+pNXN5gVzL3b8mM2WGr5dpRY5cZ1X//BQ91SNjrKNJlmKFr7nMCfAdzxIW4b/sArv
+eYNE2Vy7AgMBAAECggEBAJNtkopFoiJiKnFypxyiJAG4cwbGu/ZxwX3/uLGPY3S9
+3oJhvxVs+IzEQdHchempSwTAyizS9cuLGfs6bbcConZF0Sa0NXvb/SZ4npQwm6St
+Ci2Xx530JWQ0qPyyB1r65rXguBp8AaXR/8msPqkQ8YOSqKWzea4u96Zhn9g8Koe6
+AD/8FeSzJBDVbJ+C7jKX/7sKsHbYqulzLMQf0lqXFxpGW+5UJaozoQOWXnnmqU3T
+0i4uaGUCXHbQM8eh3fvMFCU4UQMYVS1QOSvZJTnO5bSb8SqeQnCMnQ18ltq4sL43
+qFsEcmAjrlhNoBwslqvfY1bX9NtXyFZ8PuD8OvoFxPkCgYEAxlVfD2qcrAoOcbDe
+Em9hDVPizRuzGuCHi9K2YLDrLVDNd6NF3Pk65JiTsd1fA2AZdi+ljKGEwBhNFOyk
+qwmK2K4sYy7zvyV3Blmwvyo7+OaeexYF8RIw5keGlRsgHTGarzlQAlJu91UmyAmE
+C/99fZbSWo9QndJ0FVR6G3ti71UCgYEAxITBJqVtNFnv4PGdc3FNsYXlRQcSWjs9
+/1lsppLQjC6HMsb6JpxYUF3D4oFiUESKe/9kZzl1H/65Cm2mYq8sj+7lug8P5tz7
+DQa91dFM02r8JLO6TitSuZfbc0XH0K450ntuQlKX581icYSGBUwQHGApespuNVlh
+Mg7CmwNse88CgYAienrhEjaUTdc++nFQoR4tE/UslPEo7fmCXCoqWvc3VIGzl6Ww
+iX8seD3MwOAglRc4DYZpETcjsdXMmmrx9OG3U2gSAfqLszai2vq38N6mIWlRmn2D
+8BaiIbMKvsFxccsjRQJctPnnc10fj0/uSgcFyy9cYOex2AEoKBxmJKgJVQKBgA0c
+HhaJ6qMXbN1AwRQ2dsxk9kqIkjzavuQN/yWNncP8RqCojX+N5oZV+v9dSkW4jNSA
+0R3hw2KDB60ea38h2IMxmLm0z4bDLyxLSta8w7dG59M6+i7EzRv8eXNTMGVHeiwE
+d/KMt/2Kwgp4oMgxrtF1yM6cOoXslINWYL0emVoZAoGAcEKzO8LgPJsIVjRFz3ri
+0AQqiXQzYek2WAXYhlQCvBVn8in3MYcxKhjA3Og3Lym0xvZ+/8SbII9QNaidbgIH
+HDreeJW4KE5EfVnDaYcxwK/9LXZXndIxrpR0YKNSvZT7DuuQtFCoxJcASxb1k9Tc
+5MPT+pyPL+9v2q56ry56qas=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,81 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            e8:33:78:c7:69:9c:28:c2
+    Signature Algorithm: sha1WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA256-ROOT_CA_SHA256
+        Validity
+            Not Before: Mar 30 04:51:07 2017 GMT
+            Not After : Mar 28 04:51:07 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:98:40:36:71:1f:13:49:57:c7:50:23:a9:9f:26:
+                    3b:88:67:10:1e:e4:25:fd:18:2a:d2:dc:56:a3:87:
+                    90:d7:21:0c:1d:72:f4:38:b3:a6:1d:2b:3c:05:9f:
+                    ef:1d:51:db:29:74:d4:e7:4b:e6:d6:8d:f6:30:d2:
+                    20:1b:b0:cb:7a:2f:a7:b0:ba:d6:99:7f:a6:ae:7e:
+                    1d:44:05:88:b0:34:eb:cd:f0:2f:02:c7:48:a2:13:
+                    c3:62:06:8f:37:dc:06:16:1c:a8:43:0b:8a:ae:eb:
+                    74:11:75:8c:1b:f6:3f:89:83:cb:7a:a7:49:50:eb:
+                    8b:05:2c:33:7f:44:93:9c:5a:56:8f:41:b2:5b:48:
+                    d0:4a:78:f4:11:ed:63:85:bd:d2:60:14:07:50:99:
+                    08:cb:f8:d0:fa:3d:2b:a2:f5:00:72:c9:74:3e:de:
+                    77:ec:ec:80:f8:a5:a5:31:61:b0:ab:24:c8:79:fc:
+                    02:6a:69:3d:38:0d:80:c4:ba:67:e6:51:15:27:e7:
+                    e6:4e:22:a9:aa:bc:8d:88:a4:d5:cd:e6:05:73:2f:
+                    76:fc:98:cd:96:1a:be:5d:a5:16:39:71:9d:57:ff:
+                    f0:50:f7:54:8d:8e:b2:8d:26:59:8a:16:be:e7:30:
+                    27:c0:77:3c:48:5b:86:ff:b0:0a:ef:79:83:44:d9:
+                    5c:bb
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256
+                serial:84:A1:70:1D:0A:92:D3:CC
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha1WithRSAEncryption
+         22:63:2a:de:80:70:92:f7:53:e4:7f:ea:01:2b:13:b3:1b:02:
+         2e:10:b4:1d:b7:33:7f:6f:0d:88:46:5a:b8:db:83:95:77:e2:
+         db:da:2e:31:0a:85:c6:9a:75:84:ca:73:5c:be:e3:30:22:7e:
+         bc:60:43:49:7c:69:06:14:4a:89:e4:23:ca:25:99:85:d6:06:
+         16:d5:9e:a8:fd:25:43:88:07:12:0a:7e:de:24:33:71:ab:a4:
+         23:aa:4e:dc:0f:89:ef:a9:09:89:55:a1:1d:ee:48:35:ea:10:
+         42:ff:98:15:2a:e8:5c:46:e0:e4:4f:4c:b9:07:e0:da:08:6f:
+         ce:4a:fe:98:3e:ae:c5:e5:6a:6e:50:0f:2d:39:01:55:ed:59:
+         0b:65:30:54:e8:72:26:ee:9f:cf:3f:ce:6a:20:c8:87:c9:81:
+         bc:f8:b3:ec:77:bb:bc:5b:8c:3f:18:fd:08:76:ad:27:59:fc:
+         b8:74:96:0d:cd:ed:97:91:6b:95:89:3a:f3:78:de:9f:06:a6:
+         ce:36:01:f0:be:ae:d8:d6:c4:3d:51:8a:2a:e0:43:59:8c:b4:
+         eb:63:93:9d:53:72:f8:4b:a3:c7:4a:da:2e:56:33:b6:46:1b:
+         45:a8:23:1b:82:de:6d:4e:e0:18:cf:9b:ba:22:68:8b:8c:de:
+         6f:08:2d:bc
+-----BEGIN CERTIFICATE-----
+MIID/jCCAuagAwIBAgIJAOgzeMdpnCjCMA0GCSqGSIb3DQEBBQUAMG8xCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMScwJQYDVQQDDB5JTlRFUl9DQV9TSEEyNTYtUk9PVF9D
+QV9TSEEyNTYwHhcNMTcwMzMwMDQ1MTA3WhcNMjcwMzI4MDQ1MTA3WjB/MQswCQYD
+VQQGEwJVUzELMAkGA1UECAwCQ0ExDTALBgNVBAcMBENpdHkxDDAKBgNVBAoMA09y
+ZzENMAsGA1UECwwESmF2YTE3MDUGA1UEAwwuRU5EX0VOVElUWV9TSEExLUlOVEVS
+X0NBX1NIQTI1Ni1ST09UX0NBX1NIQTI1NjCCASIwDQYJKoZIhvcNAQEBBQADggEP
+ADCCAQoCggEBAJhANnEfE0lXx1AjqZ8mO4hnEB7kJf0YKtLcVqOHkNchDB1y9Diz
+ph0rPAWf7x1R2yl01OdL5taN9jDSIBuwy3ovp7C61pl/pq5+HUQFiLA0683wLwLH
+SKITw2IGjzfcBhYcqEMLiq7rdBF1jBv2P4mDy3qnSVDriwUsM39Ek5xaVo9BsltI
+0Ep49BHtY4W90mAUB1CZCMv40Po9K6L1AHLJdD7ed+zsgPilpTFhsKskyHn8Ampp
+PTgNgMS6Z+ZRFSfn5k4iqaq8jYik1c3mBXMvdvyYzZYavl2lFjlxnVf/8FD3VI2O
+so0mWYoWvucwJ8B3PEhbhv+wCu95g0TZXLsCAwEAAaOBjDCBiTB5BgNVHSMEcjBw
+oWOkYTBfMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDTALBgNVBAcMBENpdHkx
+DDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEXMBUGA1UEAwwOUk9PVF9DQV9T
+SEEyNTaCCQCEoXAdCpLTzDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IB
+AQAiYyregHCS91Pkf+oBKxOzGwIuELQdtzN/bw2IRlq424OVd+Lb2i4xCoXGmnWE
+ynNcvuMwIn68YENJfGkGFEqJ5CPKJZmF1gYW1Z6o/SVDiAcSCn7eJDNxq6Qjqk7c
+D4nvqQmJVaEd7kg16hBC/5gVKuhcRuDkT0y5B+DaCG/OSv6YPq7F5WpuUA8tOQFV
+7VkLZTBU6HIm7p/PP85qIMiHyYG8+LPsd7u8W4w/GP0Idq0nWfy4dJYNze2XkWuV
+iTrzeN6fBqbONgHwvq7Y1sQ9UYoq4ENZjLTrY5OdU3L4S6PHStouVjO2RhtFqCMb
+gt5tTuAYz5u6ImiLjN5vCC28
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDaYlKNTU1iQes/
+BtivvM1ixjCk1muM1RdMkJQItZB21y1kM1OLp3EmGKqVqwKbS5OTrMIxjPUwD9Ly
+aRJMvSP1xve7zwmNXOngA8eukmQ2olQU58ble6IAHcj4qg7a38E1ITvDmAswhTzK
+fI4Z6okLCjKfYafnfbi5JA+E6fiArB3zimjne+tiUNYZh2eYspsOOw6cmaLtIbMP
+ZyXy4iP6OCNIikb08Da27zjVn04i1SeUEv1YFmn4B9GWcNLAXyM1LmCNi70+SATp
+aZYRjr/BBR6LNZMBsNKJblWFXK3UtfYFiypyirgQjzPtLb1XsuMhfqMt8QZDh8n3
+YvYTW59xAgMBAAECggEAb4NPdhnoDulsL5XWZf55vhtH0ZQv/Qz+xbj57myQJS8B
+Xa4b1i8dRv/Hc3+MaDIyXHEWBGle9jjOVbwzfP4D88eyzrMMxKOSRTKI72qPQ5qm
+ZrpnxNzZv0d2TQvBZCBnrzKWKu1joVYX0anCghdR/VIqwVoDe+Clx9xTFGLI4yKO
+7v0dkr4Hxn3NT6bTV18V6PoGbUgIsmpNYQPFyUM/IHG2ewDffLP+tm7RsEfKYmcx
+Hr70pmWBpM9hwTAC+uXHuNXnsX4IjEQOXmm4PJ/A/sm2Bad93SPwi15e29MV8YbO
+vvirGLaepa7AUvqoK0DFNCLU6vCeFJ7DUZ/u2P8x8QKBgQDxNOWvy3EV4/P/ocSf
+itMtXZWj4driT4vUGwFZWfr3CVpZVaUmqXYeVdzNGuoWlmXOiOAuOepnlA36FCb5
+aGE4cq/hbdtbr+v6awEj5/A2me/ax1W1z6lD0pg0QJ7KvqFCBzVol5yTiWZKBVE+
+jp2waPfes770AUHczw9KKvEGtQKBgQDnxxiZAxtoNmOaB/NZmPNBKvWDw858+QX2
++u/jEH3pW393tUnipgIoo6yvd6djhJ6/4ViOxdioMIQCBab/xuSB4lfQsrJsWvS9
+uYB794s7CV2r3kUa3ux8wAovW6Fc369nD7JjUPX/Cq3zdlyTDt9LVLRCpZ6Li1xB
+r0ZVlpgPTQKBgQCgKay+X0tW6sdxHfyOp8Lz46liaa1LCuDhVZE+wHXZpXc9zJXe
+JzZMjF0SQGXh27n8O30IlOJmJrRlMw5yG/I6ZkUNXkIDDryVyom2SuOBjhPrZOMv
+15UgeO0h/Sqzm4M+ccTwD4Qjn1+xlPhOnqpsoja8xQPtyAvwz/jqGbtz5QKBgH01
+pSgj8Y5es3fmi6P/aInv9ynzgX0p2fsOnMEBi8Og1j+JBB0YqVni8crozNiKMGhg
+CEM4xk41x1qASzMp8w/ngqEPqCu5BzXnHG3b0K9X4+6Q6KwXeZH6/IWQ7p8Jh+wZ
+IrlcZ0gcMNSxQFmBU0eSvr6yUe/4nSIu2cQq0oKRAoGAUEFd0LxZw50BdCdpJlcQ
++oTbSUYQhAzPF2ybfR6i8IxXoOjVxpvRehlbwXIQV7XEqamXFTmBLIvuAlF1yWoH
+hzxNJuEgPRTPztnHD6LVzvuf2ain+CFZuDrXBT2l8PyF9BNL4/DMRrbgdCxr9F0O
+Ti0VJo1TRE8vVzUfVc9w1RI=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,81 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            86:09:85:57:41:bf:86:65
+    Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA1-ROOT_CA_SHA1
+        Validity
+            Not Before: Mar 30 04:51:06 2017 GMT
+            Not After : Mar 28 04:51:06 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:da:62:52:8d:4d:4d:62:41:eb:3f:06:d8:af:bc:
+                    cd:62:c6:30:a4:d6:6b:8c:d5:17:4c:90:94:08:b5:
+                    90:76:d7:2d:64:33:53:8b:a7:71:26:18:aa:95:ab:
+                    02:9b:4b:93:93:ac:c2:31:8c:f5:30:0f:d2:f2:69:
+                    12:4c:bd:23:f5:c6:f7:bb:cf:09:8d:5c:e9:e0:03:
+                    c7:ae:92:64:36:a2:54:14:e7:c6:e5:7b:a2:00:1d:
+                    c8:f8:aa:0e:da:df:c1:35:21:3b:c3:98:0b:30:85:
+                    3c:ca:7c:8e:19:ea:89:0b:0a:32:9f:61:a7:e7:7d:
+                    b8:b9:24:0f:84:e9:f8:80:ac:1d:f3:8a:68:e7:7b:
+                    eb:62:50:d6:19:87:67:98:b2:9b:0e:3b:0e:9c:99:
+                    a2:ed:21:b3:0f:67:25:f2:e2:23:fa:38:23:48:8a:
+                    46:f4:f0:36:b6:ef:38:d5:9f:4e:22:d5:27:94:12:
+                    fd:58:16:69:f8:07:d1:96:70:d2:c0:5f:23:35:2e:
+                    60:8d:8b:bd:3e:48:04:e9:69:96:11:8e:bf:c1:05:
+                    1e:8b:35:93:01:b0:d2:89:6e:55:85:5c:ad:d4:b5:
+                    f6:05:8b:2a:72:8a:b8:10:8f:33:ed:2d:bd:57:b2:
+                    e3:21:7e:a3:2d:f1:06:43:87:c9:f7:62:f6:13:5b:
+                    9f:71
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA1
+                serial:8D:A0:D2:8A:EE:0B:CF:65
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha256WithRSAEncryption
+         29:b0:10:dc:45:ee:68:77:5f:12:9b:fc:de:eb:70:41:2e:6a:
+         a2:5f:a9:cc:ca:97:24:01:4a:1d:c2:78:52:57:34:9c:83:7f:
+         60:f5:d9:68:a2:32:89:e9:d7:25:71:72:71:e5:76:e3:37:af:
+         41:25:cc:8b:a4:fd:81:ef:6b:15:2b:91:3c:68:a5:25:53:cf:
+         c1:b9:aa:49:b4:cd:e3:3c:a2:8e:38:ea:e8:51:7c:7b:92:41:
+         bd:a3:22:7d:97:59:ad:55:e2:7d:9d:6a:bb:1f:95:84:1c:50:
+         00:e9:6c:74:1d:bb:6c:07:ca:bc:6a:a2:dd:c1:66:37:64:bd:
+         fe:1a:c0:8c:a7:8c:a1:60:b8:c3:d2:5f:92:80:ee:ad:79:29:
+         f2:ad:e2:9f:74:39:bf:3b:a4:b6:25:2a:87:3f:36:49:b9:52:
+         fd:91:33:be:1d:41:a9:76:29:47:6e:c7:db:a8:ab:6e:78:91:
+         c0:13:56:1c:25:41:51:a7:64:4f:07:c0:2a:a8:80:63:8d:98:
+         e0:54:7d:a6:f4:22:6b:70:fa:1c:16:82:f4:07:2e:e1:ba:94:
+         96:ec:c7:9e:8e:0a:24:1e:a4:e9:c0:92:ca:bd:32:98:ef:1f:
+         e1:a6:e6:4d:1f:c5:68:1b:77:d0:e0:35:1a:a9:c9:ee:98:72:
+         7b:c3:e7:51
+-----BEGIN CERTIFICATE-----
+MIID9jCCAt6gAwIBAgIJAIYJhVdBv4ZlMA0GCSqGSIb3DQEBCwUAMGsxCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMSMwIQYDVQQDDBpJTlRFUl9DQV9TSEExLVJPT1RfQ0Ff
+U0hBMTAeFw0xNzAzMzAwNDUxMDZaFw0yNzAzMjgwNDUxMDZaMH0xCzAJBgNVBAYT
+AlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3JnMQ0w
+CwYDVQQLDARKYXZhMTUwMwYDVQQDDCxFTkRfRU5USVRZX1NIQTI1Ni1JTlRFUl9D
+QV9TSEExLVJPT1RfQ0FfU0hBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
+ggEBANpiUo1NTWJB6z8G2K+8zWLGMKTWa4zVF0yQlAi1kHbXLWQzU4uncSYYqpWr
+AptLk5OswjGM9TAP0vJpEky9I/XG97vPCY1c6eADx66SZDaiVBTnxuV7ogAdyPiq
+DtrfwTUhO8OYCzCFPMp8jhnqiQsKMp9hp+d9uLkkD4Tp+ICsHfOKaOd762JQ1hmH
+Z5iymw47DpyZou0hsw9nJfLiI/o4I0iKRvTwNrbvONWfTiLVJ5QS/VgWafgH0ZZw
+0sBfIzUuYI2LvT5IBOlplhGOv8EFHos1kwGw0oluVYVcrdS19gWLKnKKuBCPM+0t
+vVey4yF+oy3xBkOHyfdi9hNbn3ECAwEAAaOBijCBhzB3BgNVHSMEcDBuoWGkXzBd
+MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDTALBgNVBAcMBENpdHkxDDAKBgNV
+BAoMA09yZzENMAsGA1UECwwESmF2YTEVMBMGA1UEAwwMUk9PVF9DQV9TSEExggkA
+jaDSiu4Lz2UwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAKbAQ3EXu
+aHdfEpv83utwQS5qol+pzMqXJAFKHcJ4Ulc0nIN/YPXZaKIyienXJXFyceV24zev
+QSXMi6T9ge9rFSuRPGilJVPPwbmqSbTN4zyijjjq6FF8e5JBvaMifZdZrVXifZ1q
+ux+VhBxQAOlsdB27bAfKvGqi3cFmN2S9/hrAjKeMoWC4w9JfkoDurXkp8q3in3Q5
+vzuktiUqhz82SblS/ZEzvh1BqXYpR27H26irbniRwBNWHCVBUadkTwfAKqiAY42Y
+4FR9pvQia3D6HBaC9Acu4bqUluzHno4KJB6k6cCSyr0ymO8f4abmTR/FaBt30OA1
+GqnJ7phye8PnUQ==
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDaCsiXcNnu7WpV
+t+FarvFhtaRr4RMQbKGhiIHi4aV0vqWmpX/eFde01eQZTZcPGJzEnjJrkyFo3Wbd
+31bjBLpt40kkI7kbODHrA2L+vY/hoCQeXK8+BrGioX9qHOpD7OLI3Esm1+KDiPPK
+w6qr9O9nS/fOID3zly92r+obY2ZuW6jQC0Yah3K9INrSIjH+rHXsmj2U5dCnktfi
+LzRcocvqtQHASYXFXEhWr1TCMnSz7h+l07O5YgYpmhwkRIPCkcdP+9wGhO2eOJYU
+kfaBteodDh7vHj2F+A6Lheosa4mi/nysyhQJl8uBFw97dqab9ul5Tb03iHmaY/q0
+xJKcEohnAgMBAAECggEBAJsa6K6yHJWWVfo8IBb+M7+qExiat5ELdb8O+DaJBcYS
+iIwPVvKI3zVIokZNp5OZkotbbcqQk0ehl7dlVM2RY30gHbuTne36/6eKdTV5a4y4
++niOviqFYH+sGpNFlnBTZtAzxVIQaJXhKmum3RYN2u/EXrdGwEsz1RO89/AbuZXu
+VdtEKkjPHXrIjnBkiT4271sm3OiPwOe6g0NKBMJ4InTyB+YtpgxlXtF+vv5cv6Vt
+ayT3sNsdsD8HLrenMmwv/k7nTYgNbhaJX2YCs9W7ZEscU2th6F7Cx6Z0z9h1SElC
++OKKhU6HnG/pWFMfWu80ZNjb3NTpXzTv4CLKjEYvz6ECgYEA8qEe+Ga7+XD0XwPB
+bFjoKmhOQhv0VCIiu9RgvIxQn5DuGX4H2hO1GP8LYOQZBm25nICIa+DyDZEaFGgL
+QgfPI4boK/rdV8syFTUNfw1Wq+W/pHhqzgUGHAnzRpX8jBQa9of14O+B7//ZFdGj
+5nt0qFTOAgNGslXMvSicKD/g0mMCgYEA5g7MpMmZI8zPf/PKLBkrQegdX2TBBiI5
+3KzvQuA29tEFdVwUIuhkgQkmy1u9Ujw0jZZ8NVBOsqfg7e7XkVr6/OF+MVWBjWl3
+Jn3DMCHl/HCLIZ4ZOM6/ydIMpBX6Ii53nvpO6vxRaOUg2T2gVHadVjjQAN9Oj68r
+TKUHfs4rTy0CgYB/g5QuQnfqKaYUxXmDQtqJZxYyAlUPXn1Yr85DaY75vYaVGTpx
+L0hPIcNOIbLRQRt6l8aaw7cS0D6fmOrJwibn6f/dFVP8zwq8QIyeSFlTsERe4PZo
+3hUO6V/UqgD3cZ2WEXB0zgtBIfpqUCpOeHWf/inivuwJz7PxegVP1fqHNwKBgA0p
+CZHfqm/+1lvmcUlGg0/43D1JwTT9nju+dM1pkBtcZ6iIBOreSmmLQXnenJzorsTu
+t9pA5s+XhOl3gUNiZfszVwmxb4DMaLF9/j1xovtm4L6ikaTLRvNfnbOBQlbUO6mP
+fhY5KtsKSG/E87gBNQzqoRN7sr3Lcnmm8x/Q4W9dAoGAITDcOI7UgPcnKMO8JUI5
+96Po3c/S7nBilVZRFOwjn0z6jrjzNTd+1IqkzIKBWfs5WlRkzXI6LPJVghwPUqUa
+q2C/3hQATD3FchEIohLfd8bj/wObaZNlKJB59a1RjxRZxuVQl3jvovvpn/hdXuJB
+nGIx7MryEG/yRpfrk2DL0bI=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,81 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            9e:f7:d7:79:1c:06:83:d5
+    Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA1-ROOT_CA_SHA256
+        Validity
+            Not Before: Mar 30 04:51:05 2017 GMT
+            Not After : Mar 28 04:51:05 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256-PRIV
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:da:0a:c8:97:70:d9:ee:ed:6a:55:b7:e1:5a:ae:
+                    f1:61:b5:a4:6b:e1:13:10:6c:a1:a1:88:81:e2:e1:
+                    a5:74:be:a5:a6:a5:7f:de:15:d7:b4:d5:e4:19:4d:
+                    97:0f:18:9c:c4:9e:32:6b:93:21:68:dd:66:dd:df:
+                    56:e3:04:ba:6d:e3:49:24:23:b9:1b:38:31:eb:03:
+                    62:fe:bd:8f:e1:a0:24:1e:5c:af:3e:06:b1:a2:a1:
+                    7f:6a:1c:ea:43:ec:e2:c8:dc:4b:26:d7:e2:83:88:
+                    f3:ca:c3:aa:ab:f4:ef:67:4b:f7:ce:20:3d:f3:97:
+                    2f:76:af:ea:1b:63:66:6e:5b:a8:d0:0b:46:1a:87:
+                    72:bd:20:da:d2:22:31:fe:ac:75:ec:9a:3d:94:e5:
+                    d0:a7:92:d7:e2:2f:34:5c:a1:cb:ea:b5:01:c0:49:
+                    85:c5:5c:48:56:af:54:c2:32:74:b3:ee:1f:a5:d3:
+                    b3:b9:62:06:29:9a:1c:24:44:83:c2:91:c7:4f:fb:
+                    dc:06:84:ed:9e:38:96:14:91:f6:81:b5:ea:1d:0e:
+                    1e:ef:1e:3d:85:f8:0e:8b:85:ea:2c:6b:89:a2:fe:
+                    7c:ac:ca:14:09:97:cb:81:17:0f:7b:76:a6:9b:f6:
+                    e9:79:4d:bd:37:88:79:9a:63:fa:b4:c4:92:9c:12:
+                    88:67
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256
+                serial:84:A1:70:1D:0A:92:D3:CD
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha256WithRSAEncryption
+         89:84:ce:6d:80:83:e7:19:80:21:a5:d3:79:ac:c4:2f:5c:5f:
+         47:f1:1c:e7:40:2a:57:ec:76:01:a9:10:b6:a2:2b:1b:02:ac:
+         f7:46:b1:67:b3:36:0f:fa:f0:a3:40:c2:5a:38:00:67:a9:9d:
+         e8:59:be:2f:5b:d0:c6:6c:20:90:c0:3b:6b:af:75:8c:93:ac:
+         5a:1e:8b:66:2c:79:0b:6d:9d:0d:d3:68:b5:b6:df:d6:04:6b:
+         24:f7:5a:b9:f0:18:08:81:b1:50:1c:ac:1b:7a:b7:b8:d8:8e:
+         6f:15:78:7e:23:5f:41:5c:df:76:09:1a:67:36:15:35:6a:77:
+         36:09:19:50:12:6d:60:20:c1:7a:36:cb:4c:ee:a8:d7:b7:c7:
+         29:26:31:04:0a:44:48:25:be:dd:00:92:ea:8c:00:ee:b4:eb:
+         52:4a:da:47:97:d7:42:df:dd:7d:17:de:e3:a1:14:49:3b:2d:
+         aa:ac:e7:83:0f:c0:2d:3f:31:c5:af:bb:b1:1e:53:d1:a7:13:
+         55:e3:25:f6:67:95:a1:75:e9:b8:a1:81:eb:d0:de:8a:a3:af:
+         78:dc:d0:39:d0:e7:d6:61:9e:39:7b:8b:f9:ee:44:48:78:92:
+         e7:22:fa:9c:a4:d0:6b:2b:89:0a:fa:78:3d:7a:af:44:91:e5:
+         8a:40:2f:10
+-----BEGIN CERTIFICATE-----
+MIIEAjCCAuqgAwIBAgIJAJ7313kcBoPVMA0GCSqGSIb3DQEBCwUAMG0xCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMSUwIwYDVQQDDBxJTlRFUl9DQV9TSEExLVJPT1RfQ0Ff
+U0hBMjU2MB4XDTE3MDMzMDA0NTEwNVoXDTI3MDMyODA0NTEwNVowgYQxCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMTwwOgYDVQQDDDNFTkRfRU5USVRZX1NIQTI1Ni1JTlRF
+Ul9DQV9TSEExLVJPT1RfQ0FfU0hBMjU2LVBSSVYwggEiMA0GCSqGSIb3DQEBAQUA
+A4IBDwAwggEKAoIBAQDaCsiXcNnu7WpVt+FarvFhtaRr4RMQbKGhiIHi4aV0vqWm
+pX/eFde01eQZTZcPGJzEnjJrkyFo3Wbd31bjBLpt40kkI7kbODHrA2L+vY/hoCQe
+XK8+BrGioX9qHOpD7OLI3Esm1+KDiPPKw6qr9O9nS/fOID3zly92r+obY2ZuW6jQ
+C0Yah3K9INrSIjH+rHXsmj2U5dCnktfiLzRcocvqtQHASYXFXEhWr1TCMnSz7h+l
+07O5YgYpmhwkRIPCkcdP+9wGhO2eOJYUkfaBteodDh7vHj2F+A6Lheosa4mi/nys
+yhQJl8uBFw97dqab9ul5Tb03iHmaY/q0xJKcEohnAgMBAAGjgYwwgYkweQYDVR0j
+BHIwcKFjpGEwXzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQHDARD
+aXR5MQwwCgYDVQQKDANPcmcxDTALBgNVBAsMBEphdmExFzAVBgNVBAMMDlJPT1Rf
+Q0FfU0hBMjU2ggkAhKFwHQqS080wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsF
+AAOCAQEAiYTObYCD5xmAIaXTeazEL1xfR/Ec50AqV+x2AakQtqIrGwKs90axZ7M2
+D/rwo0DCWjgAZ6md6Fm+L1vQxmwgkMA7a691jJOsWh6LZix5C22dDdNotbbf1gRr
+JPdaufAYCIGxUBysG3q3uNiObxV4fiNfQVzfdgkaZzYVNWp3NgkZUBJtYCDBejbL
+TO6o17fHKSYxBApESCW+3QCS6owA7rTrUkraR5fXQt/dfRfe46EUSTstqqzngw/A
+LT8xxa+7sR5T0acTVeMl9meVoXXpuKGB69DeiqOveNzQOdDn1mGeOXuL+e5ESHiS
+5yL6nKTQayuJCvp4PXqvRJHlikAvEA==
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHC0ieOFNTJjP+
+HMlFQ/w50Hx/+FYh9z9w3i08dVvi8oEhGUop7fvsqEyuAj3U/BYG87Wsv27wfa9l
+qSJRSgqUT3yI4jsMY/ozUInuKpp/yL97abyZVDUZc3diDZqryA/Qur8HNVLyA2hD
+DA9x8Ioeu5EDFl7AeqV3jx+A8fbulwVeCa29GByVkWRUEVF/48a1jpazBf2YQvrm
+5ElWoG8fuMrz6vgj+gYZYb1GPXmJQrtAIRp4Z1/AquPS4A/O21DnPLEM8WSw+rSC
+KGGKMqefJw74zeVyPlOiOmjFTeNfeVDViQrDgU++CTDjFa8XhweU6v+MtY5Mmzmf
+2AETGyd9AgMBAAECggEANCdMu8hebOcRsH+ybSfHKw7p0E4to3C5esV8bN8DWI/a
+LeYGfL4SyIvAq8eClBAJZYDuFXmDhBgqoSSUDWCtLPc21lcQycpYgKGVwoX/PYRI
+R/oIpNRfpW+P1G1kHaaqHjMQYr8iIK+r3gWG9n/kcPEMqhZudVitiopB4vODlDgf
+OI0goNWwYOPzoBkJSBbgfYC7vSz0dg+j9ooYPDnyUnHjykhu95mkmBHYc/MVMP8s
+ntFB5pgtWuLQATZImW4A1dtZiqCsF6APvJIQASxVq+wv3dwhejF9xMZR96QchVZJ
+QvPOcH76njIH4fThb0e46Dn54+KBpCnveSnDtAz5sQKBgQD2u6gWOK/Z4VqGlff1
+diLqzesdalCJhydKzOGRzRiJeW4E4MhEpUjIo44zPGkQ64zq6nefqIltdiaE7T9C
+Fnyu/+vd0zE1v3Ipgv0wD3NgTj3gGrBwl2gkY5sfSbCR+8vS/DhRU+s3KN45m3s4
+XfM27Uw/Zh/DFIe7jmGezfe/3wKBgQDOhRjDfxDDLCEXw4QFQb7Sp/43EGfoTd8h
+m700T/QXUTGx6qRhzHF9mUVea7FT+3I6CEqYNnZtFlYsJlq1g457rnvUJnTjJZb7
+wFl1h+u4u3IKo/lUUh2vD89PPOkMUF/uamJLh5jK7KNkOjwEDN2yPkRgaedY++nv
+NBcUPpGUIwKBgEkFmOWauVC+hVA3qj8XS5Y6g08dW+CYA2T75faEwLJPIeSHsj2+
+vR/EaB15z46WaApOgkDaXHHs+dF1dbdVeGlCjMgF7RZ/JoZqogxLRlZGUcG1pGpu
+JQBACnTkFkHeR6CVzQUk1QRqL/rUrU8tXwHukRZiXxwZQ2Ka7QFW6+/5AoGAHGem
+Dk2NyqppKtGTeP2f921vw7cX85WyWPcIwQc2NXbPdP8m+OSbv4CzT9dUHo75GQ5G
+5ESpaTunQo9L7qdXk59eHMHlVdC3wYylQUsemtv9RYVkJ7rbplZwVx+zliP/7dTo
+DCdsVozRtFlmI9B5Najm0rP+Q/jyJhpuCjTI5S0CgYEAsYcmFZZotwOyT4oJ/1Fu
+BtSOsoxnCa1vPJTVXEoX3F28ZUP4X0iWgGDO1e3aoWWYxWusf1fUj9BWbVnbtJfb
+gJ5JtQTAuMvmjCwFRWcBUytdxTUsWFbuDc5fw7DMW7YqjkCCISkd6Q8JyaFsJPy1
+7uFzumBnFtZGUIo2w4l8yrQ=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,81 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            9e:b3:99:30:15:24:2c:69
+    Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA256-ROOT_CA_SHA1
+        Validity
+            Not Before: Mar 30 04:51:06 2017 GMT
+            Not After : Mar 28 04:51:06 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:c7:0b:48:9e:38:53:53:26:33:fe:1c:c9:45:43:
+                    fc:39:d0:7c:7f:f8:56:21:f7:3f:70:de:2d:3c:75:
+                    5b:e2:f2:81:21:19:4a:29:ed:fb:ec:a8:4c:ae:02:
+                    3d:d4:fc:16:06:f3:b5:ac:bf:6e:f0:7d:af:65:a9:
+                    22:51:4a:0a:94:4f:7c:88:e2:3b:0c:63:fa:33:50:
+                    89:ee:2a:9a:7f:c8:bf:7b:69:bc:99:54:35:19:73:
+                    77:62:0d:9a:ab:c8:0f:d0:ba:bf:07:35:52:f2:03:
+                    68:43:0c:0f:71:f0:8a:1e:bb:91:03:16:5e:c0:7a:
+                    a5:77:8f:1f:80:f1:f6:ee:97:05:5e:09:ad:bd:18:
+                    1c:95:91:64:54:11:51:7f:e3:c6:b5:8e:96:b3:05:
+                    fd:98:42:fa:e6:e4:49:56:a0:6f:1f:b8:ca:f3:ea:
+                    f8:23:fa:06:19:61:bd:46:3d:79:89:42:bb:40:21:
+                    1a:78:67:5f:c0:aa:e3:d2:e0:0f:ce:db:50:e7:3c:
+                    b1:0c:f1:64:b0:fa:b4:82:28:61:8a:32:a7:9f:27:
+                    0e:f8:cd:e5:72:3e:53:a2:3a:68:c5:4d:e3:5f:79:
+                    50:d5:89:0a:c3:81:4f:be:09:30:e3:15:af:17:87:
+                    07:94:ea:ff:8c:b5:8e:4c:9b:39:9f:d8:01:13:1b:
+                    27:7d
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA1
+                serial:8D:A0:D2:8A:EE:0B:CF:64
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha256WithRSAEncryption
+         2b:43:e4:c1:37:36:00:a3:ed:25:15:c7:9f:6b:25:0e:24:cd:
+         1c:e8:d2:8c:a6:11:05:a9:2b:b5:dc:7b:fd:55:8e:be:1d:15:
+         d7:8b:a8:a6:44:cf:03:ba:ba:78:74:26:b9:19:11:c0:03:9b:
+         4d:2f:f9:f7:ea:da:a3:2f:82:f9:9e:d0:77:d6:bf:eb:fd:57:
+         c8:eb:03:54:0a:0c:2b:36:0c:e5:99:b7:93:4d:a9:9d:e9:50:
+         80:66:4e:73:c1:bd:83:13:09:ee:b9:01:62:ed:90:0e:4f:ff:
+         9d:92:f3:cd:db:1f:ba:da:fc:67:9d:cb:a0:09:99:8b:3e:ea:
+         9d:61:55:ac:6f:fb:11:5c:c0:fe:fb:ff:5b:15:7d:a7:c1:aa:
+         3a:cd:30:43:35:ea:44:8a:21:ae:9f:af:bc:5c:ae:3a:01:2c:
+         3b:eb:b6:8c:6a:e1:1c:4e:55:0a:84:5b:f8:68:71:aa:97:02:
+         9b:5d:c4:c9:42:df:19:91:28:4a:12:35:8d:2e:3d:10:ec:35:
+         8a:b1:d7:e0:e2:a6:f9:f6:47:4b:17:75:84:8e:2d:66:e8:74:
+         be:d6:27:6b:a2:28:23:26:41:70:92:c2:7c:50:e2:81:c9:e0:
+         10:84:5d:87:4f:db:93:ce:dd:09:d2:48:63:3d:53:66:31:64:
+         5a:13:b5:a6
+-----BEGIN CERTIFICATE-----
+MIID+jCCAuKgAwIBAgIJAJ6zmTAVJCxpMA0GCSqGSIb3DQEBCwUAMG0xCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMSUwIwYDVQQDDBxJTlRFUl9DQV9TSEEyNTYtUk9PVF9D
+QV9TSEExMB4XDTE3MDMzMDA0NTEwNloXDTI3MDMyODA0NTEwNlowfzELMAkGA1UE
+BhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQHDARDaXR5MQwwCgYDVQQKDANPcmcx
+DTALBgNVBAsMBEphdmExNzA1BgNVBAMMLkVORF9FTlRJVFlfU0hBMjU2LUlOVEVS
+X0NBX1NIQTI1Ni1ST09UX0NBX1NIQTEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
+ggEKAoIBAQDHC0ieOFNTJjP+HMlFQ/w50Hx/+FYh9z9w3i08dVvi8oEhGUop7fvs
+qEyuAj3U/BYG87Wsv27wfa9lqSJRSgqUT3yI4jsMY/ozUInuKpp/yL97abyZVDUZ
+c3diDZqryA/Qur8HNVLyA2hDDA9x8Ioeu5EDFl7AeqV3jx+A8fbulwVeCa29GByV
+kWRUEVF/48a1jpazBf2YQvrm5ElWoG8fuMrz6vgj+gYZYb1GPXmJQrtAIRp4Z1/A
+quPS4A/O21DnPLEM8WSw+rSCKGGKMqefJw74zeVyPlOiOmjFTeNfeVDViQrDgU++
+CTDjFa8XhweU6v+MtY5Mmzmf2AETGyd9AgMBAAGjgYowgYcwdwYDVR0jBHAwbqFh
+pF8wXTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQHDARDaXR5MQww
+CgYDVQQKDANPcmcxDTALBgNVBAsMBEphdmExFTATBgNVBAMMDFJPT1RfQ0FfU0hB
+MYIJAI2g0oruC89kMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBACtD
+5ME3NgCj7SUVx59rJQ4kzRzo0oymEQWpK7Xce/1Vjr4dFdeLqKZEzwO6unh0JrkZ
+EcADm00v+ffq2qMvgvme0HfWv+v9V8jrA1QKDCs2DOWZt5NNqZ3pUIBmTnPBvYMT
+Ce65AWLtkA5P/52S883bH7ra/Gedy6AJmYs+6p1hVaxv+xFcwP77/1sVfafBqjrN
+MEM16kSKIa6fr7xcrjoBLDvrtoxq4RxOVQqEW/hocaqXAptdxMlC3xmRKEoSNY0u
+PRDsNYqx1+Dipvn2R0sXdYSOLWbodL7WJ2uiKCMmQXCSwnxQ4oHJ4BCEXYdP25PO
+3QnSSGM9U2YxZFoTtaY=
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDuH2+6I/ytoLeW
+AG3J0xMQafYmxYDZNaDjiWBl7TGpL4TjRY84FuHI/G8ib0VY9DKtyUixm7qZev+b
+ExrfQGk9ZV7Dn41uBvmGcUMSqwb0QV/5/hneP7/3EXhoWjsCFUe0r0zOgCM7O9+F
+jUlSuxEHyaFE09PxWGVZpU4Yu71PeoI/JJGITV81o2Fst7Urz65NE5OWrvbO+pfD
+EiRvjLv/uil7znYV28lCbH7U1K8q5nGVtnpgTguhGL6/N3lIgvxoBtoXEQwdMV59
+APsH8anA19rHn5h/ZmknryxAs0c6Rg9Plo30MonIU/eAVZwNw8TczD276Rc02xnW
+RmbmxToRAgMBAAECggEAbK3OWV9JWJlMkNqbQQzj247w+FsV5ozSZGbzpzFtg/Eb
+Lns11XykCg4kTswIE4RIiQaf9efEb34yoL1Ee3YzUgEtEg2FCB2IzvJskV2ba+lW
+e4uclNH1tDa2BLKB0f6SXoXPgUP8UHGQH60PNQIJ0MsWnoorZjBY+WQ305QD3/yB
+fMonkjpWN+ZNTY8Y3vA2SsS4EoY0Ndy2FpmWPwKKMCcqXw6xzVjKvq+jpFfsGpcj
+i3MlKsCG5koreWrXdyt28CVOc6eMW5rsJfAHRw+OSn7PdLaGyZCUUsFXCjG0Vq2G
+YwuMfTJprrZk+lbi3XUXWk7XUEURB7Q4lIBxAcskAQKBgQD8pVj0OIsVHAGjQQ7C
+ZAnxFlON7XX3fgPdLtil9c+a1GlcPA2K52fBp8YlKlAS4bmZIQHbbkEBjh8KfG1P
+x7zBHoUXV8ruo/axzRPoeBVQat5NQKcKnlITrqdf8J3a+8iMxpMpd53h97HGiayq
+W04ZQNf7wjXvR+pJVluTEaoVUQKBgQDxSLruMmCsYvD+sipaQ3rBEMIAI3kc7ctl
+fEnipEk5wtPkKKldw+rvbh/AwY2i2JMUDcW92hkB5vCvbcKmCEkEO3FbawNkJnJi
+qfwbvHP/fGThMV3gbWWF3GZvBKY2+toSa2rwoR5kYTT1e4+byk38NAp/HAItFHIT
+DgAgMy6owQKBgQCjd8jKnBtBmVFl9B48oMXd+/gsCM0fSaXuYvVCzH17TJyvVRve
+GEQGBSwrt+j/jpWsArNU602cV/y1qDSCPlZfDgRHSkK/jc9805hh/fCsi7kyevaZ
+5D5vBb6+UM2Sdv8YNxPY7NB2+PFJ6KKTx2gM5uvYtZx4KivpL7souXE3QQKBgDxg
+FZ5q7rPUIjepP13MyteqqNC+D51Eh4PCgP58W3JfpQPPhOnYj14QMVPbWuSnys3W
+0Gc8PsuyDQHoti8znYm4khntAjE6SZ8Up+gM1P3WE6wh3Tq+RQwk5WDcSfcx+AVp
+6Z2Cw4ccp9LRc1LpYXA9WW8LBCRhnFXWSAPGquNBAoGAdCsvFzSipQ5qxWPlClRM
+lKqDdQheRl9IKCuImXZAvdX952VhmP7QV5PUwLV/CkVquvSdRSshrMO/fqFjfkjr
+puajXghFXa+YppQW42tPYBmKDnNVgxW5d5sC62AYaykh2iNw3v4BJyN+MMmkSf0M
+4/mKvs5m8N2OkOpY6r2wCp8=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,81 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            e8:33:78:c7:69:9c:28:c1
+    Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA256-ROOT_CA_SHA256
+        Validity
+            Not Before: Mar 30 04:51:04 2017 GMT
+            Not After : Mar 28 04:51:04 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:ee:1f:6f:ba:23:fc:ad:a0:b7:96:00:6d:c9:d3:
+                    13:10:69:f6:26:c5:80:d9:35:a0:e3:89:60:65:ed:
+                    31:a9:2f:84:e3:45:8f:38:16:e1:c8:fc:6f:22:6f:
+                    45:58:f4:32:ad:c9:48:b1:9b:ba:99:7a:ff:9b:13:
+                    1a:df:40:69:3d:65:5e:c3:9f:8d:6e:06:f9:86:71:
+                    43:12:ab:06:f4:41:5f:f9:fe:19:de:3f:bf:f7:11:
+                    78:68:5a:3b:02:15:47:b4:af:4c:ce:80:23:3b:3b:
+                    df:85:8d:49:52:bb:11:07:c9:a1:44:d3:d3:f1:58:
+                    65:59:a5:4e:18:bb:bd:4f:7a:82:3f:24:91:88:4d:
+                    5f:35:a3:61:6c:b7:b5:2b:cf:ae:4d:13:93:96:ae:
+                    f6:ce:fa:97:c3:12:24:6f:8c:bb:ff:ba:29:7b:ce:
+                    76:15:db:c9:42:6c:7e:d4:d4:af:2a:e6:71:95:b6:
+                    7a:60:4e:0b:a1:18:be:bf:37:79:48:82:fc:68:06:
+                    da:17:11:0c:1d:31:5e:7d:00:fb:07:f1:a9:c0:d7:
+                    da:c7:9f:98:7f:66:69:27:af:2c:40:b3:47:3a:46:
+                    0f:4f:96:8d:f4:32:89:c8:53:f7:80:55:9c:0d:c3:
+                    c4:dc:cc:3d:bb:e9:17:34:db:19:d6:46:66:e6:c5:
+                    3a:11
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256
+                serial:84:A1:70:1D:0A:92:D3:CC
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha256WithRSAEncryption
+         1d:1a:87:7d:11:0e:cc:cd:7f:6c:ed:21:1a:2c:35:de:09:b8:
+         c4:cf:0c:31:00:3d:f5:bd:d4:6e:f0:4f:7e:c2:8d:d6:c5:28:
+         ed:38:9d:d7:52:32:e2:8d:7b:64:c8:1d:4e:69:7e:49:5f:e1:
+         5e:04:c7:d3:96:d2:63:ef:2c:35:4f:eb:08:2b:9d:b0:15:df:
+         33:d8:1c:59:8e:bb:f1:28:4f:f0:85:bb:3c:56:e1:86:a4:75:
+         2b:44:8a:1c:98:ae:94:f3:b6:76:a9:a3:e7:d6:bc:58:ef:fe:
+         32:11:6f:76:5b:85:f8:14:91:83:2c:b6:20:a5:48:48:8b:6e:
+         ee:a8:6c:2b:12:18:94:3e:59:5e:a6:66:53:dc:40:b2:da:fd:
+         a4:5f:16:35:b6:20:2b:31:86:9b:91:55:b2:35:63:d2:47:bd:
+         91:7e:43:bc:d6:0e:dc:95:1a:f0:8d:08:e5:66:cd:d1:0b:32:
+         d6:92:26:3e:78:e8:70:74:e1:14:64:b0:39:5d:7c:d0:28:23:
+         c7:83:53:02:90:fe:fc:9e:aa:9a:fb:c4:ef:9d:d5:22:f6:c1:
+         fd:e4:07:04:25:4f:8f:b2:13:6f:0d:51:cc:54:b4:38:d3:ac:
+         31:aa:94:c5:d0:c8:5a:58:35:13:87:3e:f6:74:26:8c:2b:7d:
+         6c:8e:36:a5
+-----BEGIN CERTIFICATE-----
+MIIEATCCAumgAwIBAgIJAOgzeMdpnCjBMA0GCSqGSIb3DQEBCwUAMG8xCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMScwJQYDVQQDDB5JTlRFUl9DQV9TSEEyNTYtUk9PVF9D
+QV9TSEEyNTYwHhcNMTcwMzMwMDQ1MTA0WhcNMjcwMzI4MDQ1MTA0WjCBgTELMAkG
+A1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQHDARDaXR5MQwwCgYDVQQKDANP
+cmcxDTALBgNVBAsMBEphdmExOTA3BgNVBAMMMEVORF9FTlRJVFlfU0hBMjU2LUlO
+VEVSX0NBX1NIQTI1Ni1ST09UX0NBX1NIQTI1NjCCASIwDQYJKoZIhvcNAQEBBQAD
+ggEPADCCAQoCggEBAO4fb7oj/K2gt5YAbcnTExBp9ibFgNk1oOOJYGXtMakvhONF
+jzgW4cj8byJvRVj0Mq3JSLGbupl6/5sTGt9AaT1lXsOfjW4G+YZxQxKrBvRBX/n+
+Gd4/v/cReGhaOwIVR7SvTM6AIzs734WNSVK7EQfJoUTT0/FYZVmlThi7vU96gj8k
+kYhNXzWjYWy3tSvPrk0Tk5au9s76l8MSJG+Mu/+6KXvOdhXbyUJsftTUryrmcZW2
+emBOC6EYvr83eUiC/GgG2hcRDB0xXn0A+wfxqcDX2sefmH9maSevLECzRzpGD0+W
+jfQyichT94BVnA3DxNzMPbvpFzTbGdZGZubFOhECAwEAAaOBjDCBiTB5BgNVHSME
+cjBwoWOkYTBfMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDTALBgNVBAcMBENp
+dHkxDDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEXMBUGA1UEAwwOUk9PVF9D
+QV9TSEEyNTaCCQCEoXAdCpLTzDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUA
+A4IBAQAdGod9EQ7MzX9s7SEaLDXeCbjEzwwxAD31vdRu8E9+wo3WxSjtOJ3XUjLi
+jXtkyB1OaX5JX+FeBMfTltJj7yw1T+sIK52wFd8z2BxZjrvxKE/whbs8VuGGpHUr
+RIocmK6U87Z2qaPn1rxY7/4yEW92W4X4FJGDLLYgpUhIi27uqGwrEhiUPllepmZT
+3ECy2v2kXxY1tiArMYabkVWyNWPSR72RfkO81g7clRrwjQjlZs3RCzLWkiY+eOhw
+dOEUZLA5XXzQKCPHg1MCkP78nqqa+8TvndUi9sH95AcEJU+PshNvDVHMVLQ406wx
+qpTF0MhaWDUThz72dCaMK31sjjal
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDX1pPNXGpnPQNc
+x9ReXrjbcHkIoyXcdXbhO0TnUBV5aGJTEn5/meDsK76Y2KDVyU/EO2jXpaQ5QiGn
+UzY6vKIn6boqTov4NLYwBsVPdAG/xZyr5q7p6bnJ8WRj40A2JeOeZ3FMglRtBCNg
+rYeEC4MDp2F41OVxsJZ4huodq94arqhD/hjE40g06UNa0I+/2dIpI2cSamIC5b3L
+/DK3ol+gIw/OOxMCgzAUSjeH6nTrrW1hUeSKx0NPGWRLWzLQ2yxhYcXlsedNuKHo
+ux/p3EkGXoGPajK7s7IlKj9CPQYwlQez37jCLJGovArqTr/8hxfrKMdZOl5bp+6H
+6uWh6af7AgMBAAECggEAXrUsM79qfRR7pjmVCTe9G6T1pwGXum3clSYhrPIqChTw
+mA0Ubr9Bv7/OKVlc8ZIdKzj6Xy2yquFGzRopQIrHCIZ5htjieC4BB3/hEmUP42s9
+vPxDIibJvD/s0hvEcD4d68LuJylFDHT1ZRWf0iQPAApxLckVSNa4n/hrQEvK8J+G
+HIH8VATq9iHp/GQmmFB8b3ubqn46zDGqly14+TGP2KtVJlY9FuCpvmtZZZjJ+K09
+vYM+BATwje6N6PqX5a3Z+NFC1NK9CmC+U6ECJ27uhySn8kvlU/i/SOAnrPftByO7
+g7K8p2Qzq1LlVIUU/JTidNZGXTaTMOVg8eHLmyt92QKBgQD9a94rLqk9BUtVsTYa
+AImt+KbUMB+Zi83cYDiCfNBkfIYw4dVUFJecmqZwg7IeqNwuSmXP41fASOvDel/L
+8bOj/rPccVSG9pmU0ir5WK9n8zobogfAzvaFr8cmo+TVv0FOZZA8e/+UfVsiKAsW
+3nwhwxN8ieILU1dtaNV1IfnAPwKBgQDaCM9URf+DFILI2WpuzKpk1loF6HrlklIn
++N0IFFcalqUpC8GhXTw7suypRBCZ+cp32h7WEcN9aHLMrnkDQP3bGTv53pJT5N9k
+7nk9Bfrk0CJCxeMRKwtuMhLkOmT0eh2aB1lWR0owA5b1Gjtiz5kTW7NN2+paJCDz
+SiDLVoFpRQKBgQCHvt0N4nuy/QACkd86BGm7b8LlTDXRCMsnrb73XqY9/VngG0gr
+NrCTqV9YS6MAu1Dd1uo8djnN/QGU/xsLYpfoU4nCnk450SQpTH7Ke8/Rbb8FiECA
+7hutNqAFuardOApiVRLy4zTfNFq5rBtsj5aMezMX9b/Ic0cUiyA0ExP1/wKBgQCp
+SDvI34wRdqRQUtWa7xbAsdg1TBnXEjLtTAA4nKpAP4Q+CR2uLlhstW+fv/PvyIwV
+X+mfJS2VubmgBzp3d0dhjAcP6mnL7yAvGiRRZ8ozSxG+rCuvEa+PQBuAzYHCeulu
+xJPtM+56tt7GsDY5cpsT95eQNNWQZQqcOgqaNTDGzQKBgCmMwRP1HN0qUSSVO1d8
+8N17OoZe5yntppEjesYQrLf4AEgPS3Qj8dv0qfe3z1B0gAKlG9+OR8cUBCMGVyum
+b51SiSi3LSm1VeuMfT7JDMSxTkbaI5CY7v+/5yCRFqikgBtCkHM9m4K95d3dVDO8
+JGrlKiKVIbu5LnQZMkPHRIEX
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA1.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,80 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            8d:a0:d2:8a:ee:0b:cf:65
+    Signature Algorithm: sha1WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA1
+        Validity
+            Not Before: Mar 30 04:51:04 2017 GMT
+            Not After : Mar 28 04:51:04 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA1-ROOT_CA_SHA1
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:d7:d6:93:cd:5c:6a:67:3d:03:5c:c7:d4:5e:5e:
+                    b8:db:70:79:08:a3:25:dc:75:76:e1:3b:44:e7:50:
+                    15:79:68:62:53:12:7e:7f:99:e0:ec:2b:be:98:d8:
+                    a0:d5:c9:4f:c4:3b:68:d7:a5:a4:39:42:21:a7:53:
+                    36:3a:bc:a2:27:e9:ba:2a:4e:8b:f8:34:b6:30:06:
+                    c5:4f:74:01:bf:c5:9c:ab:e6:ae:e9:e9:b9:c9:f1:
+                    64:63:e3:40:36:25:e3:9e:67:71:4c:82:54:6d:04:
+                    23:60:ad:87:84:0b:83:03:a7:61:78:d4:e5:71:b0:
+                    96:78:86:ea:1d:ab:de:1a:ae:a8:43:fe:18:c4:e3:
+                    48:34:e9:43:5a:d0:8f:bf:d9:d2:29:23:67:12:6a:
+                    62:02:e5:bd:cb:fc:32:b7:a2:5f:a0:23:0f:ce:3b:
+                    13:02:83:30:14:4a:37:87:ea:74:eb:ad:6d:61:51:
+                    e4:8a:c7:43:4f:19:64:4b:5b:32:d0:db:2c:61:61:
+                    c5:e5:b1:e7:4d:b8:a1:e8:bb:1f:e9:dc:49:06:5e:
+                    81:8f:6a:32:bb:b3:b2:25:2a:3f:42:3d:06:30:95:
+                    07:b3:df:b8:c2:2c:91:a8:bc:0a:ea:4e:bf:fc:87:
+                    17:eb:28:c7:59:3a:5e:5b:a7:ee:87:ea:e5:a1:e9:
+                    a7:fb
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA1
+                serial:F1:3B:B7:FB:28:3F:52:09
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha1WithRSAEncryption
+         d3:ce:da:23:e1:7c:73:fb:7f:26:d7:a4:3c:7b:17:01:75:ce:
+         a5:bd:75:f1:65:1b:56:27:ae:f8:97:a6:c4:ca:94:93:c9:12:
+         bb:c7:ec:2b:d5:38:d5:43:3a:6c:c2:51:3a:79:2f:d7:4e:da:
+         2d:12:1f:b8:c2:4f:c8:ba:33:d3:f5:0c:78:cc:26:69:24:47:
+         3f:ed:17:a0:7f:d0:20:fe:11:ca:75:50:1a:61:e1:91:b5:fa:
+         91:04:e9:14:59:77:d4:29:0f:43:19:e0:dc:dd:a6:18:14:f4:
+         33:3e:f0:cb:36:7b:18:04:03:dd:be:35:41:c4:3e:65:d2:67:
+         44:73:ab:7f:d1:b9:26:7e:b3:1e:d0:e4:a4:52:83:60:a9:e6:
+         e1:bf:62:bb:9b:16:0c:97:ad:11:1a:2f:eb:92:ca:7e:98:15:
+         46:23:59:5d:26:d9:ec:57:85:51:5b:09:f1:9b:1b:d3:5d:53:
+         02:67:1a:e4:24:49:67:87:04:75:66:13:56:1b:8b:a1:08:de:
+         c8:4b:f8:87:73:6e:c2:31:ee:f6:32:14:45:32:a3:3f:e4:b1:
+         0f:23:28:29:b4:a3:86:65:4f:2e:57:ad:8f:44:77:f8:4b:ea:
+         7b:9d:8e:dc:cb:07:ee:b4:78:46:db:cd:12:eb:ad:ef:9b:8f:
+         22:ba:83:7b
+-----BEGIN CERTIFICATE-----
+MIID1jCCAr6gAwIBAgIJAI2g0oruC89lMA0GCSqGSIb3DQEBBQUAMF0xCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMRUwEwYDVQQDDAxST09UX0NBX1NIQTEwHhcNMTcwMzMw
+MDQ1MTA0WhcNMjcwMzI4MDQ1MTA0WjBrMQswCQYDVQQGEwJVUzELMAkGA1UECAwC
+Q0ExDTALBgNVBAcMBENpdHkxDDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEj
+MCEGA1UEAwwaSU5URVJfQ0FfU0hBMS1ST09UX0NBX1NIQTEwggEiMA0GCSqGSIb3
+DQEBAQUAA4IBDwAwggEKAoIBAQDX1pPNXGpnPQNcx9ReXrjbcHkIoyXcdXbhO0Tn
+UBV5aGJTEn5/meDsK76Y2KDVyU/EO2jXpaQ5QiGnUzY6vKIn6boqTov4NLYwBsVP
+dAG/xZyr5q7p6bnJ8WRj40A2JeOeZ3FMglRtBCNgrYeEC4MDp2F41OVxsJZ4huod
+q94arqhD/hjE40g06UNa0I+/2dIpI2cSamIC5b3L/DK3ol+gIw/OOxMCgzAUSjeH
+6nTrrW1hUeSKx0NPGWRLWzLQ2yxhYcXlsedNuKHoux/p3EkGXoGPajK7s7IlKj9C
+PQYwlQez37jCLJGovArqTr/8hxfrKMdZOl5bp+6H6uWh6af7AgMBAAGjgYowgYcw
+dwYDVR0jBHAwbqFhpF8wXTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYD
+VQQHDARDaXR5MQwwCgYDVQQKDANPcmcxDTALBgNVBAsMBEphdmExFTATBgNVBAMM
+DFJPT1RfQ0FfU0hBMYIJAPE7t/soP1IJMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcN
+AQEFBQADggEBANPO2iPhfHP7fybXpDx7FwF1zqW9dfFlG1YnrviXpsTKlJPJErvH
+7CvVONVDOmzCUTp5L9dO2i0SH7jCT8i6M9P1DHjMJmkkRz/tF6B/0CD+Ecp1UBph
+4ZG1+pEE6RRZd9QpD0MZ4NzdphgU9DM+8Ms2exgEA92+NUHEPmXSZ0Rzq3/RuSZ+
+sx7Q5KRSg2Cp5uG/YrubFgyXrREaL+uSyn6YFUYjWV0m2exXhVFbCfGbG9NdUwJn
+GuQkSWeHBHVmE1Ybi6EI3shL+IdzbsIx7vYyFEUyoz/ksQ8jKCm0o4ZlTy5XrY9E
+d/hL6nudjtzLB+60eEbbzRLrre+bjyK6g3s=
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDWN68vV57EPqPZ
+Dtvi2+NI4tfxUgkaWJXbqrLKuAJC8bff9edZpMXGAyqMpDDr7MAjs/3TDYpVaWYN
+Id5iwqamImbBLYf/K0LOkaX6+TyogaqwwdNVryR5eYcGXEiJY1MJ2mgzCNeGJ091
+4qwll3xkjAFolB6o9QoIbLB3cctl0vw6oAoi3TKWQxJ+UI6/uBotX5eQ9z1b/MDs
+6PNXHB22jYAj4tOePMZxq7AVCwTFpWbHK8j5ftXxpVoU5ECNHfIAHLprJqc/lKdf
+7rMyflbsjD8nV7TwY+FW7WfOQgiJhk0OK3VaBeSsovpOOwjS4Lpsazh3eUXeZJUk
+lrYrMfI3AgMBAAECggEAEpXmNx9NAQ3GPXDSlw4o3AwCXEeXzpdc+SAIPxpT5+b8
+4wt8tQRcvF9N88HTFMUHrpFRNlx4Ygyw8/a6SqtEtilJ7Py8TeE8/JsaYXn6T0xg
+uNE4OrjlWzy2AFFFYdYiQDqYy8S6nkMO29V8xg4slrSm8qHXPyVzZ2O2s8ZFtWG+
+ItAMb+Gv7FU2M4te/TwRnadljFAoyWry0XCXle1fN1Y3QJXtu3VDdmLmU0t+VGfa
+wuZ5k0FIb9TFIQuxtgUNXJZmIjZw4Ych3luUc1bMSn9FPHeOzk8J3yo1tGqQu15M
+KMLHxASTgt6opfhDbYIpD0fJJqCPdiJlMrqXHBPYwQKBgQDy8lrmsjBE97H0U2sS
+tqlJq+7VOe2ien+z6seXFxd6XHBI8D/wTi2Q/7BpIGbpek3xc0ujxaFbcqo/RJZA
+TUzYmc5leQLTwy4a54Neo33+sOuYPg8fQIMPT1OGa3DXv3EPSC8FdQrweNjn/bDX
+YXbXJ2nKc3RgdTVehuMh6mw25wKBgQDhuitrTL3dlyHMGhO+djxW3cgjsUbJXQsK
+1GnkGw5mzzL67M6ixw4WNxNJjuXEUI5Vat8iJzhZOA+Ae84DDbeN2FCM7UBpUsyB
+9T9aApBYLLMflZhl4PXK/zkh1J9vA5NqqJbAcw6a5uH0kjtuJOSvP5CVQc2xsX9i
+U9+eZesQMQKBgHo4Znasqg/oNIRf+vvdHOlNL8fhbqVQzzHqKSLfoRYTrwFirCfu
+jInnuA4LGPrYZqHTiPgJEpX456EQli4fNUu6hNUTvdJe3LD4S2SvB1G8G6npfp4Q
+TF7FX5W+M3S2gOBZRh6OtUQo56Y+QFr6U1kGIPiSgLeN/51gap/DWVF9AoGBAMmL
+hMEloFF+Y/rtPbvNrkqRc+YKn32jyfw9dN7rGYzKbGaHkmjc+sLzIhGHubfzhWLX
+Law9AJ8I4y6BXIx1bvMDtche/igMefV/mLUxnNhd8QG+fHhayJwcDlMamdBxjOqq
+5Q+oq927UP0ipFXQMzAWvW3Hd3W1WlvdL8kqjxvBAoGBAMaZ9JZO48Zn17IUweZC
+oVfM99YaHa+dm3L47PdQN6Ag6UjQ+sZ/6SLGIIg67SDhUQ+nuPCL8PH3Rf7PCuqW
+oHW3F+44SIrVdLlMkWb444dxdP6Xvb9aOMpvopBDuvzYPR3xzZ202DZbZ0sIEVu8
+8a+09JbRmEI2/Ee+em6a/Y4T
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA256.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,80 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            84:a1:70:1d:0a:92:d3:cd
+    Signature Algorithm: sha1WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA256
+        Validity
+            Not Before: Mar 30 04:51:03 2017 GMT
+            Not After : Mar 28 04:51:03 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA1-ROOT_CA_SHA256
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:d6:37:af:2f:57:9e:c4:3e:a3:d9:0e:db:e2:db:
+                    e3:48:e2:d7:f1:52:09:1a:58:95:db:aa:b2:ca:b8:
+                    02:42:f1:b7:df:f5:e7:59:a4:c5:c6:03:2a:8c:a4:
+                    30:eb:ec:c0:23:b3:fd:d3:0d:8a:55:69:66:0d:21:
+                    de:62:c2:a6:a6:22:66:c1:2d:87:ff:2b:42:ce:91:
+                    a5:fa:f9:3c:a8:81:aa:b0:c1:d3:55:af:24:79:79:
+                    87:06:5c:48:89:63:53:09:da:68:33:08:d7:86:27:
+                    4f:75:e2:ac:25:97:7c:64:8c:01:68:94:1e:a8:f5:
+                    0a:08:6c:b0:77:71:cb:65:d2:fc:3a:a0:0a:22:dd:
+                    32:96:43:12:7e:50:8e:bf:b8:1a:2d:5f:97:90:f7:
+                    3d:5b:fc:c0:ec:e8:f3:57:1c:1d:b6:8d:80:23:e2:
+                    d3:9e:3c:c6:71:ab:b0:15:0b:04:c5:a5:66:c7:2b:
+                    c8:f9:7e:d5:f1:a5:5a:14:e4:40:8d:1d:f2:00:1c:
+                    ba:6b:26:a7:3f:94:a7:5f:ee:b3:32:7e:56:ec:8c:
+                    3f:27:57:b4:f0:63:e1:56:ed:67:ce:42:08:89:86:
+                    4d:0e:2b:75:5a:05:e4:ac:a2:fa:4e:3b:08:d2:e0:
+                    ba:6c:6b:38:77:79:45:de:64:95:24:96:b6:2b:31:
+                    f2:37
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256
+                serial:A3:52:9D:82:6F:DD:C6:1D
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha1WithRSAEncryption
+         56:fb:b0:ab:a6:bb:3a:55:04:ed:5c:3b:ae:0c:0d:32:8f:aa:
+         ec:b7:24:2c:d5:37:b9:1f:91:64:21:c2:c0:6d:bc:d4:d4:5e:
+         e2:f1:12:ad:34:02:93:65:10:6c:93:93:2c:23:53:e8:ed:96:
+         c7:3b:6b:44:df:ff:24:8b:c1:cc:26:b2:1e:8f:26:66:34:3a:
+         bb:7d:ef:4e:a6:7e:b2:c8:93:c9:f7:46:5a:de:40:88:70:28:
+         c7:d1:fd:27:c3:99:fd:6a:a1:a5:e1:6d:c3:5a:bc:99:28:95:
+         e9:17:ed:a4:56:a5:04:ad:fb:74:a2:01:26:2a:5a:45:bc:7b:
+         0d:df:0c:41:79:8b:b4:15:50:cd:88:ce:f5:a7:ee:cb:d2:5b:
+         76:81:4c:1b:09:92:0e:e9:c6:42:df:b7:81:9e:89:3d:49:ed:
+         17:fa:d2:2f:bd:8b:74:d5:cb:ce:af:46:6a:74:b3:34:a0:c5:
+         a0:64:66:7a:80:59:15:1e:de:16:df:11:3d:1e:96:e2:e5:2d:
+         f1:4d:20:f3:f6:f1:19:aa:ac:f8:b4:6e:76:a0:26:6c:cd:90:
+         f2:23:35:a0:8b:c8:e8:5d:27:5d:34:d3:69:74:61:c5:ac:6a:
+         54:e9:86:8d:ca:ca:16:03:48:7f:cd:23:43:41:e2:77:3a:5d:
+         f2:3e:de:fa
+-----BEGIN CERTIFICATE-----
+MIID3DCCAsSgAwIBAgIJAIShcB0KktPNMA0GCSqGSIb3DQEBBQUAMF8xCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMRcwFQYDVQQDDA5ST09UX0NBX1NIQTI1NjAeFw0xNzAz
+MzAwNDUxMDNaFw0yNzAzMjgwNDUxMDNaMG0xCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3JnMQ0wCwYDVQQLDARKYXZh
+MSUwIwYDVQQDDBxJTlRFUl9DQV9TSEExLVJPT1RfQ0FfU0hBMjU2MIIBIjANBgkq
+hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1jevL1eexD6j2Q7b4tvjSOLX8VIJGliV
+26qyyrgCQvG33/XnWaTFxgMqjKQw6+zAI7P90w2KVWlmDSHeYsKmpiJmwS2H/ytC
+zpGl+vk8qIGqsMHTVa8keXmHBlxIiWNTCdpoMwjXhidPdeKsJZd8ZIwBaJQeqPUK
+CGywd3HLZdL8OqAKIt0ylkMSflCOv7gaLV+XkPc9W/zA7OjzVxwdto2AI+LTnjzG
+cauwFQsExaVmxyvI+X7V8aVaFORAjR3yABy6ayanP5SnX+6zMn5W7Iw/J1e08GPh
+Vu1nzkIIiYZNDit1WgXkrKL6TjsI0uC6bGs4d3lF3mSVJJa2KzHyNwIDAQABo4GM
+MIGJMHkGA1UdIwRyMHChY6RhMF8xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEN
+MAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3JnMQ0wCwYDVQQLDARKYXZhMRcwFQYD
+VQQDDA5ST09UX0NBX1NIQTI1NoIJAKNSnYJv3cYdMAwGA1UdEwQFMAMBAf8wDQYJ
+KoZIhvcNAQEFBQADggEBAFb7sKumuzpVBO1cO64MDTKPquy3JCzVN7kfkWQhwsBt
+vNTUXuLxEq00ApNlEGyTkywjU+jtlsc7a0Tf/ySLwcwmsh6PJmY0Ort9706mfrLI
+k8n3RlreQIhwKMfR/SfDmf1qoaXhbcNavJkolekX7aRWpQSt+3SiASYqWkW8ew3f
+DEF5i7QVUM2IzvWn7svSW3aBTBsJkg7pxkLft4GeiT1J7Rf60i+9i3TVy86vRmp0
+szSgxaBkZnqAWRUe3hbfET0eluLlLfFNIPP28RmqrPi0bnagJmzNkPIjNaCLyOhd
+J10002l0YcWsalTpho3KyhYDSH/NI0NB4nc6XfI+3vo=
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDh12cWta4H1sY6
+KHyfvxSJk1JIUAe08JFmHwvO0Eb6LRmKrqwbXEyGs0CPGhMlnmxjvrfXbKkUjodY
+9ByxSBa7zYaVdPDGKDQ3HvPxyjZ0npPrHDII2wR+0UOD0ftkDbPHWQFBsl0OY/sI
+pRzihYRh8MwCrADdza3vHPrNBz2umuM5jnN20FVIGKhGMGbg5eackBmgvcaWT6BW
+B67iYRWVRwLywdSE+imOIS4P7ivndBe1DlB+z4oBmbBwYkM+5WyR3yT4+stdByyn
+naL+kExsC/TWDw+sE9TQUo2zqRbNI1j8UhBaQZz1pbX5YeGPTq/Z2J8EGvPxz6VY
+PmkDyMl3AgMBAAECggEAKrlDKUqpZ5Y73di26smNKxGRqVhqfNJdz0HkS/We18kc
+Yd31dR+a4oial/fI038K5ju4L6rAucDU3gEgRHFsy45v/Won+nS0nBDg+UbV0m4F
+cZ7d4Er+qLcR3KgmtKDa98VgtXr2m7hSTypdMoUrrBOPpJnBeDRmyStkTtEl3Bfa
+Fh72SZXNauGvB5+qrbPhls1HoWVbzZ3i6oUCBDrfmLD6G0ipGM+AQICmXjYX8OxT
+Ye5u/6DU4TkWu5A6/1m0Q4clGZXSeMx2d4PkZ0jZKOXdhwvzAaGh7I0AkuA4ZlCj
+slXENyAzQhm4EHHWxvld11e8oEh4DUfWtUXeLttawQKBgQDybE5gjAZdv+5BJXWV
+l2G+zb5tKHWd0XQQ2epktX+i+iA5lA0bLkAA4rrmZVsDEc4D2yjINsopBHTjwvtV
+F/LBBWIynm6MkIyjY6+0fBfoikz9ebKikuf1YRoRC5Dl0pd2Wa/ps2wowDbQnj3o
+4e6x+z0WviyL+uRr1JyotR2J5wKBgQDufVw64Z6AdWThlnP8qXqW12QQBd5qChPr
+fHJEkx0ViBoM97yalVzDssXn4X2ESVDqtsxH21SzKzDGzLoCG3PwCPgp9zWk9GS/
+HfhXFzI3qHIlI+s6481vjqDnXtvJ7oHutxYkkYQXSMgC69jeRY0nW78Bz03BAYjQ
+boRmeK1x8QKBgQDw9VBOTMADLUPvQwGGKAsC8VQHAgEuVcONAF0nrvPoFcA0GwGP
+87+wYayuVy5IdckVMiBuKW91p7VbsjHJGd2zl9tMPwfY9dCkkvBRcEr/W4A9Llqt
+l2GyF8smCB4FIfZkr67Xlvy54Jxbbf5RXUi5ZeUJlwuGM2IaACGa2zM6HwKBgEmW
+iOTqRTwh/RTWlcd6jAcLQybmiLBzl53r8l5SfoDsVA14S8vvFoaUHRjlrRMqhDtI
+WFQ7yzDVvOE6vpJz4hxIyDo6u2TAvG10U/Kbh7VA1qe7I5QyQmuPuPprfKocXB9K
+gxyZggalQIIWP/6lu15PoupuCvHpBUw7LcNorSwhAoGAXXBcp4U369B3ld+M+hC9
+G+2VttaC2917iqoM8R7WOiwez+10s+fNv89B6DjZxeX5haa7bbB+RvfqN8OysIRK
+m0Bh4w6q/JuRydj9T5sJLk9oUrEFLncqihlNT+1WEwR5x50OODYjpHz1YORo5HzL
+cnXKk8xTZFE7mXD1ZJoRLxc=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA1.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,80 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            8d:a0:d2:8a:ee:0b:cf:64
+    Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA1
+        Validity
+            Not Before: Mar 30 04:51:03 2017 GMT
+            Not After : Mar 28 04:51:03 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA256-ROOT_CA_SHA1
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:e1:d7:67:16:b5:ae:07:d6:c6:3a:28:7c:9f:bf:
+                    14:89:93:52:48:50:07:b4:f0:91:66:1f:0b:ce:d0:
+                    46:fa:2d:19:8a:ae:ac:1b:5c:4c:86:b3:40:8f:1a:
+                    13:25:9e:6c:63:be:b7:d7:6c:a9:14:8e:87:58:f4:
+                    1c:b1:48:16:bb:cd:86:95:74:f0:c6:28:34:37:1e:
+                    f3:f1:ca:36:74:9e:93:eb:1c:32:08:db:04:7e:d1:
+                    43:83:d1:fb:64:0d:b3:c7:59:01:41:b2:5d:0e:63:
+                    fb:08:a5:1c:e2:85:84:61:f0:cc:02:ac:00:dd:cd:
+                    ad:ef:1c:fa:cd:07:3d:ae:9a:e3:39:8e:73:76:d0:
+                    55:48:18:a8:46:30:66:e0:e5:e6:9c:90:19:a0:bd:
+                    c6:96:4f:a0:56:07:ae:e2:61:15:95:47:02:f2:c1:
+                    d4:84:fa:29:8e:21:2e:0f:ee:2b:e7:74:17:b5:0e:
+                    50:7e:cf:8a:01:99:b0:70:62:43:3e:e5:6c:91:df:
+                    24:f8:fa:cb:5d:07:2c:a7:9d:a2:fe:90:4c:6c:0b:
+                    f4:d6:0f:0f:ac:13:d4:d0:52:8d:b3:a9:16:cd:23:
+                    58:fc:52:10:5a:41:9c:f5:a5:b5:f9:61:e1:8f:4e:
+                    af:d9:d8:9f:04:1a:f3:f1:cf:a5:58:3e:69:03:c8:
+                    c9:77
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA1
+                serial:F1:3B:B7:FB:28:3F:52:09
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha256WithRSAEncryption
+         24:74:94:0a:7d:81:62:16:ed:4e:0f:e2:19:06:bd:8b:7a:e4:
+         35:63:4c:73:ec:3a:45:d7:2a:8c:80:e6:6b:d9:26:7d:78:9f:
+         6b:36:f9:fd:94:f7:ac:86:3c:0e:95:66:80:f3:0b:93:0f:44:
+         0a:05:76:d9:1d:c6:37:6f:ea:02:b9:29:e9:96:11:d1:e6:1e:
+         70:95:31:77:22:ed:3c:96:ad:9f:74:8c:41:f5:44:47:a2:4e:
+         d4:58:86:92:31:36:94:90:05:9d:94:16:8c:f8:c8:18:7b:45:
+         dc:49:45:53:63:06:bb:c6:a9:33:72:fe:48:7b:0e:21:89:e2:
+         6c:44:29:3c:10:65:c6:7d:8e:6c:cb:95:ea:a1:ae:3b:c1:12:
+         98:ce:b9:c8:98:12:0d:ac:a7:bd:31:cc:aa:ac:51:b4:a7:33:
+         5b:60:0d:d6:ed:e0:29:5a:29:f5:fc:e0:27:db:77:88:fd:59:
+         0c:02:70:d8:f4:1d:89:88:13:94:55:5b:77:a3:a6:8e:18:9a:
+         b8:82:5b:64:27:8c:ef:10:6a:df:ed:fd:a4:b5:2b:44:0f:5f:
+         89:08:15:48:df:b0:13:08:7c:08:cc:07:ea:b8:a6:17:ab:35:
+         65:07:2c:b9:ec:9a:d0:1f:e7:b9:a7:36:9e:24:f7:73:10:e0:
+         70:6c:78:6e
+-----BEGIN CERTIFICATE-----
+MIID2DCCAsCgAwIBAgIJAI2g0oruC89kMA0GCSqGSIb3DQEBCwUAMF0xCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMRUwEwYDVQQDDAxST09UX0NBX1NIQTEwHhcNMTcwMzMw
+MDQ1MTAzWhcNMjcwMzI4MDQ1MTAzWjBtMQswCQYDVQQGEwJVUzELMAkGA1UECAwC
+Q0ExDTALBgNVBAcMBENpdHkxDDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEl
+MCMGA1UEAwwcSU5URVJfQ0FfU0hBMjU2LVJPT1RfQ0FfU0hBMTCCASIwDQYJKoZI
+hvcNAQEBBQADggEPADCCAQoCggEBAOHXZxa1rgfWxjoofJ+/FImTUkhQB7TwkWYf
+C87QRvotGYqurBtcTIazQI8aEyWebGO+t9dsqRSOh1j0HLFIFrvNhpV08MYoNDce
+8/HKNnSek+scMgjbBH7RQ4PR+2QNs8dZAUGyXQ5j+wilHOKFhGHwzAKsAN3Nre8c
++s0HPa6a4zmOc3bQVUgYqEYwZuDl5pyQGaC9xpZPoFYHruJhFZVHAvLB1IT6KY4h
+Lg/uK+d0F7UOUH7PigGZsHBiQz7lbJHfJPj6y10HLKedov6QTGwL9NYPD6wT1NBS
+jbOpFs0jWPxSEFpBnPWltflh4Y9Or9nYnwQa8/HPpVg+aQPIyXcCAwEAAaOBijCB
+hzB3BgNVHSMEcDBuoWGkXzBdMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDTAL
+BgNVBAcMBENpdHkxDDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEVMBMGA1UE
+AwwMUk9PVF9DQV9TSEExggkA8Tu3+yg/UgkwDAYDVR0TBAUwAwEB/zANBgkqhkiG
+9w0BAQsFAAOCAQEAJHSUCn2BYhbtTg/iGQa9i3rkNWNMc+w6RdcqjIDma9kmfXif
+azb5/ZT3rIY8DpVmgPMLkw9ECgV22R3GN2/qArkp6ZYR0eYecJUxdyLtPJatn3SM
+QfVER6JO1FiGkjE2lJAFnZQWjPjIGHtF3ElFU2MGu8apM3L+SHsOIYnibEQpPBBl
+xn2ObMuV6qGuO8ESmM65yJgSDaynvTHMqqxRtKczW2AN1u3gKVop9fzgJ9t3iP1Z
+DAJw2PQdiYgTlFVbd6OmjhiauIJbZCeM7xBq3+39pLUrRA9fiQgVSN+wEwh8CMwH
+6rimF6s1ZQcsueya0B/nuac2niT3cxDgcGx4bg==
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDbXbqJwTisc3wF
+Z6MYWonNxMsWBfNfwFB/KLQfEfZ+phvReORvJZ5lVT/1gTVs5/QhREU0qW48OxyM
+NXKgkcBZGLkRvVlDaOEcbTIDa4PYf7rnsTtU8DWYuyqqmeBnJ2ViKJ3ZGA750ctm
+ZsDZlWdwE5iCqX3hA/pfHGu+CNiW2jWSulookdIPqdJeLiwgnntm5tZFxoZ9hD1h
+J88iRqmqpS4joYXPxUNxfJ49Nx4iRfrx7HpyUVg3i5Q2q/AVuVSwbbPfNaQrG71V
+EbK0K7EjtL8Gw8DCS8Gvr0ApIpabA644BueWA9skjns9lvfSuH76Y5e2nHGJiOz7
+LWMFV24LAgMBAAECggEAD546u7gQCucl+1SHniJEEWxjcSv3SeftU0BYoqWqwRWe
+gWl0Ch3Jizlollger6RME1pC+x7dBFjJDYp4oMn/wdgqxQKQKmZ7MITtvKSY/H8L
+lZdevAtmJXud7AuMmIuLglOV+XDnEA5Jxv6l2Ff0x1v9zb+3gJ/B4aeqXBtRIFxD
+CfCcvcN1Bl+jj2fvS8iRrqofGa6DGXZVZvtIVjIvJnR1YBVMVYBNs6kcscM5Nblr
+PJFDDsg+Ph7hq5gpwj7pyb4e54sn06pdfBLgGkHJ82tCNkc+f4Ee2M7MoS//m4IC
+ajV+xht4REHuB7h5GM50TF5Gziianyc3g8//M7sC8QKBgQD7tvSzJK1N0w9NPK1e
+Q5zfEWxU1c7dJ/hr81OpvEzUut1vZeKT1mydtA0YJftDTFTXe5fsPKNTIrL4BWUw
+PLa3jWQNNDSLDNhdoqKrno+017pD7+p8G8x3AfyHxn6x2Shoz0jHTnGf+Q0vnvdT
+ZTFpWU+3J8Wp4+1Nx2lwGGEJXwKBgQDfGcnk/fTSs/QQNgzkC1HaQ35b66eEBwK3
+yi8KNsNxDByvdYGxaK/tLRiZIsKMxAV+3jebfA4WSgDkenmzGLn4gYUr5gkkmEW5
+irETT+HDK8LeM2iIbCROactwu3ytJrgpaoDXxRbDsGCUf98hjz1JDCR94wjGH78H
+K3Pmbm6e1QKBgEIuTVIYj5RJrNlC3dZN8p3Xx+LaQER3cOJ5HIMhJhY8d2IFqLf0
+BaTFJTg3LEP6esgZD82l988w7Vs2l+9B10yVWTv7gOEaZHzh+OEklGYY3jlkiANP
+j8eudwX/02nRTcWY0mrMniVQZv4hTqfXkFFBkSr3wwmzCr6LcpZtYn4DAoGBAIEm
+2bTBu1/aoxhbYd0GHI1g8x5dbm1E7bLdzZt5Fm00GMsOGFVOiEGiEJJeCAgbVh8a
+n1BYYYNPtfKOYDNoxgfxWtmN4o8Xw41kl5vZa5VjmPyu//2xtNbb8dTCBKvsNUJs
+kEfYpZQFX/O3jsFLvauy5tElhCfFqv2IjyC/nzQ9AoGBAJLCz62crl/AXqArSnAH
+efX9ozrNMJMQDMDtw5xB/EqRMazmTlqkYr0H4iTS69QNAPr8czdmpY6uO6BRE9+/
+f/tWZXQj7eT8pd1Dp2Ed1vHsOfiAUha0cYUMrqshsqKNXrCxl7144iRGZY7OjFI1
+USqVVNaci2IrtW5+NGV62BYP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA256.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,80 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            84:a1:70:1d:0a:92:d3:cc
+    Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA256
+        Validity
+            Not Before: Mar 30 04:51:02 2017 GMT
+            Not After : Mar 28 04:51:02 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA256-ROOT_CA_SHA256
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:db:5d:ba:89:c1:38:ac:73:7c:05:67:a3:18:5a:
+                    89:cd:c4:cb:16:05:f3:5f:c0:50:7f:28:b4:1f:11:
+                    f6:7e:a6:1b:d1:78:e4:6f:25:9e:65:55:3f:f5:81:
+                    35:6c:e7:f4:21:44:45:34:a9:6e:3c:3b:1c:8c:35:
+                    72:a0:91:c0:59:18:b9:11:bd:59:43:68:e1:1c:6d:
+                    32:03:6b:83:d8:7f:ba:e7:b1:3b:54:f0:35:98:bb:
+                    2a:aa:99:e0:67:27:65:62:28:9d:d9:18:0e:f9:d1:
+                    cb:66:66:c0:d9:95:67:70:13:98:82:a9:7d:e1:03:
+                    fa:5f:1c:6b:be:08:d8:96:da:35:92:ba:5a:28:91:
+                    d2:0f:a9:d2:5e:2e:2c:20:9e:7b:66:e6:d6:45:c6:
+                    86:7d:84:3d:61:27:cf:22:46:a9:aa:a5:2e:23:a1:
+                    85:cf:c5:43:71:7c:9e:3d:37:1e:22:45:fa:f1:ec:
+                    7a:72:51:58:37:8b:94:36:ab:f0:15:b9:54:b0:6d:
+                    b3:df:35:a4:2b:1b:bd:55:11:b2:b4:2b:b1:23:b4:
+                    bf:06:c3:c0:c2:4b:c1:af:af:40:29:22:96:9b:03:
+                    ae:38:06:e7:96:03:db:24:8e:7b:3d:96:f7:d2:b8:
+                    7e:fa:63:97:b6:9c:71:89:88:ec:fb:2d:63:05:57:
+                    6e:0b
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256
+                serial:A3:52:9D:82:6F:DD:C6:1D
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha256WithRSAEncryption
+         3f:f2:91:96:59:da:c1:8a:8c:4d:eb:25:1f:74:87:6f:fc:2e:
+         92:7e:44:ff:a7:0b:78:aa:6d:2b:fe:b8:0a:b9:e9:bc:19:87:
+         44:15:e1:3a:e4:54:e6:4b:54:3c:75:d9:f8:c9:07:83:74:f4:
+         4c:ab:e4:6b:19:64:b6:4b:69:44:6e:74:f6:66:cf:16:43:8f:
+         9c:cb:20:e4:7a:5e:78:13:00:6f:28:78:8d:c5:05:46:a9:92:
+         0f:d0:38:c3:8b:0e:39:d4:87:e9:ee:35:07:78:dd:1a:1a:8c:
+         3a:36:56:4e:3b:96:7a:d1:2c:29:95:06:29:ac:b2:f7:5c:fc:
+         09:1c:72:24:e2:9e:72:bf:60:3a:7a:9b:59:35:48:6a:d2:3e:
+         76:7f:ad:41:45:a5:6f:93:96:10:c4:4c:cf:3f:f1:1d:00:5f:
+         d1:60:f1:88:86:d8:ef:ff:72:63:8f:4c:df:9e:35:cb:17:2c:
+         16:7b:d4:6c:0e:67:b6:ee:bc:68:07:b0:99:df:c5:f3:88:28:
+         a1:46:bb:6d:f5:2c:45:6b:e9:90:c0:78:35:20:73:14:5a:d0:
+         a5:56:cb:04:f4:43:a7:cf:28:f5:a3:5b:ac:f2:a3:4c:f6:39:
+         3c:ef:f4:b1:42:20:8e:2a:14:0d:a1:b4:38:b2:f2:6c:14:33:
+         05:04:bb:a7
+-----BEGIN CERTIFICATE-----
+MIID3jCCAsagAwIBAgIJAIShcB0KktPMMA0GCSqGSIb3DQEBCwUAMF8xCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMRcwFQYDVQQDDA5ST09UX0NBX1NIQTI1NjAeFw0xNzAz
+MzAwNDUxMDJaFw0yNzAzMjgwNDUxMDJaMG8xCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3JnMQ0wCwYDVQQLDARKYXZh
+MScwJQYDVQQDDB5JTlRFUl9DQV9TSEEyNTYtUk9PVF9DQV9TSEEyNTYwggEiMA0G
+CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDbXbqJwTisc3wFZ6MYWonNxMsWBfNf
+wFB/KLQfEfZ+phvReORvJZ5lVT/1gTVs5/QhREU0qW48OxyMNXKgkcBZGLkRvVlD
+aOEcbTIDa4PYf7rnsTtU8DWYuyqqmeBnJ2ViKJ3ZGA750ctmZsDZlWdwE5iCqX3h
+A/pfHGu+CNiW2jWSulookdIPqdJeLiwgnntm5tZFxoZ9hD1hJ88iRqmqpS4joYXP
+xUNxfJ49Nx4iRfrx7HpyUVg3i5Q2q/AVuVSwbbPfNaQrG71VEbK0K7EjtL8Gw8DC
+S8Gvr0ApIpabA644BueWA9skjns9lvfSuH76Y5e2nHGJiOz7LWMFV24LAgMBAAGj
+gYwwgYkweQYDVR0jBHIwcKFjpGEwXzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNB
+MQ0wCwYDVQQHDARDaXR5MQwwCgYDVQQKDANPcmcxDTALBgNVBAsMBEphdmExFzAV
+BgNVBAMMDlJPT1RfQ0FfU0hBMjU2ggkAo1Kdgm/dxh0wDAYDVR0TBAUwAwEB/zAN
+BgkqhkiG9w0BAQsFAAOCAQEAP/KRllnawYqMTeslH3SHb/wukn5E/6cLeKptK/64
+CrnpvBmHRBXhOuRU5ktUPHXZ+MkHg3T0TKvkaxlktktpRG509mbPFkOPnMsg5Hpe
+eBMAbyh4jcUFRqmSD9A4w4sOOdSH6e41B3jdGhqMOjZWTjuWetEsKZUGKayy91z8
+CRxyJOKecr9gOnqbWTVIatI+dn+tQUWlb5OWEMRMzz/xHQBf0WDxiIbY7/9yY49M
+3541yxcsFnvUbA5ntu68aAewmd/F84gooUa7bfUsRWvpkMB4NSBzFFrQpVbLBPRD
+p88o9aNbrPKjTPY5PO/0sUIgjioUDaG0OLLybBQzBQS7pw==
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA1-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDhROyqYZ5UdQJ0
+xJdG4B+aXPHbIKV0w5AvJ7r4SuvIJ/4pEmV6fIU3+4CvN2sXKzW+0DppOBz99Oe6
+19jfMAx5t0pKHkwh5J0bduLf1k83lm8CvoX1a9lYY6ER4Y8wWtTcHG016onl8Lxq
+QVqlqbk9zsbNipvWxipIQOgzq7DmTXQ2Hrx0tg4DROlgwuarPBWcZjq6dG09nI0E
+zSY/Wis619L/6sdCxGFhvnJ0YbULvIqdR2J638KEO+rx1RXD66Jqc0KhnGZLf7NT
+YfTlY0zIMHE8oMkJPdH9tPKbyXMXhiG/u5x81RcJxT4gLi5fq2yrvMsaUC13bnJJ
+npFNy6XTAgMBAAECggEAPS4h9Jg0jw2EUEBAMaCXFK5fhTrVlOO0Ggp5TgvTA3ZR
+Ich8RQrih3TH2056yD0VCLC23HK/9Pz5npYWsW70RG5SP9UAqkfTn2znaxFiTF+P
+4Lfr296hlc7hJOEUqXZRz0HtKzJ6pzd9hIIhY1K4G6A4AATAFFGXlC4Eolvj3Hf0
+NgVFDYaFDEpEiin+fAsM5c1ZE0pxRZSVE5Emr9XvkvxLm5dK9lKOyyOQ+5RHhxQ6
+J4n+6Ct0O+FkeP9u3jTMtew9gxTwvHSgkf05hSRoqgMKcusKpqhHp6E4mT7sus7q
+AYzdv5sNIcx7PpojuHjploMH7ghhYxCmVOOFxXJ4CQKBgQD2naA8zZnh5BfbVC8p
+C9A6HfwnZ7cCjGtL30y8fh8OAMHbdGE4JXlhifPgW7PDxZ0Yho4rYd9MxLVcGl+p
+YPOKKcaKbzwdUJwZ4Zs1dJC+LTRqku6O3qlEofeojHN5IctLoLqDsiZBD7aT4l+O
+wmAWqwLZZQtiFpA/jbCb/Qw7tQKBgQDp11rFSHLKuVdMuSnUon3WN6lj9WNM3KFy
+C8R4EN/DTnuHrVL0MCff9eddBYvpQe0z/LA74oAD9fSjmtYe/24qIm2lAWVkwxBm
+yyspUmOybU8Q3GN8xw1Vrwg8JR5JVAOwKHwCGmybT7Zs+9eJRONnnZ6nUbTQ94cP
+sJVkyGUgZwKBgQCd/0CAk+xpl1tdbiLEtkfSZBF/IWhTXqkDM+2SuW6l5wBL29TJ
+RuDsB5jR/Y4+96T86H++9XY9Va0nc9IjzvRYaQlE+ZzW3yUTQ8HPTn3JCWcSfE4Q
+BEEHsojbWBhG28rGChRUeVceybVcK2SzLn6nJyqtIppXXkNOJDWoykcDHQKBgHzY
+27+k1JTjq3ZtDaZXMvQiN7AEnYW17gRjv/uSlsVBq7ZelYGGDGQIeAQ0J+Tbq/cr
+nDP80/hJYtnOmy9llL2uL/f+7NGFS8Z2Bo9DS7NBpQsNf5ho9fefQbhK4Qapcmak
+1sCQtxec0XsSYpsJSphRkRkoCG/hGB0KXFi4nTVVAoGAJrrh1rG1UMXmFUpraXIy
+Mc58lEYB87EkMOthyK8XklxLoYKPZlVS7AZZDtQMpRC6YnweiX6LmO4AamtlT71x
+BzQgmwHn4wOaysDPHFuf5hNCobXJREoiNzHb4AcqiZ7SNAW5Jd+0/PSY47hrDnRy
+wNFyg3O0k3kaXz5h3lVhxo4=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA1.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,80 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            f1:3b:b7:fb:28:3f:52:09
+    Signature Algorithm: sha1WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA1
+        Validity
+            Not Before: Mar 30 04:51:01 2017 GMT
+            Not After : Mar 28 04:51:01 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA1
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:e1:44:ec:aa:61:9e:54:75:02:74:c4:97:46:e0:
+                    1f:9a:5c:f1:db:20:a5:74:c3:90:2f:27:ba:f8:4a:
+                    eb:c8:27:fe:29:12:65:7a:7c:85:37:fb:80:af:37:
+                    6b:17:2b:35:be:d0:3a:69:38:1c:fd:f4:e7:ba:d7:
+                    d8:df:30:0c:79:b7:4a:4a:1e:4c:21:e4:9d:1b:76:
+                    e2:df:d6:4f:37:96:6f:02:be:85:f5:6b:d9:58:63:
+                    a1:11:e1:8f:30:5a:d4:dc:1c:6d:35:ea:89:e5:f0:
+                    bc:6a:41:5a:a5:a9:b9:3d:ce:c6:cd:8a:9b:d6:c6:
+                    2a:48:40:e8:33:ab:b0:e6:4d:74:36:1e:bc:74:b6:
+                    0e:03:44:e9:60:c2:e6:ab:3c:15:9c:66:3a:ba:74:
+                    6d:3d:9c:8d:04:cd:26:3f:5a:2b:3a:d7:d2:ff:ea:
+                    c7:42:c4:61:61:be:72:74:61:b5:0b:bc:8a:9d:47:
+                    62:7a:df:c2:84:3b:ea:f1:d5:15:c3:eb:a2:6a:73:
+                    42:a1:9c:66:4b:7f:b3:53:61:f4:e5:63:4c:c8:30:
+                    71:3c:a0:c9:09:3d:d1:fd:b4:f2:9b:c9:73:17:86:
+                    21:bf:bb:9c:7c:d5:17:09:c5:3e:20:2e:2e:5f:ab:
+                    6c:ab:bc:cb:1a:50:2d:77:6e:72:49:9e:91:4d:cb:
+                    a5:d3
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA1
+                serial:F1:3B:B7:FB:28:3F:52:09
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha1WithRSAEncryption
+         0b:be:7b:c7:53:14:87:37:02:66:37:f5:6f:38:3c:75:b3:72:
+         f6:f8:9c:77:4d:9a:e4:5c:23:3a:4a:5f:aa:6e:90:23:e9:b8:
+         48:fd:6d:e1:88:b5:a2:a5:0a:30:c0:7d:33:a8:6f:79:42:52:
+         80:f8:87:4b:2a:15:0a:ff:14:88:97:21:12:89:1c:d3:33:bf:
+         fa:4f:5e:68:9a:c6:69:2f:aa:1d:31:aa:80:f5:b0:d3:72:c9:
+         fa:ce:3b:5f:15:a6:61:e0:f1:d1:ab:e7:40:48:c1:d4:30:bd:
+         0a:13:37:0d:ea:ac:38:b2:af:1b:78:3a:29:53:ee:90:71:3b:
+         2b:a4:8b:16:e9:da:94:59:44:3d:7f:34:fb:0a:d1:6b:db:3d:
+         66:01:a6:0f:98:b5:cc:57:39:b9:09:f2:01:cc:e5:89:86:7d:
+         f2:9a:b2:ad:08:3d:da:05:f9:24:1e:30:98:cc:92:a9:4c:4a:
+         cf:a3:53:6e:7f:5e:db:aa:43:9c:ac:b1:b5:80:ab:7e:a3:89:
+         71:37:c2:4a:c1:16:9d:26:d5:70:89:8a:8e:a8:cb:40:3b:b8:
+         f0:d2:31:54:c2:1f:fc:24:5e:29:c1:5e:86:48:1e:83:4e:44:
+         30:ff:8d:46:47:b6:0e:9c:77:bf:ba:08:8b:bd:eb:b7:ca:45:
+         0a:e3:0c:ec
+-----BEGIN CERTIFICATE-----
+MIIDyDCCArCgAwIBAgIJAPE7t/soP1IJMA0GCSqGSIb3DQEBBQUAMF0xCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMRUwEwYDVQQDDAxST09UX0NBX1NIQTEwHhcNMTcwMzMw
+MDQ1MTAxWhcNMjcwMzI4MDQ1MTAxWjBdMQswCQYDVQQGEwJVUzELMAkGA1UECAwC
+Q0ExDTALBgNVBAcMBENpdHkxDDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEV
+MBMGA1UEAwwMUk9PVF9DQV9TSEExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEA4UTsqmGeVHUCdMSXRuAfmlzx2yCldMOQLye6+ErryCf+KRJlenyFN/uA
+rzdrFys1vtA6aTgc/fTnutfY3zAMebdKSh5MIeSdG3bi39ZPN5ZvAr6F9WvZWGOh
+EeGPMFrU3BxtNeqJ5fC8akFapam5Pc7GzYqb1sYqSEDoM6uw5k10Nh68dLYOA0Tp
+YMLmqzwVnGY6unRtPZyNBM0mP1orOtfS/+rHQsRhYb5ydGG1C7yKnUdiet/ChDvq
+8dUVw+uianNCoZxmS3+zU2H05WNMyDBxPKDJCT3R/bTym8lzF4Yhv7ucfNUXCcU+
+IC4uX6tsq7zLGlAtd25ySZ6RTcul0wIDAQABo4GKMIGHMHcGA1UdIwRwMG6hYaRf
+MF0xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoG
+A1UECgwDT3JnMQ0wCwYDVQQLDARKYXZhMRUwEwYDVQQDDAxST09UX0NBX1NIQTGC
+CQDxO7f7KD9SCTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQALvnvH
+UxSHNwJmN/VvODx1s3L2+Jx3TZrkXCM6Sl+qbpAj6bhI/W3hiLWipQowwH0zqG95
+QlKA+IdLKhUK/xSIlyESiRzTM7/6T15omsZpL6odMaqA9bDTcsn6zjtfFaZh4PHR
+q+dASMHUML0KEzcN6qw4sq8beDopU+6QcTsrpIsW6dqUWUQ9fzT7CtFr2z1mAaYP
+mLXMVzm5CfIBzOWJhn3ymrKtCD3aBfkkHjCYzJKpTErPo1Nuf17bqkOcrLG1gKt+
+o4lxN8JKwRadJtVwiYqOqMtAO7jw0jFUwh/8JF4pwV6GSB6DTkQw/41GR7YOnHe/
+ugiLveu3ykUK4wzs
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA256-PRIV.key	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,26 @@
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC2DzrIXts3huIs
+dtX+ZbY6RR5/S4yXUs3jJXc4mbITLn7PO1QVBT528NZVOu6jUxXsPTpTg1jgresh
+6Pcv1LNj7bP30uPXhmyawgQVUgLTGyU0+JWLJrpU7cEOTK4f/j58A+UHL255fM7T
+B3EvIj2Ad1MAYwIvVZnAXPSFt72YGz15doYiewp8dTXcX4TsFisCbypFikWxpXIF
+qjVqbAUx8fYgQxfPWFw4HbVvo3Nu1LqypswAfsmHd2v5nMv8wkAcPG5dIYHACN9r
+kPLMoUNUcBLn6QdIUrhk7dldRlR0TWT+VtRLKVWlGkMk9rRK+RnskNSuPg8fjb/Y
+gM0m5p0JAgMBAAECggEAPVk8cbClJjzpkhopWiRkF5abBEItCgD5KAXD+uqvuw77
+5FEVsE+oEORvFSFasOaaiJTJRsMH/A4fIbojMZb3LEE5V9VUuZeumSevwI92LDUF
+gKgTnGRcfanwWCU2t8kwvRGC57zv+Tg5aZskZMGg/901tvemENVDjjLEoxqbZNmX
+WZnhB8XiPxl9K32K0l+qNW3HvKJ8lkaW0L6/4HWWU4rYwbc9TZpzHDOXhAICQB76
+fCw4hcy1K6KjfGjfE/6afqMa76KSxxeCvUYorZlm2gk1WcEafkg9Jwzz2SWtsa8W
+L+YzbTd1GE8Z9bDA88Dw3vgdC1Pt0ywX/fJ/GCDHUQKBgQDjNaW/enKYXGTsM5C1
+I94OgSmgnjnjPZIBY0u89iCAf07ueqrNaLJgOEkGpCrLEa4tC2qc57ge1DO2rxTa
+6RowUzqG3Oqdsq21QaQZAmjjDC5mXlYPRpWvWVjBRaIDKw9zAUg9qEy24e/pRjdP
+cugR30d1OaxExdgoAt8iOqZ67wKBgQDNIPqF/+npd1UAqgdC9lOxnPQly1zjz/zY
+jbeJeww9Ut9aCXj0+we4gKhD37d178y1H2QBod+IPpqQ/uZmbNmN5JP+MIk2kZKB
+4jquQLa5jEc+y57h8UrWJBY+Ls7xiu/cw3aCAk0JaZRSrH/KzWE91x3s7o2yV43d
+dMkRmTTHhwKBgQCHaq4C1WP/UvIDpSgWDe6HDoxU4nj16vheQ2Qcl0T/0OCmWg36
+pu/JUUKU5rtqlHsO9cLxCVo/ZZH8y5TOdCfbrX8wafKbUqcdZKX9EeaZi+ULtiXs
+rNEB1WqEpo/M+5kVnioENY6jYT2v9t14SK/wFvdr8pet1YzjK/L5X6NhmQKBgFK4
+0u7I9k61Ve0vpEAH0FaXIgo/yZUBYkj+VZ62pYfxbKsFmObKeSGZmMHObVC9RMNi
+BlV2LwvlmzWP5eA2U0GahWgDsMH10KxaTCnLZSTMgkq7mLYrNW/IG8Q14jScQAC6
+PodNYD3EexEgCWUCkA19O885oKDkGAzPtOpI63TvAoGBAJvbKiJSFJNd3CIQlrOM
+wNw+Sww+c2Qw4PZZvIJNzjWumjesfUsuAyySrO2nXPzzSOrh7dRW98suaFi1Mih6
+ZwBpIll5VQsd2dwEa6vp6RFGWFNKPvDILEVgcCEOmckKRWDo+fb5bx2VHj1v4kfG
+MHDqy8Y2ercsU0Z5mEN8bUD7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA256.cer	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,80 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            a3:52:9d:82:6f:dd:c6:1d
+    Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA256
+        Validity
+            Not Before: Mar 30 04:51:01 2017 GMT
+            Not After : Mar 28 04:51:01 2027 GMT
+        Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA256
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (2048 bit)
+                Modulus:
+                    00:b6:0f:3a:c8:5e:db:37:86:e2:2c:76:d5:fe:65:
+                    b6:3a:45:1e:7f:4b:8c:97:52:cd:e3:25:77:38:99:
+                    b2:13:2e:7e:cf:3b:54:15:05:3e:76:f0:d6:55:3a:
+                    ee:a3:53:15:ec:3d:3a:53:83:58:e0:ad:eb:21:e8:
+                    f7:2f:d4:b3:63:ed:b3:f7:d2:e3:d7:86:6c:9a:c2:
+                    04:15:52:02:d3:1b:25:34:f8:95:8b:26:ba:54:ed:
+                    c1:0e:4c:ae:1f:fe:3e:7c:03:e5:07:2f:6e:79:7c:
+                    ce:d3:07:71:2f:22:3d:80:77:53:00:63:02:2f:55:
+                    99:c0:5c:f4:85:b7:bd:98:1b:3d:79:76:86:22:7b:
+                    0a:7c:75:35:dc:5f:84:ec:16:2b:02:6f:2a:45:8a:
+                    45:b1:a5:72:05:aa:35:6a:6c:05:31:f1:f6:20:43:
+                    17:cf:58:5c:38:1d:b5:6f:a3:73:6e:d4:ba:b2:a6:
+                    cc:00:7e:c9:87:77:6b:f9:9c:cb:fc:c2:40:1c:3c:
+                    6e:5d:21:81:c0:08:df:6b:90:f2:cc:a1:43:54:70:
+                    12:e7:e9:07:48:52:b8:64:ed:d9:5d:46:54:74:4d:
+                    64:fe:56:d4:4b:29:55:a5:1a:43:24:f6:b4:4a:f9:
+                    19:ec:90:d4:ae:3e:0f:1f:8d:bf:d8:80:cd:26:e6:
+                    9d:09
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Authority Key Identifier: 
+                DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256
+                serial:A3:52:9D:82:6F:DD:C6:1D
+
+            X509v3 Basic Constraints: 
+                CA:TRUE
+    Signature Algorithm: sha256WithRSAEncryption
+         6f:2f:a4:56:d5:58:6d:20:74:6b:66:b7:41:eb:c2:8c:56:2e:
+         1b:51:79:b0:07:a6:63:28:8b:20:40:b9:72:4b:f5:e0:6b:18:
+         39:5b:b4:ae:50:58:25:81:86:e3:19:ec:b1:dd:fb:5c:f5:d4:
+         a8:7d:a0:50:46:ac:1e:80:dc:cc:aa:0c:61:f8:a3:41:af:03:
+         35:a4:02:4f:23:c7:5c:36:26:90:fe:51:07:58:0f:e7:14:26:
+         34:c2:a7:bd:f2:34:33:cf:67:e4:2d:82:b6:e8:94:85:d6:8b:
+         01:6f:ba:3d:78:f6:db:3d:dc:ba:6e:6d:83:fa:ea:d0:60:ab:
+         1b:ad:9b:e2:ba:e3:e3:9f:26:5b:9a:c7:fb:9f:c1:7d:cc:0b:
+         cf:23:e0:ac:e1:e4:09:08:84:98:d4:6e:16:34:a5:5e:74:d5:
+         a8:61:e1:65:f7:9a:51:9f:f0:9f:86:65:ce:4f:b8:b6:64:7d:
+         86:62:21:ec:71:50:70:ca:6b:2e:74:12:51:b1:68:b0:4a:66:
+         19:60:e9:f8:b0:bf:6e:d8:ad:75:29:c3:31:13:73:01:3d:d5:
+         d4:5b:c2:60:bb:c4:c8:e6:29:cf:a3:49:65:8d:c2:1d:7d:c9:
+         75:33:9b:97:73:38:99:5c:7d:b3:9f:b0:be:0d:f4:6a:c6:19:
+         8d:98:a1:ca
+-----BEGIN CERTIFICATE-----
+MIIDzjCCAragAwIBAgIJAKNSnYJv3cYdMA0GCSqGSIb3DQEBCwUAMF8xCzAJBgNV
+BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn
+MQ0wCwYDVQQLDARKYXZhMRcwFQYDVQQDDA5ST09UX0NBX1NIQTI1NjAeFw0xNzAz
+MzAwNDUxMDFaFw0yNzAzMjgwNDUxMDFaMF8xCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3JnMQ0wCwYDVQQLDARKYXZh
+MRcwFQYDVQQDDA5ST09UX0NBX1NIQTI1NjCCASIwDQYJKoZIhvcNAQEBBQADggEP
+ADCCAQoCggEBALYPOshe2zeG4ix21f5ltjpFHn9LjJdSzeMldziZshMufs87VBUF
+Pnbw1lU67qNTFew9OlODWOCt6yHo9y/Us2Pts/fS49eGbJrCBBVSAtMbJTT4lYsm
+ulTtwQ5Mrh/+PnwD5Qcvbnl8ztMHcS8iPYB3UwBjAi9VmcBc9IW3vZgbPXl2hiJ7
+Cnx1NdxfhOwWKwJvKkWKRbGlcgWqNWpsBTHx9iBDF89YXDgdtW+jc27UurKmzAB+
+yYd3a/mcy/zCQBw8bl0hgcAI32uQ8syhQ1RwEufpB0hSuGTt2V1GVHRNZP5W1Esp
+VaUaQyT2tEr5GeyQ1K4+Dx+Nv9iAzSbmnQkCAwEAAaOBjDCBiTB5BgNVHSMEcjBw
+oWOkYTBfMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDTALBgNVBAcMBENpdHkx
+DDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEXMBUGA1UEAwwOUk9PVF9DQV9T
+SEEyNTaCCQCjUp2Cb93GHTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IB
+AQBvL6RW1VhtIHRrZrdB68KMVi4bUXmwB6ZjKIsgQLlyS/Xgaxg5W7SuUFglgYbj
+Geyx3ftc9dSofaBQRqwegNzMqgxh+KNBrwM1pAJPI8dcNiaQ/lEHWA/nFCY0wqe9
+8jQzz2fkLYK26JSF1osBb7o9ePbbPdy6bm2D+urQYKsbrZviuuPjnyZbmsf7n8F9
+zAvPI+Cs4eQJCISY1G4WNKVedNWoYeFl95pRn/CfhmXOT7i2ZH2GYiHscVBwymsu
+dBJRsWiwSmYZYOn4sL9u2K11KcMxE3MBPdXUW8Jgu8TI5inPo0lljcIdfcl1M5uX
+cziZXH2zn7C+DfRqxhmNmKHK
+-----END CERTIFICATE-----
--- a/jdk/test/sun/security/tools/keytool/WeakAlg.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/security/tools/keytool/WeakAlg.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8171319
+ * @bug 8171319 8177569
  * @summary keytool should print out warnings when reading or generating
   *         cert/cert req using weak algorithms
  * @library /test/lib
@@ -78,7 +78,8 @@
                 .shouldMatch("<b>.*512-bit RSA key.*risk")
                 .shouldContain("512-bit RSA key (weak)");
 
-        // Multiple warnings for multiple cert in -printcert or -list or -exportcert
+        // Multiple warnings for multiple cert in -printcert
+        // or -list or -exportcert
 
         // -certreq, -printcertreq, -gencert
         checkCertReq("a", "", null);
@@ -184,7 +185,7 @@
                 .shouldMatch("The input.*MD5withRSA.*risk")
                 .shouldNotContain("[no]");
 
-        // cert is self-signed cacerts
+        // JDK-8177569: no warning for sigalg of trusted cert
         String weakSigAlgCA = null;
         KeyStore ks = KeyStoreUtil.getCacertsKeyStore();
         if (ks != null) {
@@ -208,12 +209,40 @@
             }
         }
         if (weakSigAlgCA != null) {
+            // The following 2 commands still have a warning on why not using
+            // the -cacerts option directly.
+            kt("-list -keystore " + KeyStoreUtil.getCacerts())
+                    .shouldNotContain("risk");
+            kt("-list -v -keystore " + KeyStoreUtil.getCacerts())
+                    .shouldNotContain("risk");
+
+            // -printcert will always show warnings
+            kt("-printcert -file ca.cert")
+                    .shouldContain("name: " + weakSigAlgCA + " (weak)")
+                    .shouldContain("Warning")
+                    .shouldMatch("The certificate.*" + weakSigAlgCA + ".*risk");
+            kt("-printcert -file ca.cert -trustcacerts") // -trustcacerts useless
+                    .shouldContain("name: " + weakSigAlgCA + " (weak)")
+                    .shouldContain("Warning")
+                    .shouldMatch("The certificate.*" + weakSigAlgCA + ".*risk");
+
+            // Importing with -trustcacerts ignore CA cert's sig alg
             kt("-delete -alias d");
             kt("-importcert -alias d -trustcacerts -file ca.cert", "no")
                     .shouldContain("Certificate already exists in system-wide CA")
+                    .shouldNotContain("risk")
+                    .shouldContain("Do you still want to add it to your own keystore?");
+            kt("-importcert -alias d -trustcacerts -file ca.cert -noprompt")
+                    .shouldNotContain("risk")
+                    .shouldNotContain("[no]");
+
+            // but not without -trustcacerts
+            kt("-delete -alias d");
+            kt("-importcert -alias d -file ca.cert", "no")
+                    .shouldContain("name: " + weakSigAlgCA + " (weak)")
                     .shouldContain("Warning")
                     .shouldMatch("The input.*" + weakSigAlgCA + ".*risk")
-                    .shouldContain("Do you still want to add it to your own keystore?");
+                    .shouldContain("Trust this certificate?");
             kt("-importcert -alias d -file ca.cert -noprompt")
                     .shouldContain("Warning")
                     .shouldMatch("The input.*" + weakSigAlgCA + ".*risk")
@@ -266,6 +295,26 @@
         // install reply
 
         reStore();
+        certreq("c", "");
+        gencert("a-c", "");
+        kt("-importcert -alias c -file a-c.cert")
+                .shouldContain("Warning")
+                .shouldMatch("Issuer <a>.*MD5withRSA.*risk");
+
+        // JDK-8177569: no warning for sigalg of trusted cert
+        reStore();
+        // Change a into a TrustedCertEntry
+        kt("-exportcert -alias a -file a.cert");
+        kt("-delete -alias a");
+        kt("-importcert -alias a -file a.cert -noprompt");
+        kt("-list -alias a -v")
+                .shouldNotContain("weak")
+                .shouldNotContain("Warning");
+        // This time a is trusted and no warning on its weak sig alg
+        kt("-importcert -alias c -file a-c.cert")
+                .shouldNotContain("Warning");
+
+        reStore();
 
         gencert("a-b", "");
         gencert("b-c", "");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jcmd/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = jdk.jcmd
+
--- a/jdk/test/sun/tools/jcmd/TestJcmdDefaults.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/tools/jcmd/TestJcmdDefaults.java	Mon Apr 10 08:31:37 2017 -0700
@@ -34,15 +34,14 @@
 import jdk.testlibrary.OutputAnalyzer;
 import jdk.testlibrary.Utils;
 
-/**
- * Unit test for jcmd utility. Tests jcmd options which do not send
- * requests to a specific JVM process.
- */
 /*
  * @test
  * @bug 7104647
+ * @summary Unit test for jcmd utility. Tests jcmd options which do not send
+ * requests to a specific JVM process.
+ *
  * @library /lib/testlibrary
- * @modules java.management
+ *
  * @build jdk.testlibrary.*
  * @run main TestJcmdDefaults
  */
--- a/jdk/test/sun/tools/jcmd/TestJcmdSanity.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/tools/jcmd/TestJcmdSanity.java	Mon Apr 10 08:31:37 2017 -0700
@@ -35,15 +35,14 @@
 import jdk.testlibrary.ProcessTools;
 import jdk.testlibrary.Utils;
 
-/**
- * Unit test for jcmd utility. The test will send different diagnostic command
- * requests to the current java process.
- */
 /*
  * @test
  * @bug 7104647 7154822
+ * @summary Unit test for jcmd utility. The test will send different diagnostic
+ * command requests to the current java process.
+ *
  * @library /lib/testlibrary
- * @modules java.management
+ *
  * @build jdk.testlibrary.*
  * @run main/othervm -XX:+UsePerfData TestJcmdSanity
  */
--- a/jdk/test/sun/tools/jconsole/ResourceCheckTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/tools/jconsole/ResourceCheckTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -22,18 +22,18 @@
  */
 
 /**
+ * @test
+ * @bug 5008856 5023573 5024917 5062569 7172176
+ * @summary 'missing resource key' error for key = "Operating system"
  *
- *  @test
- *  @bug 5008856 5023573 5024917 5062569 7172176
- *  @summary 'missing resource key' error for key = "Operating system"
- *  @modules jdk.jconsole/sun.tools.jconsole
- *           jdk.jconsole/sun.tools.jconsole.resources:open
- *  @run main ResourceCheckTest
+ * @modules jdk.jconsole/sun.tools.jconsole
+ *          jdk.jconsole/sun.tools.jconsole.resources:open
+ *
+ * @run main ResourceCheckTest
  */
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jhsdb/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,3 @@
+modules = jdk.hotspot.agent \
+          java.management
+
--- a/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -36,11 +36,12 @@
  * @test
  * @bug 8042397
  * @summary Unit test for jmap utility test heap configuration reader
- * @modules jdk.hotspot.agent/sun.jvm.hotspot
+ *
  * @library /test/lib
  * @library /lib/testlibrary
- * @build jdk.testlibrary.*
- * @build jdk.test.lib.apps.*
+ * @modules java.management
+ *          jdk.hotspot.agent/sun.jvm.hotspot
+ *
  * @build JMapHeapConfigTest TmtoolTestScenario
  * @run main JMapHeapConfigTest
  */
--- a/jdk/test/sun/tools/jinfo/JInfoTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/tools/jinfo/JInfoTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -36,11 +36,12 @@
 /*
  * @test
  * @summary Unit test for jinfo utility
- * @modules java.base/jdk.internal.misc
+ *
  * @library /test/lib
- * @build jdk.test.lib.*
- * @build jdk.test.lib.apps.*
- * @build jdk.test.lib.process.*
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *          jdk.jcmd
+ *
  * @run main JInfoTest
  */
 public class JInfoTest {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jinfo/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = jdk.jcmd
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jmap/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = jdk.jcmd
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstack/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = jdk.jcmd
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstat/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,2 @@
+modules = jdk.jcmd
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstatd/TEST.properties	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,5 @@
+modules = java.management \
+          java.rmi
+          jdk.jcmd \
+          jdk.jstatd
+
--- a/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,8 +25,9 @@
  * @test
  * @bug 4990825
  * @key intermittent
+ *
  * @library /lib/testlibrary
- * @modules java.management
+ *
  * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
  * @run main/timeout=60 TestJstatdDefaults
  */
--- a/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,8 +25,9 @@
  * @test
  * @bug 4990825 7092186
  * @key intermittent
+ *
  * @library /lib/testlibrary
- * @modules java.management
+ *
  * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
  * @run main/timeout=60 TestJstatdExternalRegistry
  */
--- a/jdk/test/sun/tools/jstatd/TestJstatdPort.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPort.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,8 +25,9 @@
  * @test
  * @bug 4990825
  * @key intermittent
+ *
  * @library /lib/testlibrary
- * @modules java.management
+ *
  * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
  * @run main/timeout=60 TestJstatdPort
  */
--- a/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,8 +25,9 @@
  * @test
  * @bug 4990825
  * @key intermittent
+ *
  * @library /lib/testlibrary
- * @modules java.management
+ *
  * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
  * @run main/timeout=60 TestJstatdPortAndServer
  */
--- a/jdk/test/sun/tools/jstatd/TestJstatdServer.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/tools/jstatd/TestJstatdServer.java	Mon Apr 10 08:31:37 2017 -0700
@@ -25,8 +25,9 @@
  * @test
  * @bug 4990825
  * @key intermittent
+ *
  * @library /lib/testlibrary
- * @modules java.management
+ *
  * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
  * @run main/timeout=60 TestJstatdServer
  */
--- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Mon Apr 10 08:31:37 2017 -0700
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2017a
+tzdata2017b
--- a/jdk/test/sun/util/calendar/zi/tzdata/africa	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/africa	Mon Apr 10 08:31:37 2017 -0700
@@ -443,18 +443,25 @@
 # See Africa/Johannesburg.
 
 # Liberia
-# From Paul Eggert (2006-03-22):
-# In 1972 Liberia was the last country to switch
-# from a UTC offset that was not a multiple of 15 or 20 minutes.
-# Howse reports that it was in honor of their president's birthday.
-# Shank & Pottenger report the date as May 1, whereas Howse reports Jan;
-# go with Shanks & Pottenger.
-# For Liberia before 1972, Shanks & Pottenger report -0:44, whereas Howse and
-# Whitman each report -0:44:30; go with the more precise figure.
+#
+# From Paul Eggert (2017-03-02):
+#
+# The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30.
+#
+# In 1972 Liberia was the last country to switch from a UTC offset
+# that was not a multiple of 15 or 20 minutes.  The 1972 change was on
+# 1972-01-07, according to an entry dated 1972-01-04 on p 330 of:
+# Presidential Papers: First year of the administration of
+# President William R. Tolbert, Jr., July 23, 1971-July 31, 1972.
+# Monrovia: Executive Mansion.
+#
+# Use the abbreviation "MMT" before 1972, as the more-accurate numeric
+# abbreviation "-004430" would be one byte over the POSIX limit.
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Monrovia	-0:43:08 -	LMT	1882
 			-0:43:08 -	MMT	1919 Mar # Monrovia Mean Time
-			-0:44:30 -	-004430	1972 May
+			-0:44:30 -	MMT	1972 Jan 7 # approximately MMT
 			 0:00	-	GMT
 
 ###############################################################################
--- a/jdk/test/sun/util/calendar/zi/tzdata/iso3166.tab	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/iso3166.tab	Mon Apr 10 08:31:37 2017 -0700
@@ -32,8 +32,8 @@
 # All text uses UTF-8 encoding.  The columns of the table are as follows:
 #
 # 1.  ISO 3166-1 alpha-2 country code, current as of
-#     ISO 3166-1 Newsletter VI-16 (2013-07-11).  See: Updates on ISO 3166
-#   http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm
+#     ISO 3166-1 N905 (2016-11-15).  See: Updates on ISO 3166-1
+#     http://isotc.iso.org/livelink/livelink/Open/16944257
 # 2.  The usual English name for the coded region,
 #     chosen so that alphabetic sorting of subsets produces helpful lists.
 #     This is not the same as the English name in the ISO 3166 tables.
--- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Mon Apr 10 08:31:37 2017 -0700
@@ -3162,6 +3162,12 @@
 # http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
 # http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/
 
+# From Steffen Thorsen (2017-03-12):
+# We have received 4 mails from different people telling that Haiti
+# has started DST again today, and this source seems to confirm that,
+# I have not been able to find a more authoritative source:
+# https://www.haitilibre.com/en/news-20319-haiti-notices-time-change-in-haiti.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Haiti	1983	only	-	May	8	0:00	1:00	D
 Rule	Haiti	1984	1987	-	Apr	lastSun	0:00	1:00	D
@@ -3174,6 +3180,8 @@
 Rule	Haiti	2005	2006	-	Oct	lastSun	0:00	0	S
 Rule	Haiti	2012	2015	-	Mar	Sun>=8	2:00	1:00	D
 Rule	Haiti	2012	2015	-	Nov	Sun>=1	2:00	0	S
+Rule	Haiti	2017	max	-	Mar	Sun>=8	2:00	1:00	D
+Rule	Haiti	2017	max	-	Nov	Sun>=1	2:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Port-au-Prince -4:49:20 -	LMT	1890
 			-4:49	-	PPMT	1917 Jan 24 12:00 # P-a-P MT
--- a/jdk/test/tools/jar/modularJar/Basic.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jar/modularJar/Basic.java	Mon Apr 10 08:31:37 2017 -0700
@@ -869,8 +869,8 @@
         return new Object[][] {
             // JAR file name                module-name[@version]
             { "foo.jar",                    "foo" },
+            { "foo1.jar",                   "foo1" },
             { "foo4j.jar",                  "foo4j", },
-            { "foo1.2.3.jar",               "foo" },
             { "foo-1.2.3.4.jar",            "foo@1.2.3.4" },
             { "foo-bar.jar",                "foo.bar" },
             { "foo-1.2-SNAPSHOT.jar",       "foo@1.2-SNAPSHOT" },
--- a/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/Bar.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/Bar.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,7 +28,6 @@
 import java.lang.module.ModuleDescriptor.Provides;
 import java.lang.module.ModuleReference;
 import java.lang.module.ResolvedModule;
-import java.lang.reflect.Module;
 import java.util.Optional;
 import java.util.StringJoiner;
 import java.util.HashSet;
--- a/jdk/test/tools/jlink/IntegrationTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/IntegrationTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.UncheckedIOException;
+import java.nio.ByteOrder;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -135,11 +136,6 @@
         }
         System.out.println(jl);
 
-        JlinkConfiguration config
-                = new JlinkConfiguration(null, null, null, null);
-
-        System.out.println(config);
-
         Plugin p = Jlink.newPlugin("toto", Collections.emptyMap(), null);
         if (p != null) {
             throw new Exception("Plugin should be null");
@@ -163,7 +159,7 @@
         Set<String> limits = new HashSet<>();
         limits.add("java.management");
         JlinkConfiguration config = new Jlink.JlinkConfiguration(output,
-                modulePaths, mods, limits, null);
+                modulePaths, mods, limits, ByteOrder.nativeOrder());
 
         List<Plugin> lst = new ArrayList<>();
 
--- a/jdk/test/tools/jlink/JLink2Test.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/JLink2Test.java	Mon Apr 10 08:31:37 2017 -0700
@@ -39,7 +39,6 @@
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.lang.reflect.Layer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
@@ -88,7 +87,7 @@
 
     private static void testOptions() throws Exception {
         List<Plugin> builtInPlugins = new ArrayList<>();
-        builtInPlugins.addAll(PluginRepository.getPlugins(Layer.boot()));
+        builtInPlugins.addAll(PluginRepository.getPlugins(ModuleLayer.boot()));
         if(builtInPlugins.isEmpty()) {
             throw new Exception("No builtin plugins");
         }
--- a/jdk/test/tools/jlink/JLinkTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/JLinkTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.lang.module.ModuleDescriptor;
-import java.lang.reflect.Layer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -88,7 +87,7 @@
         {
             // number of built-in plugins
             List<Plugin> builtInPlugins = new ArrayList<>();
-            builtInPlugins.addAll(PluginRepository.getPlugins(Layer.boot()));
+            builtInPlugins.addAll(PluginRepository.getPlugins(ModuleLayer.boot()));
             totalPlugins = builtInPlugins.size();
             // actual num. of plugins loaded from jdk.jlink module
             int actualJLinkPlugins = 0;
@@ -274,7 +273,7 @@
             String[] userOptions = {"--compress", "2", "foo" };
             String moduleName = "orphanarg1";
             helper.generateDefaultJModule(moduleName, "composite2");
-            helper.generateDefaultImage(userOptions, moduleName).assertFailure("Error: orphan argument: foo");
+            helper.generateDefaultImage(userOptions, moduleName).assertFailure("Error: invalid argument: foo");
         }
 
         // orphan argument - JDK-8166810
@@ -282,7 +281,7 @@
             String[] userOptions = {"--output", "foo", "bar" };
             String moduleName = "orphanarg2";
             helper.generateDefaultJModule(moduleName, "composite2");
-            helper.generateDefaultImage(userOptions, moduleName).assertFailure("Error: orphan argument: bar");
+            helper.generateDefaultImage(userOptions, moduleName).assertFailure("Error: invalid argument: bar");
         }
 
         // basic check for --help - JDK-8173717
--- a/jdk/test/tools/jlink/basic/src/test/jdk/test/Test.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/basic/src/test/jdk/test/Test.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,9 +23,6 @@
 
 package jdk.test;
 
-import java.lang.reflect.Module;
-import java.lang.reflect.Layer;
-
 public class Test {
     public static void main(String[] args) {
         System.out.println(Test.class + " ...");
@@ -36,7 +33,7 @@
         ClassLoader scl = ClassLoader.getSystemClassLoader();
         ClassLoader cl1 = Test.class.getClassLoader();
         Module testModule = Test.class.getModule();
-        ClassLoader cl2 = Layer.boot().findLoader(testModule.getName());
+        ClassLoader cl2 = ModuleLayer.boot().findLoader(testModule.getName());
 
         if (cl1 != scl)
             throw new RuntimeException("Not loaded by system class loader");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/BindServices.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,200 @@
+/*
+ * 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.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+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.spi.ToolProvider;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static jdk.testlibrary.Asserts.assertTrue;
+import static jdk.testlibrary.ProcessTools.*;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/**
+ * @test
+ * @bug 8174826
+ * @library /lib/testlibrary
+ * @modules jdk.compiler jdk.jlink
+ * @build BindServices CompilerUtils jdk.testlibrary.ProcessTools
+ * @run testng BindServices
+ */
+
+public class BindServices {
+    private static final String JAVA_HOME = System.getProperty("java.home");
+    private static final String TEST_SRC = System.getProperty("test.src");
+
+    private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
+    private static final Path MODS_DIR = Paths.get("mods");
+
+    private static final String MODULE_PATH =
+        Paths.get(JAVA_HOME, "jmods").toString() +
+            File.pathSeparator + MODS_DIR.toString();
+
+    // the names of the modules in this test
+    private static String[] modules = new String[] {"m1", "m2", "m3"};
+
+
+    private static boolean hasJmods() {
+        if (!Files.exists(Paths.get(JAVA_HOME, "jmods"))) {
+            System.err.println("Test skipped. NO jmods directory");
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * Compiles all modules used by the test
+     */
+    @BeforeTest
+    public void compileAll() throws Throwable {
+        if (!hasJmods()) return;
+
+        for (String mn : modules) {
+            Path msrc = SRC_DIR.resolve(mn);
+            assertTrue(CompilerUtils.compile(msrc, MODS_DIR,
+                "--module-source-path", SRC_DIR.toString()));
+        }
+    }
+
+    @Test
+    public void noServiceBinding() throws Throwable {
+        if (!hasJmods()) return;
+
+        Path dir = Paths.get("noServiceBinding");
+
+        // no service binding and does not link m2,m3 providers.
+        JLink.run("--output", dir.toString(),
+                  "--module-path", MODULE_PATH,
+                  "--add-modules", "m1").output();
+
+        testImage(dir, "m1");
+    }
+
+    @Test
+    public void fullServiceBinding() throws Throwable {
+        if (!hasJmods()) return;
+
+        Path dir = Paths.get("fullServiceBinding");
+
+        // full service binding
+        // m2 is a provider used by m1.  During service binding, when m2 is
+        // resolved, m2 uses p2.T that causes m3 to be linked as it is a
+        // provider to p2.T
+        JLink.run("--output", dir.toString(),
+                  "--module-path", MODULE_PATH,
+                  "--add-modules", "m1",
+                  "--bind-services",
+                  "--limit-modules", "m1,m2,m3,java.base");
+
+        testImage(dir, "m1", "m2", "m3");
+    }
+
+    @Test
+    public void testVerbose() throws Throwable {
+        if (!hasJmods()) return;
+
+        Path dir = Paths.get("verbose");
+
+        List<String> output =
+            JLink.run("--output", dir.toString(),
+                      "--module-path", MODULE_PATH,
+                      "--add-modules", "m1",
+                      "--bind-services",
+                      "--verbose",
+                      "--limit-modules", "m1,m2,m3,java.base").output();
+
+        List<String> expected = List.of(
+            "module m1 (" + MODS_DIR.resolve("m1").toUri().toString() + ")",
+            "module m2 (" + MODS_DIR.resolve("m2").toUri().toString() + ")",
+            "module m3 (" + MODS_DIR.resolve("m3").toUri().toString() + ")",
+            "module m1 provides p1.S, used by m1",
+            "module m2 provides p1.S, used by m1",
+            "module m2 provides p2.T, used by m2",
+            "module m3 provides p2.T, used by m2"
+        );
+
+        assertTrue(output.containsAll(expected));
+
+        testImage(dir, "m1", "m2", "m3");
+    }
+
+    /*
+     * Tests the given ${java.home} to only contain the specified modules
+     */
+    private void testImage(Path javaHome, String... modules) throws Throwable {
+        Path java = javaHome.resolve("bin").resolve("java");
+        String[] cmd = Stream.concat(
+            Stream.of(java.toString(), "-m", "m1/p1.Main"),
+            Stream.of(modules)).toArray(String[]::new);
+
+        assertTrue(executeProcess(cmd).outputTo(System.out)
+                                      .errorTo(System.out)
+                                      .getExitValue() == 0);
+    }
+
+    static class JLink {
+        static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
+            .orElseThrow(() ->
+                new RuntimeException("jlink tool not found")
+            );
+
+        static JLink run(String... options) {
+            JLink jlink = new JLink();
+            assertTrue(jlink.execute(options) == 0);
+            return jlink;
+        }
+
+        final List<String> output = new ArrayList<>();
+        private int execute(String... options) {
+            System.out.println("jlink " +
+                Stream.of(options).collect(Collectors.joining(" ")));
+
+            StringWriter writer = new StringWriter();
+            PrintWriter pw = new PrintWriter(writer);
+            int rc = JLINK_TOOL.run(pw, pw, options);
+            System.out.println(writer.toString());
+            Stream.of(writer.toString().split("\\v"))
+                  .map(String::trim)
+                  .forEach(output::add);
+            return rc;
+        }
+
+        boolean contains(String s) {
+            return output.contains(s);
+        }
+
+        List<String> output() {
+            return output;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/SuggestProviders.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,209 @@
+/*
+ * 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.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+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.spi.ToolProvider;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static jdk.testlibrary.Asserts.assertTrue;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/**
+ * @test
+ * @bug 8174826
+ * @library /lib/testlibrary
+ * @modules jdk.charsets jdk.compiler jdk.jlink
+ * @build SuggestProviders CompilerUtils
+ * @run testng SuggestProviders
+ */
+
+public class SuggestProviders {
+    private static final String JAVA_HOME = System.getProperty("java.home");
+    private static final String TEST_SRC = System.getProperty("test.src");
+
+    private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
+    private static final Path MODS_DIR = Paths.get("mods");
+
+    private static final String MODULE_PATH =
+        Paths.get(JAVA_HOME, "jmods").toString() +
+        File.pathSeparator + MODS_DIR.toString();
+
+    // the names of the modules in this test
+    private static String[] modules = new String[] {"m1", "m2", "m3"};
+
+
+    private static boolean hasJmods() {
+        if (!Files.exists(Paths.get(JAVA_HOME, "jmods"))) {
+            System.err.println("Test skipped. NO jmods directory");
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * Compiles all modules used by the test
+     */
+    @BeforeTest
+    public void compileAll() throws Throwable {
+        if (!hasJmods()) return;
+
+        for (String mn : modules) {
+            Path msrc = SRC_DIR.resolve(mn);
+            assertTrue(CompilerUtils.compile(msrc, MODS_DIR,
+                "--module-source-path", SRC_DIR.toString()));
+        }
+    }
+
+    @Test
+    public void suggestProviders() throws Throwable {
+        if (!hasJmods()) return;
+
+        List<String> output = JLink.run("--module-path", MODULE_PATH,
+                                        "--add-modules", "m1",
+                                        "--suggest-providers").output();
+        // check a subset of services used by java.base
+        List<String> expected = List.of(
+            "uses java.lang.System$LoggerFinder",
+            "uses java.net.ContentHandlerFactory",
+            "uses java.net.spi.URLStreamHandlerProvider",
+            "uses java.nio.channels.spi.AsynchronousChannelProvider",
+            "uses java.nio.channels.spi.SelectorProvider",
+            "uses java.nio.charset.spi.CharsetProvider",
+            "uses java.nio.file.spi.FileSystemProvider",
+            "uses java.nio.file.spi.FileTypeDetector",
+            "uses java.security.Provider",
+            "uses java.util.spi.ToolProvider",
+            "uses p1.S",
+            "module jdk.charsets provides java.nio.charset.spi.CharsetProvider, used by java.base",
+            "module jdk.compiler provides java.util.spi.ToolProvider, used by java.base",
+            "module jdk.jlink provides java.util.spi.ToolProvider, used by java.base",
+            "module m1 provides p1.S, used by m1",
+            "module m2 provides p1.S, used by m1"
+        );
+
+        assertTrue(output.containsAll(expected));
+    }
+
+    @Test
+    public void providersForServices() throws Throwable {
+        if (!hasJmods()) return;
+
+        List<String> output =
+            JLink.run("--module-path", MODULE_PATH,
+                      "--add-modules", "m1",
+                      "--suggest-providers",
+                      "java.nio.charset.spi.CharsetProvider,p1.S,p2.T").output();
+
+        System.out.println(output);
+        List<String> expected = List.of(
+            "module jdk.charsets provides java.nio.charset.spi.CharsetProvider, used by java.base",
+            "module m1 provides p1.S, used by m1",
+            "module m2 provides p1.S, used by m1",
+            "module m2 provides p2.T, used by m2",
+            "module m3 provides p2.T, used by m2"
+        );
+
+        assertTrue(output.containsAll(expected));
+    }
+
+    @Test
+    public void unusedService() throws Throwable {
+        if (!hasJmods()) return;
+
+        List<String> output =
+            JLink.run("--module-path", MODULE_PATH,
+                "--add-modules", "m1",
+                "--suggest-providers",
+                "nonExistentType").output();
+
+        System.out.println(output);
+        List<String> expected = List.of(
+            "Services specified in --suggest-providers not used: nonExistentType"
+        );
+
+        assertTrue(output.containsAll(expected));
+    }
+
+    @Test
+    public void noSuggestProviders() throws Throwable {
+        if (!hasJmods()) return;
+
+        List<String> output =
+            JLink.run("--module-path", MODULE_PATH,
+                      "--add-modules", "m1",
+                      "--bind-services",
+                      "--limit-modules", "m1,m2,m3,java.base",
+                      "--suggest-providers").output();
+
+        String expected = "--bind-services option is specified. No additional providers suggested.";
+        assertTrue(output.contains(expected));
+
+    }
+
+    static class JLink {
+        static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
+            .orElseThrow(() ->
+                new RuntimeException("jlink tool not found")
+            );
+
+        static JLink run(String... options) {
+            JLink jlink = new JLink();
+            assertTrue(jlink.execute(options) == 0);
+            return jlink;
+        }
+
+        final List<String> output = new ArrayList<>();
+        private int execute(String... options) {
+            System.out.println("jlink " +
+                Stream.of(options).collect(Collectors.joining(" ")));
+
+            StringWriter writer = new StringWriter();
+            PrintWriter pw = new PrintWriter(writer);
+            int rc = JLINK_TOOL.run(pw, pw, options);
+            System.out.println(writer.toString());
+            Stream.of(writer.toString().split("\\v"))
+                  .map(String::trim)
+                  .forEach(output::add);
+            return rc;
+        }
+
+        boolean contains(String s) {
+            return output.contains(s);
+        }
+
+        List<String> output() {
+            return output;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/src/m1/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module m1 {
+    exports p1;
+    uses p1.S;
+    provides p1.S with p1.Impl;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/src/m1/p1/Impl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p1;
+
+public class Impl implements S {
+    public String name() {
+        return this.getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/src/m1/p1/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package p1;
+
+import java.lang.module.ModuleFinder;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * This tests if JAVA_HOME is linked only with the specified modules.
+ */
+public class Main {
+    public static void main(String... args) {
+        Set<String> modules = ModuleFinder.ofSystem().findAll().stream()
+            .map(mref -> mref.descriptor().name())
+            .filter(mn -> !mn.equals("java.base"))
+            .collect(Collectors.toSet());
+
+        Set<String> notLinked = Stream.of(args).filter(mn -> !modules.contains(mn))
+                                      .collect(Collectors.toSet());
+        if (!notLinked.isEmpty()) {
+            throw new RuntimeException("Expected modules not linked in the image: "
+                + notLinked);
+        }
+        Stream.of(args).forEach(modules::remove);
+
+        if (!modules.isEmpty()) {
+            throw new RuntimeException("Unexpected modules linked in the image: "
+                + modules);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/src/m1/p1/S.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p1;
+
+public interface S {
+    String name();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/src/m2/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module m2 {
+    requires m1;
+    exports p2;
+    uses p2.T;
+    provides p1.S with p2.Impl;
+    provides p2.T with p2.Impl;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/src/m2/p2/Impl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p2;
+
+public class Impl implements p1.S, T {
+    public String name() {
+        return this.getClass().getName();
+    }
+
+    public void run() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/src/m2/p2/T.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p2;
+
+public interface T {
+    void run();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/src/m3/module-info.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module m3 {
+    requires m2;
+    provides p2.T with p3.Impl;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/bindservices/src/m3/p3/Impl.java	Mon Apr 10 08:31:37 2017 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p3;
+
+public class Impl implements p2.T {
+    public void run() {
+    }
+}
--- a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -30,7 +30,6 @@
  *          jdk.jlink/jdk.tools.jlink.plugin
  * @run main/othervm PluginsNegativeTest
  */
-import java.lang.reflect.Layer;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -63,7 +62,7 @@
 
     private void testDuplicateBuiltInProviders() {
         List<Plugin> javaPlugins = new ArrayList<>();
-        javaPlugins.addAll(PluginRepository.getPlugins(Layer.boot()));
+        javaPlugins.addAll(PluginRepository.getPlugins(ModuleLayer.boot()));
         for (Plugin javaPlugin : javaPlugins) {
             System.out.println("Registered plugin: " + javaPlugin.getName());
         }
@@ -72,7 +71,7 @@
             try {
                 PluginRepository.registerPlugin(new CustomPlugin(pluginName));
                 try {
-                    PluginRepository.getPlugin(pluginName, Layer.boot());
+                    PluginRepository.getPlugin(pluginName, ModuleLayer.boot());
                     throw new AssertionError("Exception is not thrown for duplicate plugin: " + pluginName);
                 } catch (Exception ignored) {
                 }
@@ -83,7 +82,7 @@
     }
 
     private void testUnknownProvider() {
-        if (PluginRepository.getPlugin("unknown", Layer.boot()) != null) {
+        if (PluginRepository.getPlugin("unknown", ModuleLayer.boot()) != null) {
             throw new AssertionError("Exception expected for unknown plugin name");
         }
     }
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,7 +24,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.lang.module.ModuleDescriptor;
-import java.lang.reflect.Layer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,8 +26,6 @@
 import java.io.InputStream;
 import java.io.IOException;
 import java.lang.module.ModuleDescriptor;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.net.URI;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m3/p3/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m3/p3/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -26,7 +26,6 @@
 import p4.Foo;
 import java.lang.module.ModuleDescriptor;
 import java.lang.reflect.Field;
-import java.lang.reflect.Module;
 
 import static java.lang.module.ModuleDescriptor.Exports.Modifier.*;
 
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m4/p4/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m4/p4/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -27,7 +27,6 @@
 import java.io.InputStream;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
 import java.net.URI;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
@@ -100,7 +99,7 @@
 
     private static void checkModule(String mn, String... packages) throws IOException {
         // verify ModuleDescriptor from the runtime module
-        ModuleDescriptor md = Layer.boot().findModule(mn).get()
+        ModuleDescriptor md = ModuleLayer.boot().findModule(mn).get()
                                    .getDescriptor();
         checkModuleDescriptor(md, packages);
 
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m5/p5/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m5/p5/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -23,7 +23,6 @@
 
 package p5;
 
-import java.lang.reflect.Layer;
 import p3.Foo;
 import p3.Lib;
 
@@ -32,7 +31,7 @@
  */
 public class Main {
     public static void main(String... args) {
-        boolean libPresent = Layer.boot().findModule("m3").isPresent();
+        boolean libPresent = ModuleLayer.boot().findModule("m3").isPresent();
         if (LibHelper.libClassFound != libPresent) {
             throw new RuntimeException("Expected module m3 not in the boot layer");
         }
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/test/jdk/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/test/jdk/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,8 +24,6 @@
 package jdk.test;
 
 import java.lang.module.ModuleDescriptor;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.net.URI;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
@@ -65,7 +63,7 @@
         // check the module descriptor of a system module
         for (int i=0; i < modules.size(); i++) {
             String mn = modules.get(i);
-            Module module = Layer.boot().findModule(mn).orElseThrow(
+            Module module = ModuleLayer.boot().findModule(mn).orElseThrow(
                 () -> new RuntimeException(mn + " not found")
             );
 
--- a/jdk/test/tools/launcher/modules/dryrun/DryRunTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/launcher/modules/dryrun/DryRunTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -167,22 +167,6 @@
         // test main method with and without --add-modules mm
         int exitValue = exec("--module-path", LIBS_DIR.toString(),
                              "-m", mid);
-        assertTrue(exitValue != 0);
-
-        exitValue = exec("--module-path", LIBS_DIR.toString(),
-                         "--add-modules", M_MODULE,
-                         "-m", mid);
-        assertTrue(exitValue == 0);
-
-        // test dry run with and without --add-modules m
-        // no resolution failure
-        exitValue = exec("--dry-run", "--module-path", LIBS_DIR.toString(),
-                         "-m", mid);
-        assertTrue(exitValue == 0);
-
-        exitValue = exec("--dry-run", "--module-path", LIBS_DIR.toString(),
-                         "--add-modules", M_MODULE,
-                         "-m", mid);
         assertTrue(exitValue == 0);
     }
 
--- a/jdk/test/tools/launcher/modules/listmods/ListModsTest.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/launcher/modules/listmods/ListModsTest.java	Mon Apr 10 08:31:37 2017 -0700
@@ -115,7 +115,7 @@
                 .outputTo(System.out)
                 .errorTo(System.out);
         output.shouldNotContain("java.base");
-        output.shouldContain("java.rhubarb not observable");
+        output.shouldContain("java.rhubarb not found");
         assertTrue(output.getExitValue() == 0);
     }
 
--- a/jdk/test/tools/launcher/modules/patch/basic/src/test/jdk/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/launcher/modules/patch/basic/src/test/jdk/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -28,8 +28,6 @@
 
 package jdk.test;
 
-import java.lang.reflect.Module;
-
 public class Main {
 
     public static void main(String[] args) throws Exception {
--- a/jdk/test/tools/launcher/modules/upgrademodulepath/src/test/jdk/test/Main.java	Mon Apr 10 16:20:40 2017 +0530
+++ b/jdk/test/tools/launcher/modules/upgrademodulepath/src/test/jdk/test/Main.java	Mon Apr 10 08:31:37 2017 -0700
@@ -24,7 +24,6 @@
 package jdk.test;
 
 import java.lang.module.ModuleReference;
-import java.lang.reflect.Layer;
 import java.net.URI;
 
 import javax.enterprise.context.Scope;
@@ -53,7 +52,7 @@
 
         // javax.transaction should be found in boot layer.
         ModuleReference ref =
-                Layer.boot().configuration().findModule(TRANSACTION_MODULE).get().reference();
+                ModuleLayer.boot().configuration().findModule(TRANSACTION_MODULE).get().reference();
         // check uri of java.transaction found on the upgrade module path.
         URI uri = ref.location().get();
         System.out.println("uri: " + uri);