8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
authorccheung
Wed, 25 Apr 2018 14:08:19 -0700
changeset 49894 c830e94b5606
parent 49893 e1e60f75cd39
child 49895 661ef62a6618
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules Reviewed-by: iklam, mseledtsov
test/hotspot/jtreg/ProblemList.txt
test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java
test/hotspot/jtreg/runtime/SharedArchiveFile/javax/annotation/processing/FilerException.jasm
test/hotspot/jtreg/runtime/SharedArchiveFile/org/omg/CORBA/Context.jasm
test/hotspot/jtreg/runtime/appcds/HelloExtTest.java
test/hotspot/jtreg/runtime/appcds/javaldr/AnonVmClassesDuringDump.java
test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java
test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java
test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java
test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java
test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/src/com/sun/tools/javac/Main2.jasm
test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/src/com/sun/tools/javac/MyMain.jasm
test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/src/javax/activation/UnsupportedDataTypeException2.jasm
test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/src/jdk/test/Main.java
test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java
test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/java.activation/javax/activation/UnsupportedDataTypeException.java
test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/java.activation/module-info.java
test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/java.net.http/java/net/http/HttpTimeoutException.java
test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/java.net.http/module-info.java
test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/test/jdk/test/Main.java
test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/test/module-info.java
test/hotspot/jtreg/runtime/appcds/test-classes/HelloExt.java
test/hotspot/jtreg/runtime/appcds/test-classes/javax/activation/MimeType.jasm
test/lib/jdk/test/lib/cds/CDSTestUtils.java
--- a/test/hotspot/jtreg/ProblemList.txt	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/ProblemList.txt	Wed Apr 25 14:08:19 2018 -0700
@@ -92,12 +92,6 @@
 # Java EE Module Removal
 #
 
-runtime/appcds/jigsaw/classpathtests/ClassPathTests.java                       8194310    generic-all  Java EE Module Removal
-runtime/appcds/jigsaw/overridetests/OverrideTests.java                         8194310    generic-all  Java EE Module Removal
-runtime/SharedArchiveFile/BootAppendTests.java                                 8194310    generic-all  Java EE Module Removal
 runtime/modules/PatchModule/PatchModuleClassList.java                          8194310    generic-all  Java EE Module Removal
 compiler/c2/Test8007294.java                                                   8194310    generic-all  Java EE Module Removal
 compiler/c2/Test6852078.java                                                   8194310    generic-all  Java EE Module Removal
-runtime/AppCDS/HelloExtTest.java                                               8194310    generic-all  Java EE Module Removal
-runtime/AppCDS/javaldr/CheckAnonymousClass.java                                8194310    generic-all  Java EE Module Removal
-runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java          8194310    generic-all  Java EE Module Removal
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java	Wed Apr 25 14:08:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * 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,11 +27,12 @@
  * @summary Testing -Xbootclasspath/a support for CDS
  * @requires vm.cds
  * @library /test/lib
- * @modules java.base/jdk.internal.misc
+ * @modules java.compiler
+ *          java.base/jdk.internal.misc
  *          java.management
  *          jdk.internal.jvmstat/sun.jvmstat.monitor
  * @compile javax/sound/sampled/MyClass.jasm
- * @compile org/omg/CORBA/Context.jasm
+ * @compile javax/annotation/processing/FilerException.jasm
  * @compile nonjdk/myPackage/MyClass.java
  * @build LoadClass
  * @run main/othervm BootAppendTests
@@ -53,7 +54,8 @@
 public class BootAppendTests {
     private static final String APP_CLASS = "LoadClass";
     private static final String BOOT_APPEND_MODULE_CLASS = "javax/sound/sampled/MyClass";
-    private static final String BOOT_APPEND_DUPLICATE_MODULE_CLASS = "org/omg/CORBA/Context";
+    private static final String BOOT_APPEND_DUPLICATE_MODULE_CLASS =
+        "javax/annotation/processing/FilerException";
     private static final String BOOT_APPEND_CLASS = "nonjdk/myPackage/MyClass";
     private static final String BOOT_APPEND_MODULE_CLASS_NAME =
         BOOT_APPEND_MODULE_CLASS.replace('/', '.');
@@ -141,21 +143,21 @@
     //          from -Xbootclasspath/a. Verify the behavior is the same at runtime
     //          when CDS is enabled.
     //
-    //          The org.omg.CORBA.Context is a boot module class. The class on
-    //          the -Xbootclasspath/a path that has the same fully-qualified name
-    //          should not be loaded at runtime when CDS is enabled.
-    //          The one from the boot modules should be loaded instead.
+    //          The javax/annotation/processing/FilerException is a platform module
+    //          class. The class on the -Xbootclasspath/a path that has the same
+    //          fully-qualified name should not be loaded at runtime when CDS is enabled.
+    //          The one from the platform modules should be loaded instead.
     public static void testBootAppendDuplicateModuleClass() throws Exception {
         for (String mode : modes) {
             CDSOptions opts = (new CDSOptions())
                 .setXShareMode(mode).setUseVersion(false)
-                .addPrefix("--add-modules", "java.corba", "-showversion",
+                .addPrefix("-showversion",
                            "-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
                 .addSuffix("-Xlog:class+load=info",
                            APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
 
             OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
-            CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context source: jrt:/java.corba");
+            CDSTestUtils.checkExec(out, opts, "[class,load] javax.annotation.processing.FilerException source: jrt:/java.compiler");
         }
     }
 
@@ -164,9 +166,9 @@
     //          using --limit-modules. Verify the behavior is the same at runtime when CDS
     //          is enabled.
     //
-    //          The java.desktop module is excluded using --limit-modules at runtime,
-    //          javax.sound.sampled.MyClass is archived from -Xbootclasspath/a. It can be
-    //          loaded from the archive at runtime.
+    //          The java.desktop module is excluded using --limit-modules at runtime
+    //          CDS will be disabled with the --limit-modules option during runtime.
+    //          javax.sound.sampled.MyClass will be loaded from the jar at runtime.
     public static void testBootAppendExcludedModuleClass() throws Exception {
         for (String mode : modes) {
             CDSOptions opts = (new CDSOptions())
@@ -175,13 +177,18 @@
                            "--limit-modules=java.base", "-cp", appJar)
                 .addSuffix("-Xlog:class+load=info",
                            APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
-
-            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
-            CDSTestUtils.checkExec(out, opts, "[class,load] javax.sound.sampled.MyClass");
-
-            // When CDS is enabled, the shared class should be loaded from the archive.
+            CDSTestUtils.Result res = CDSTestUtils.run(opts);
+            String MATCH_PATTERN =
+                ".class.load. javax.sound.sampled.MyClass source:.*bootAppend.jar*";
             if (mode.equals("on")) {
-                CDSTestUtils.checkExec(out, opts, "[class,load] javax.sound.sampled.MyClass source: shared objects file");
+                res.assertSilentlyDisabledCDS(out -> {
+                    out.shouldHaveExitValue(0)
+                       .shouldMatch(MATCH_PATTERN);
+                    });
+            } else {
+                res.assertNormalExit(out -> {
+                    out.shouldMatch(MATCH_PATTERN);
+                    });
             }
         }
     }
@@ -192,10 +199,12 @@
     //          --limit-modules. Verify the behavior is the same at runtime
     //          when CDS is enabled.
     //
-    //          The org.omg.CORBA.Context is a boot module class. The class
-    //          on -Xbootclasspath/a that has the same fully-qualified name
-    //          as org.omg.CORBA.Context can be loaded at runtime when
-    //          java.corba is excluded.
+    //          The javax.annotation.processing.FilerException is a platform module class.
+    //          The class on -Xbootclasspath/a that has the same fully-qualified name
+    //          as javax.annotation.processing.FilerException can be loaded at runtime when
+    //          java.compiler is excluded.
+    //          CDS is disabled during runtime if the --limit-modules option is
+    //          specified.
     public static void testBootAppendDuplicateExcludedModuleClass() throws Exception {
         for (String mode : modes) {
             CDSOptions opts = (new CDSOptions())
@@ -205,14 +214,18 @@
                 .addSuffix("-Xlog:class+load=info",
                            APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
 
-            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
-            CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context");
-            if (!CDSTestUtils.isUnableToMap(out)) {
-                if (mode.equals("off")) {
-                    out.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar");
-                } else {
-                    CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context source: shared objects file");
-                }
+            CDSTestUtils.Result res = CDSTestUtils.run(opts);
+            String MATCH_PATTERN =
+                ".class.load. javax.annotation.processing.FilerException source:.*bootAppend.jar*";
+            if (mode.equals("on")) {
+                res.assertSilentlyDisabledCDS(out -> {
+                    out.shouldHaveExitValue(0)
+                       .shouldMatch(MATCH_PATTERN);
+                    });
+            } else {
+                res.assertNormalExit(out -> {
+                    out.shouldMatch(MATCH_PATTERN);
+                    });
             }
         }
     }
@@ -222,8 +235,9 @@
     //          the same at runtime when CDS is enabled.
     //
     //          The nonjdk.myPackage is not defined in named modules. The
-    //          archived nonjdk.myPackage.MyClass from -Xbootclasspath/a
-    //          can be loaded at runtime when CDS is enabled.
+    //          nonjdk.myPackage.MyClass will be loaded from the jar in
+    //          -Xbootclasspath/a since CDS will be disabled with the
+    //          --limit-modules option.
     public static void testBootAppendClass() throws Exception {
         for (String mode : modes) {
             CDSOptions opts = (new CDSOptions())
@@ -233,21 +247,26 @@
                 .addSuffix("-Xlog:class+load=info",
                            APP_CLASS, BOOT_APPEND_CLASS_NAME);
 
-            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
-            CDSTestUtils.checkExec(out, opts, "[class,load] nonjdk.myPackage.MyClass");
-
-            // If CDS is enabled, the nonjdk.myPackage.MyClass should be loaded
-            // from the shared archive.
+            CDSTestUtils.Result res = CDSTestUtils.run(opts);
+            String MATCH_PATTERN =
+                ".class.load. nonjdk.myPackage.MyClass source:.*bootAppend.jar*";
             if (mode.equals("on")) {
-                CDSTestUtils.checkExec(out, opts,
-                    "[class,load] nonjdk.myPackage.MyClass source: shared objects file");
+                res.assertSilentlyDisabledCDS(out -> {
+                    out.shouldHaveExitValue(0)
+                       .shouldMatch(MATCH_PATTERN);
+                    });
+            } else {
+                res.assertNormalExit(out -> {
+                    out.shouldMatch(MATCH_PATTERN);
+                    });
             }
         }
     }
 
     // Test #6: This is similar to Test #5. During runtime, an extra dir
     //          is appended to the bootclasspath. It should not invalidate
-    //          the shared archive.
+    //          the shared archive. However, CDS will be disabled with the
+    //          --limit-modules in the command line.
     public static void testBootAppendExtraDir() throws Exception {
         for (String mode : modes) {
             CDSOptions opts = (new CDSOptions())
@@ -257,14 +276,18 @@
                 .addSuffix("-Xlog:class+load=info",
                            APP_CLASS, BOOT_APPEND_CLASS_NAME);
 
-            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
-            CDSTestUtils.checkExec(out, opts, "[class,load] nonjdk.myPackage.MyClass");
-
-            // If CDS is enabled, the nonjdk.myPackage.MyClass should be loaded
-            // from the shared archive.
+            CDSTestUtils.Result res = CDSTestUtils.run(opts);
+            String MATCH_PATTERN =
+                ".class.load. nonjdk.myPackage.MyClass source:.*bootAppend.jar*";
             if (mode.equals("on")) {
-                CDSTestUtils.checkExec(out, opts,
-                    "[class,load] nonjdk.myPackage.MyClass source: shared objects file");
+                res.assertSilentlyDisabledCDS(out -> {
+                    out.shouldHaveExitValue(0)
+                       .shouldMatch(MATCH_PATTERN);
+                    });
+            } else {
+                res.assertNormalExit(out -> {
+                    out.shouldMatch(MATCH_PATTERN);
+                    });
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/javax/annotation/processing/FilerException.jasm	Wed Apr 25 14:08:19 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax/annotation/processing;
+
+public class FilerException
+    version 51:0
+{
+
+public Method "<init>":"()V"
+    stack 1 locals 1
+{
+    aload_0;
+    invokespecial   Method java/lang/Object."<init>":"()V";
+    return;
+}
+
+
+public Method toString:"()Ljava/lang/String;"
+    stack 1 locals 1
+{
+    ldc String "hi";
+    areturn; 
+}
+
+}
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/org/omg/CORBA/Context.jasm	Thu Apr 26 10:29:44 2018 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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 org/omg/CORBA;
-
-public class Context 
-    version 51:0
-{
-
-public Method "<init>":"()V"
-    stack 1 locals 1
-{
-    aload_0;
-    invokespecial   Method java/lang/Object."<init>":"()V";
-    return;
-}
-
-
-public Method toString:"()Ljava/lang/String;"
-    stack 1 locals 1
-{
-    ldc String "hi";
-    areturn; 
-}
-
-}
--- a/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java	Wed Apr 25 14:08:19 2018 -0700
@@ -51,8 +51,8 @@
     String bootClassPath = "-Xbootclasspath/a:" + whiteBoxJar;
 
     TestCommon.dump(appJar,
-        TestCommon.list("org/omg/CORBA/ORB", "[Ljava/lang/Comparable;"),
-        bootClassPath, "-verbose:class", "--add-modules", "java.corba");
+        TestCommon.list("javax/annotation/processing/FilerException", "[Ljava/lang/Comparable;"),
+        bootClassPath, "-verbose:class");
 
     String prefix = ".class.load. ";
     String class_pattern = ".*LambdaForm[$]MH[/][0123456789].*";
@@ -60,14 +60,14 @@
     String pattern = prefix + class_pattern + suffix;
 
     TestCommon.run("-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
-            "-cp", appJar, bootClassPath, "-verbose:class", "--add-modules", "java.corba", "HelloExt")
+            "-cp", appJar, bootClassPath, "-verbose:class", "HelloExt")
         .assertNormalExit(output -> output.shouldNotMatch(pattern));
 
 
     TestCommon.run("-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
             "-cp", appJar, bootClassPath, "-verbose:class",
             "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary",
-            "--add-modules", "java.corba", "HelloExt")
+            "HelloExt")
         .assertNormalExit(output ->  output.shouldNotMatch(class_pattern));
   }
 }
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/AnonVmClassesDuringDump.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/AnonVmClassesDuringDump.java	Wed Apr 25 14:08:19 2018 -0700
@@ -61,8 +61,22 @@
                             // Set the following property to see logs for dynamically generated classes
                             // in STDOUT
                             "-Djava.lang.invoke.MethodHandle.DUMP_CLASS_FILES=true");
+
+        String prefix = ".class.load. ";
+        // class name pattern like the following:
+        // jdk.internal.loader.BuiltinClassLoader$$Lambda$1/1816757085
+        // java.lang.invoke.LambdaForm$MH/1585787493
+        String class_pattern = ".*Lambda([a-z0-9$]+)/([0-9]+).*";
+        String suffix = ".*source: shared objects file.*";
+        String pattern = prefix + class_pattern + suffix;
+        // during run time, anonymous classes shouldn't be loaded from the archive
         TestCommon.run("-cp", appJar, "Hello")
-            .assertNormalExit();
+            .assertNormalExit(output -> output.shouldNotMatch(pattern));
+
+        // inspect the archive and make sure no anonymous class is in there
+        TestCommon.run("-cp", appJar,
+            "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary", "Hello")
+            .assertNormalExit(output -> output.shouldNotMatch(class_pattern));
     }
 }
 
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java	Thu Apr 26 10:29:44 2018 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @summary ensure no anonymous class is being dumped into the CDS archive
- * @requires vm.cds
- * @library /test/lib /test/hotspot/jtreg/runtime/appcds
- * @modules jdk.jartool/sun.tools.jar
- * @compile ../test-classes/Hello.java
- * @run main CheckAnonymousClass
- */
-
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class CheckAnonymousClass {
-
-  public static void main(String[] args) throws Exception {
-    JarBuilder.build("hello", "Hello");
-
-    String appJar = TestCommon.getTestJar("hello.jar");
-
-    TestCommon.dump(appJar, TestCommon.list("Hello", "org/omg/CORBA/ORB"),
-        "--add-modules", "java.corba", "-Xlog:class+load=info");
-
-    String prefix = ".class.load. ";
-    // class name pattern like the following:
-    // jdk.internal.loader.BuiltinClassLoader$$Lambda$1/1816757085
-    // java.lang.invoke.LambdaForm$MH/1585787493
-    String class_pattern = ".*Lambda([a-z0-9$]+)/([0-9]+).*";
-    String suffix = ".*source: shared objects file.*";
-    String pattern = prefix + class_pattern + suffix;
-    // during run time, anonymous classes shouldn't be loaded from the archive
-    TestCommon.run("-XX:+UnlockDiagnosticVMOptions",
-        "-cp", appJar, "-Xlog:class+load=info", "--add-modules", "java.corba", "Hello")
-      .assertNormalExit(output -> output.shouldNotMatch(pattern));
-
-    // inspect the archive and make sure no anonymous class is in there
-    TestCommon.run("-XX:+UnlockDiagnosticVMOptions",
-        "-cp", appJar, "-Xlog:class+load=info", "-XX:+PrintSharedArchiveAndExit",
-        "-XX:+PrintSharedDictionary", "--add-modules", "java.corba", "Hello")
-      .assertNormalExit(output -> output.shouldNotMatch(class_pattern));
-  }
-}
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java	Wed Apr 25 14:08:19 2018 -0700
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  *          jdk.internal.jvmstat/sun.jvmstat.monitor
  * @compile src/jdk/test/Main.java
- * @compile src/com/sun/tools/javac/Main2.jasm
+ * @compile src/com/sun/tools/javac/MyMain.jasm
  * @compile src/sun/nio/cs/ext/MyClass.java
  * @compile src/sun/nio/cs/ext1/MyClass.java
  * @run main BootAppendTests
@@ -52,7 +52,7 @@
     private static final Path CLASSES_DIR = Paths.get("classes");
 
     private static final String MAIN_CLASS = "jdk.test.Main";
-    private static final String APP_MODULE_CLASS = "com/sun/tools/javac/Main2";
+    private static final String APP_MODULE_CLASS = "com/sun/tools/javac/MyMain";
     private static final String BOOT_APPEND_MODULE_CLASS = "sun/nio/cs/ext/MyClass";
     private static final String BOOT_APPEND_CLASS = "sun/nio/cs/ext1/MyClass";
     private static final String[] ARCHIVE_CLASSES =
@@ -239,7 +239,7 @@
             MAIN_CLASS, "Test #9", APP_MODULE_CLASS, "true", "BOOT")
             .assertSilentlyDisabledCDS(out -> {
                 out.shouldHaveExitValue(0)
-                   .shouldMatch(".class.load. com.sun.tools.javac.Main2 source:.*bootAppend.jar");
+                   .shouldMatch(".class.load. com.sun.tools.javac.MyMain source:.*bootAppend.jar");
             });
     }
 
@@ -253,7 +253,7 @@
             MAIN_CLASS, "Test #10", APP_MODULE_CLASS, "true", "BOOT")
             .assertSilentlyDisabledCDS(out -> {
                 out.shouldHaveExitValue(0)
-                   .shouldMatch(".class.load. com.sun.tools.javac.Main2 source:.*bootAppend.jar");
+                   .shouldMatch(".class.load. com.sun.tools.javac.MyMain source:.*bootAppend.jar");
             });
     }
 }
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java	Wed Apr 25 14:08:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,13 @@
  * @requires vm.cds & !vm.graal.enabled
  * @library ../..
  * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules jdk.jartool/sun.tools.jar
+ * @modules java.compiler
+ *          java.base/jdk.internal.misc
+ *          jdk.jartool/sun.tools.jar
  * @compile src/jdk/test/Main.java
  * @compile src/com/sun/tools/javac/Main.jasm
- * @compile src/com/sun/tools/javac/Main2.jasm
- * @compile src/javax/activation/UnsupportedDataTypeException2.jasm
+ * @compile src/com/sun/tools/javac/MyMain.jasm
+ * @compile ../../../SharedArchiveFile/javax/annotation/processing/FilerException.jasm
  * @run main ClassPathTests
  * @summary AppCDS tests for testing classpath/package conflicts
  */
@@ -73,8 +74,8 @@
 
     // test classes to archive. These are both in UPGRADED_MODULES
     private static final String JIMAGE_CLASS      = "com/sun/tools/javac/Main";
-    private static final String APP_ARCHIVE_CLASS = "com/sun/tools/javac/Main2";
-    private static final String PLATFORM_ARCHIVE_CLASS = "javax/activation/UnsupportedDataTypeException2";
+    private static final String APP_ARCHIVE_CLASS = "com/sun/tools/javac/MyMain";
+    private static final String PLATFORM_ARCHIVE_CLASS = "javax/annotation/processing/FilerException";
     private static final String[] ARCHIVE_CLASSES = {APP_ARCHIVE_CLASS, PLATFORM_ARCHIVE_CLASS, JIMAGE_CLASS};
     private static final int NUMBER_OF_TEST_CASES = 10;
 
@@ -111,15 +112,17 @@
         // dump the archive with altnernate jdk.comiler and jdk.activation classes in the class list
         OutputAnalyzer output1  = TestCommon.dump(appJar, TestCommon.list(ARCHIVE_CLASSES));
         TestCommon.checkDump(output1);
-        // Only a class that belongs to a module which is not defined by default
-        // can be found. In this case the PLATFORM_ARCHIVE_CLASS belongs
-        // to the java.activation which is not defined by default; it is the only
-        // class can be found during dumping.
+        // The PLATFORM_ARCHIVE_CLASS belongs to the java.compiler
+        // module will be found from the module during dumping.
+        // The JIMAGE_CLASS will be found from the jdk.compiler module during
+        // dumping.
+        // The APP_ARCHIVE_CLASS, which belongs to a package within the
+        // jdk.compiler module, will not be found during dump time.
         for (String archiveClass : ARCHIVE_CLASSES) {
-            if (archiveClass.equals(PLATFORM_ARCHIVE_CLASS)) {
+            if (archiveClass.equals(APP_ARCHIVE_CLASS)) {
+                output1.shouldContain("Preload Warning: Cannot find " + archiveClass);
+            } else {
                 output1.shouldNotContain("Preload Warning: Cannot find " + archiveClass);
-            } else {
-                output1.shouldContain("Preload Warning: Cannot find " + archiveClass);
             }
         }
 
@@ -146,82 +149,86 @@
         CDSTestUtils.runWithArchiveAndCheck(opts);
     }
 
-    // For tests #3 and #4, we need to "--add-modules java.activation" since the
-    // java.activation module won't be defined by default.
-
     // #3: Archived classpath class in same package as jimage ext class. With AppCDS.
-    // Should fail to load.
+    // The class should be loaded from the module.
     public void testExtClassWithAppCDS() throws Exception {
         OutputAnalyzer output = TestCommon.exec(
-            appJar, "--add-modules", "java.activation", MAIN_CLASS,
-            "Test #3", PLATFORM_ARCHIVE_CLASS, "false"); // last 3 args passed to test
+            appJar, MAIN_CLASS,
+            "Test #3", PLATFORM_ARCHIVE_CLASS, "true", "EXT"); // last 4 args passed to test
         TestCommon.checkExec(output);
     }
 
     // #4: Archived classpath class in same package as jimage ext class. Without AppCDS.
-    // Should fail to load.
+    // The class should be loaded from the module.
     public void testExtClassWithoutAppCDS() throws Exception {
         CDSOptions opts = (new CDSOptions())
-            .addPrefix("-cp", appJar, "--add-modules", "java.activation")
+            .addPrefix("-cp", appJar)
             .setArchiveName(testArchiveName)
-            .addSuffix(MAIN_CLASS, "Test #4", PLATFORM_ARCHIVE_CLASS, "false");
+            .addSuffix(MAIN_CLASS, "Test #4", PLATFORM_ARCHIVE_CLASS, "true", "EXT");
 
         CDSTestUtils.runWithArchiveAndCheck(opts);
     }
 
     // #5: Archived classpath class in same package as jimage app class. With AppCDS.
-    // Should load because --limit-modules is used.
+    // Should load with CDS disabled because --limit-modules is used.
     public void testAppClassWithLimitModsWithAppCDS() throws Exception {
-        OutputAnalyzer output = TestCommon.exec(
-            appJar,
-            "--limit-modules", "java.base",
-            MAIN_CLASS,
-            "Test #5", APP_ARCHIVE_CLASS, "true"); // last 3 args passed to test
-        TestCommon.checkExec(output);
+        TestCommon.run("-cp", appJar,
+                       "--limit-modules", "java.base",
+                       MAIN_CLASS,
+                       "Test #5", APP_ARCHIVE_CLASS, "true") // last 3 args passed to test
+            .assertSilentlyDisabledCDS(out -> {
+                out.shouldHaveExitValue(0);
+            });
     }
 
     // #6: Archived classpath class in same package as jimage app class. Without AppCDS.
-    // Should load because --limit-modules is used.
+    // Should load with CDS disabled because --limit-modules is used.
     public void testAppClassWithLimitModsWithoutAppCDS() throws Exception {
         CDSOptions opts = (new CDSOptions())
             .addPrefix("-cp", appJar, "--limit-modules", "java.base")
             .setArchiveName(testArchiveName)
             .addSuffix(MAIN_CLASS, "Test #6", APP_ARCHIVE_CLASS, "true");
-
-        CDSTestUtils.runWithArchiveAndCheck(opts);
+        CDSTestUtils.run(opts)
+            .assertSilentlyDisabledCDS(out -> {
+                out.shouldHaveExitValue(0);
+            });
     }
 
     // #7: Archived classpath class in same package as jimage ext class. With AppCDS.
-    // Should load because --limit-modules is used.
+    // Should load with CDS disabled because --limit-modules is used.
     public void testExtClassWithLimitModsWithAppCDS() throws Exception {
-        OutputAnalyzer output = TestCommon.exec(
-            appJar,
-            "--limit-modules", "java.base",
-            MAIN_CLASS,
-            "Test #7", PLATFORM_ARCHIVE_CLASS, "true"); // last 3 args passed to test
-        TestCommon.checkExec(output);
+        TestCommon.run("-cp", appJar,
+                       "--limit-modules", "java.base",
+                       MAIN_CLASS,
+                       "Test #7", PLATFORM_ARCHIVE_CLASS, "true") // last 3 args passed to test
+            .assertSilentlyDisabledCDS(out -> {
+                out.shouldHaveExitValue(0);
+            });
     }
 
     // #8: Archived classpath class in same package as jimage ext class. Without AppCDS.
-    // Should load because --limit-modules is used.
+    // Should load with CDS disabled because --limit-modules is used.
     public void testExtClassWithLimitModsWithoutAppCDS() throws Exception {
         CDSOptions opts = (new CDSOptions())
             .addPrefix("-cp", appJar, "--limit-modules", "java.base")
             .setArchiveName(testArchiveName)
             .addSuffix(MAIN_CLASS, "Test #8", PLATFORM_ARCHIVE_CLASS, "true");
-
-        CDSTestUtils.runWithArchiveAndCheck(opts);
+        CDSTestUtils.run(opts)
+            .assertSilentlyDisabledCDS(out -> {
+                out.shouldHaveExitValue(0);
+            });
     }
 
     // #9: Archived classpath class with same name as jimage app class. With AppCDS.
-    // Should load because --limit-modules is used.
+    // Should load with CDS disabled because --limit-modules is used.
     public void testReplacingJImageClassWithAppCDS() throws Exception {
-        OutputAnalyzer output = TestCommon.exec(
-            appJar,
-            "--limit-modules", "java.base", "-XX:+TraceClassLoading",
-            MAIN_CLASS,
-            "Test #9", JIMAGE_CLASS, "true"); // last 3 args passed to test
-        TestCommon.checkExec(output);
+        TestCommon.run("-cp", appJar,
+                       "--limit-modules", "java.base",
+                       MAIN_CLASS,
+                       "Test #9", JIMAGE_CLASS, "true") // last 3 args passed to test
+            .assertSilentlyDisabledCDS(out -> {
+                out.shouldHaveExitValue(0);
+            });
     }
 
     // #10: Archived classpath class with same name as jimage app class. Without AppCDS.
@@ -233,8 +240,9 @@
             .addPrefix("-cp", appJar, "--limit-modules", "java.base")
             .setArchiveName(testArchiveName)
             .addSuffix(MAIN_CLASS, "Test #10", JIMAGE_CLASS, "true");
-
-        CDSTestUtils.runWithArchiveAndCheck(opts);
+        CDSTestUtils.run(opts)
+            .assertSilentlyDisabledCDS(out -> {
+                out.shouldHaveExitValue(0);
+            });
     }
-
 }
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java	Wed Apr 25 14:08:19 2018 -0700
@@ -27,11 +27,11 @@
  * @summary Ensure that classes found in jimage takes precedence over classes found in -Xbootclasspath/a.
  * @requires vm.cds
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
- * @modules java.activation
+ * @modules java.compiler
  *          jdk.jartool/sun.tools.jar
  * @compile ../../test-classes/DummyClassHelper.java
  * @compile ../../test-classes/java/net/HttpCookie.jasm
- * @compile ../../test-classes/javax/activation/MimeType.jasm
+ * @compile ../../../SharedArchiveFile/javax/annotation/processing/FilerException.jasm
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  * @run main DummyClassesInBootClassPath
@@ -57,21 +57,20 @@
 
     public static void main(String[] args) throws Exception {
         String classNames[] = { "java/net/HttpCookie",
-                                "javax/activation/MimeType"};
+                                "javax/annotation/processing/FilerException"};
         JarBuilder.build("dummyClasses", classNames[0], classNames[1]);
 
         String appJar = TestCommon.getTestJar("dummyClasses.jar");
         OutputAnalyzer dumpOutput = TestCommon.dump(
-            appJar, classNames, "-Xbootclasspath/a:" + appJar,
-            "--add-modules", "java.activation");
+            appJar, classNames, "-Xbootclasspath/a:" + appJar);
         List<String> argsList = new ArrayList<String>();
         for (int i = 0; i < classNames.length; i++) {
             argsList.add(classNames[i].replace('/', '.'));
         }
         String[] arguments = new String[argsList.size()];
         arguments = argsList.toArray(arguments);
-        Testcommon.run(
-            "--add-modules", "java.activation", "-Xbootclasspath/a:" + appJar,
+        TestCommon.run(
+            "-Xbootclasspath/a:" + appJar,
             "DummyClassHelper", arguments[0], arguments[1])
           .assertNormalExit(output -> checkOutput(output, classNames));
 
@@ -80,14 +79,14 @@
         String bootClassPath = "-Xbootclasspath/a:" + appJar +
             File.pathSeparator + whiteBoxJar;
         dumpOutput = TestCommon.dump(
-            appJar, classNames, bootClassPath, "--add-modules", "java.activation");
+            appJar, classNames, bootClassPath);
         argsList.add("testWithWhiteBox");
         arguments = new String[argsList.size()];
         arguments = argsList.toArray(arguments);
         String[] opts = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
-            "--add-modules", "java.activation", bootClassPath, "-Xlog:class+path=trace",
+            bootClassPath, "-Xlog:class+path=trace",
             "DummyClassHelper", arguments[0], arguments[1], arguments[2]};
-        Testcommon.run(opts)
+        TestCommon.run(opts)
           .assertNormalExit(output -> checkOutput(output, classNames));
     }
 }
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/src/com/sun/tools/javac/Main2.jasm	Thu Apr 26 10:29:44 2018 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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.
- *
- */
-
-package com/sun/tools/javac;
-
-public class Main2
-    version 51:0
-{
-
-public Method "<init>":"()V"
-    stack 1 locals 1
-{
-    aload_0;
-    invokespecial   Method java/lang/Object."<init>":"()V";
-    return;
-}
-
-public Method toString:"()Ljava/lang/String;"
-    stack 1 locals 1
-{
-    ldc String "hi";
-    areturn;
-}
-
-} // end class Main2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/src/com/sun/tools/javac/MyMain.jasm	Wed Apr 25 14:08:19 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package com/sun/tools/javac;
+
+public class MyMain
+    version 51:0
+{
+
+public Method "<init>":"()V"
+    stack 1 locals 1
+{
+    aload_0;
+    invokespecial   Method java/lang/Object."<init>":"()V";
+    return;
+}
+
+public Method toString:"()Ljava/lang/String;"
+    stack 1 locals 1
+{
+    ldc String "hi";
+    areturn;
+}
+
+} // end class Main2
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/src/javax/activation/UnsupportedDataTypeException2.jasm	Thu Apr 26 10:29:44 2018 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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.
- *
- */
-
-package javax/activation;
-
-public class UnsupportedDataTypeException2
-    version 51:0
-{
-
-public Method "<init>":"()V"
-    stack 1 locals 1
-{
-    aload_0;
-    invokespecial   Method java/lang/Object."<init>":"()V";
-    return;
-}
-
-public Method toString:"()Ljava/lang/String;"
-    stack 1 locals 1
-{
-    ldc String "hi";
-    areturn;
-}
-
-} // end class UnsupportedDataTypeException2
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/src/jdk/test/Main.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/src/jdk/test/Main.java	Wed Apr 25 14:08:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,10 +96,12 @@
                 }
                 // Make sure we got the right version of the class. toString() of an instance
                 // of the overridden version of the class should return "hi".
-                String s = clazz.newInstance().toString();
-                if (!s.equals("hi")) {
-                    throw new RuntimeException(testName + " FAILED: toString() returned \"" + s
-                                               + "\" instead of \"hi\"" );
+                if (actualLoader == SYS_LOADER) {
+                    String s = clazz.newInstance().toString();
+                    if (!s.equals("hi")) {
+                        throw new RuntimeException(testName + " FAILED: toString() returned \"" + s
+                                                   + "\" instead of \"hi\"" );
+                    }
                 }
                 System.out.println(testName + " PASSED: class loaded as expected.");
             } else {
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java	Wed Apr 25 14:08:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
     private static final Path MODS_DIR = Paths.get("mods");
 
     // the module that is upgraded
-    private static final String[] UPGRADED_MODULES = {"jdk.compiler", "java.activation"};
+    private static final String[] UPGRADED_MODULES = {"jdk.compiler", "java.net.http"};
     private static final Path[] UPGRADEDMODS_DIR = {Paths.get("upgradedmod1"), Paths.get("upgradedmod2")};
 
     // the test module
@@ -76,7 +76,7 @@
 
     // test classes to archive. These are both in UPGRADED_MODULES
     private static final String APP_ARCHIVE_CLASS = "com/sun/tools/javac/Main";
-    private static final String PLATFORM_ARCHIVE_CLASS = "javax/activation/UnsupportedDataTypeException";
+    private static final String PLATFORM_ARCHIVE_CLASS = "java/net/http/HttpTimeoutException";
     private static final String[] ARCHIVE_CLASSES = {APP_ARCHIVE_CLASS, PLATFORM_ARCHIVE_CLASS};
     private static String testArchiveName;
 
@@ -94,10 +94,10 @@
         int i = 0;
         for (String upgradedMod : UPGRADED_MODULES) {
             compiled = CompilerUtils.compile(
-                SRC_DIR.resolve(upgradedMod),
-                UPGRADEDMODS_DIR[i].resolve(upgradedMod)
+                SRC_DIR.resolve(UPGRADED_MODULES[i]),
+                UPGRADEDMODS_DIR[i].resolve(UPGRADED_MODULES[i])
             );
-            Asserts.assertTrue(compiled, upgradedMod + " did not compile");
+            Asserts.assertTrue(compiled, UPGRADED_MODULES[i] + " did not compile");
             i++;
         }
 
@@ -110,22 +110,12 @@
         );
         Asserts.assertTrue(compiled, TEST_MODULE + " did not compile");
 
-        // the java.activation module is not defined by default; --add-modules is required.
-        // dumping without "--add-modules java.activation"
-        // the class in the javax.activation package cannot be found
-        OutputAnalyzer output1  = TestCommon.dump(null /* appJar*/, TestCommon.list(ARCHIVE_CLASSES));
-        TestCommon.checkDump(output1);
-        output1.shouldContain(
-            "Preload Warning: Cannot find javax/activation/UnsupportedDataTypeException");
-
-        // dump the archive with jdk.comiler and java.activation classes in the class list
-        // with "--add-modules java.activation"
-        output1  = TestCommon.dump(null /* appJar*/, TestCommon.list(ARCHIVE_CLASSES),
-            "--add-modules", "java.activation");
-        TestCommon.checkDump(output1);
+        // dump the archive with jdk.compiler and java.net.http classes in the class list
+        OutputAnalyzer output  = TestCommon.dump(null /* appJar*/, TestCommon.list(ARCHIVE_CLASSES));
+        TestCommon.checkDump(output);
         // Make sure all the classes where successfully archived.
         for (String archiveClass : ARCHIVE_CLASSES) {
-            output1.shouldNotContain("Preload Warning: Cannot find " + archiveClass);
+            output.shouldNotContain("Preload Warning: Cannot find " + archiveClass);
         }
 
         testArchiveName = TestCommon.getCurrentArchiveName();
@@ -147,11 +137,11 @@
     /**
      * PLATFORM Class Overriding Tests
      *
-     * Archive PLATFORM class javax.activation.UnsupportedDataTypeException from module jdk.activation.
-     *  -At run time, upgrade module jdk.activation using --upgrade-module-path.
-     *   Class.forname(UnsupportedDataTypeException) MUST NOT load the archived UnsupportedDataTypeException.
-     *  -At run time, module jdk.activation also exists in --module-path.
-     *   Class.forname(UnsupportedDataTypeException) MUST load the archived UnsupportedDataTypeException.
+     * Archive PLATFORM class java.net.http.HttpTimeoutException from module java.net.http.
+     *  -At run time, upgrade module java.net.http using --upgrade-module-path.
+     *   Class.forname(HttpTimeoutException) MUST NOT load the archived HttpTimeoutException.
+     *  -At run time, module java.net.http also exists in --module-path.
+     *   Class.forname(HttpTimeoutException) MUST load the archived HttpTimeoutException.
      */
     public void testPlatformClassOverriding() throws Exception {
         testClassOverriding(PLATFORM_ARCHIVE_CLASS, "platform");
@@ -173,25 +163,16 @@
         prefix[0] = "-cp";
         prefix[1] = "\"\"";
         prefix[2] = "--add-modules";
-        prefix[3] = "java.activation";
+        prefix[3] = "java.net.http";
 
         // Run the test with --upgrade-module-path set to alternate location of archiveClass
         // The alternate version of archiveClass SHOULD be found.
-        output = TestCommon.execModule(
-            prefix,
-            UPGRADEDMODS_DIR[upgradeModIdx].toString(),
-            MODS_DIR.toString(),
-            mid,
-            archiveClass, loaderName, "true"); // last 3 args passed to test
-        if (isAppLoader) {
-            try {
-                output.shouldContain(expectedException);
-            } catch (Exception e) {
-                TestCommon.checkCommonExecExceptions(output, e);
-            }
-        } else {
-            TestCommon.checkExec(output);
-        }
+        TestCommon.runWithModules(prefix,
+                                  UPGRADEDMODS_DIR[upgradeModIdx].toString(),
+                                  MODS_DIR.toString(),
+                                  mid,
+                                  archiveClass, loaderName, "true") // last 3 args passed to test
+            .ifNoMappingFailure(out -> out.shouldContain(expectedException));
 
         // Now run this same test again, but this time without AppCDS. Behavior should be the same.
         CDSOptions opts = (new CDSOptions())
@@ -203,26 +184,21 @@
 
         output = CDSTestUtils.runWithArchive(opts);
 
-        if (isAppLoader) {
-            try {
-                output.shouldContain(expectedException);
-            } catch (Exception e) {
-                TestCommon.checkCommonExecExceptions(output, e);
-            }
-        } else {
-            if (!CDSTestUtils.isUnableToMap(output))
-                output.shouldHaveExitValue(0);
+        try {
+            output.shouldContain(expectedException);
+        } catch (Exception e) {
+            TestCommon.checkCommonExecExceptions(output, e);
         }
 
         // Run the test with -p set to alternate location of archiveClass.
         // The alternate version of archiveClass SHOULD NOT be found.
-        output = TestCommon.execModule(
+        TestCommon.runWithModules(
             prefix,
             null,
             UPGRADEDMODS_DIR[upgradeModIdx].toString() + java.io.File.pathSeparator + MODS_DIR.toString(),
             mid,
-            archiveClass, loaderName, "false"); // last 3 args passed to test
-        TestCommon.checkExec(output);
+            archiveClass, loaderName, "false") // last 3 args passed to test
+            .assertNormalExit();
 
         // Now  run this same test again, but this time without AppCDS. Behavior should be the same.
         opts = (new CDSOptions())
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/java.activation/javax/activation/UnsupportedDataTypeException.java	Thu Apr 26 10:29:44 2018 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package javax.activation;
-
-import java.io.IOException;
-
-public class UnsupportedDataTypeException extends IOException {
-    public UnsupportedDataTypeException() {
-    }
-
-    public String toString() {
-        return "hi";
-    }
-}
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/java.activation/module-info.java	Thu Apr 26 10:29:44 2018 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-module java.activation {
-    exports javax.activation;
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/java.net.http/java/net/http/HttpTimeoutException.java	Wed Apr 25 14:08:19 2018 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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.net.http;
+
+public class HttpTimeoutException {
+    public String toString() {
+        return "hi";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/java.net.http/module-info.java	Wed Apr 25 14:08:19 2018 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+module java.net.http {
+    exports java.net.http;
+}
+
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/test/jdk/test/Main.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/test/jdk/test/Main.java	Wed Apr 25 14:08:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,11 +73,15 @@
         Class<?> clazz = Class.forName(className, true, loader);
         // Make sure we got the expected defining ClassLoader
         testLoader(clazz, loader);
-        // Create an instance and see what toString() returns
-        String s = clazz.newInstance().toString();
+
+        String s = null;
+        if (shouldOverride) {
+          // Create an instance and see what toString() returns
+          clazz.newInstance().toString();
+        }
         // The overridden version of the class should return "hi". Make sure
         // it does only if we are expecting to have loaded the overridden version.
-        assertTrue(s.equals("hi") == shouldOverride);
+        assertTrue("hi".equals(s) == shouldOverride);
     }
 
     /**
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/test/module-info.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/src/test/module-info.java	Wed Apr 25 14:08:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * 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,5 +24,5 @@
 
 module test {
     requires jdk.compiler;
-    requires java.activation;
+    requires java.compiler;
 }
--- a/test/hotspot/jtreg/runtime/appcds/test-classes/HelloExt.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/hotspot/jtreg/runtime/appcds/test-classes/HelloExt.java	Wed Apr 25 14:08:19 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 public class HelloExt {
    public static void main(String[] args) throws Throwable {
 
-       String className = "org.omg.CORBA.ORB";
+       String className = "javax.annotation.processing.FilerException";
        Class cls = Class.forName(className);
 
        ClassLoader loader = cls.getClassLoader();
--- a/test/hotspot/jtreg/runtime/appcds/test-classes/javax/activation/MimeType.jasm	Thu Apr 26 10:29:44 2018 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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.
- *
- */
-
-package javax/activation;
-
-public class MimeType
-    version 51:0
-{
-
-public Method thisClassIsDummy:"()V"
-    stack 0 locals 0
-{
-    return;
-}
-
-} // end class MimeType
--- a/test/lib/jdk/test/lib/cds/CDSTestUtils.java	Thu Apr 26 10:29:44 2018 +0800
+++ b/test/lib/jdk/test/lib/cds/CDSTestUtils.java	Wed Apr 25 14:08:19 2018 -0700
@@ -366,6 +366,10 @@
         return new Result(opts, runWithArchive(opts));
     }
 
+    public static Result run(CDSOptions opts) throws Exception {
+        return new Result(opts, runWithArchive(opts));
+    }
+
     // Execute JVM with CDS archive, specify command line args suffix
     public static OutputAnalyzer runWithArchive(String... cliPrefix)
         throws Exception {