--- old/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java 2018-04-24 16:22:11.443974354 -0700 +++ new/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java 2018-04-24 16:22:11.131944903 -0700 @@ -27,7 +27,8 @@ * @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 --- old/test/hotspot/jtreg/runtime/appcds/javaldr/AnonVmClassesDuringDump.java 2018-04-24 16:22:12.190044771 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/javaldr/AnonVmClassesDuringDump.java 2018-04-24 16:22:11.881015604 -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)); } } --- old/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java 2018-04-24 16:22:12.874109336 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java 2018-04-24 16:22:12.575081112 -0700 @@ -27,8 +27,9 @@ * @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/MyMain.jasm --- old/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java 2018-04-24 16:22:13.632180886 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java 2018-04-24 16:22:13.327152096 -0700 @@ -27,7 +27,8 @@ * @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 jdk.jartool/sun.tools.jar + * @modules java.compiler + * jdk.jartool/sun.tools.jar * @compile ../../test-classes/DummyClassHelper.java * @compile ../../test-classes/java/net/HttpCookie.jasm * @compile ../../../SharedArchiveFile/javax/annotation/processing/FilerException.jasm --- old/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java 2018-04-24 16:22:14.355249131 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java 2018-04-24 16:22:14.052220531 -0700 @@ -110,8 +110,7 @@ ); Asserts.assertTrue(compiled, TEST_MODULE + " did not compile"); - // dump the archive with jdk.comiler and jdk.incubator.httpclient classes in the class list - // with "--add-modules jdk.incubator.httpclient" + // 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. @@ -168,19 +167,12 @@ // Run the test with --upgrade-module-path set to alternate location of archiveClass // The alternate version of archiveClass SHOULD be found. - CDSTestUtils.Result res = TestCommon.runWithModules( - prefix, - UPGRADEDMODS_DIR[upgradeModIdx].toString(), - MODS_DIR.toString(), - mid, - archiveClass, loaderName, "true"); // last 3 args passed to test - - output = res.getOutput(); - try { - output.shouldContain(expectedException); - } catch (Exception e) { - TestCommon.checkCommonExecExceptions(output, e); - } + 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()) @@ -200,13 +192,13 @@ // Run the test with -p set to alternate location of archiveClass. // The alternate version of archiveClass SHOULD NOT be found. - res = TestCommon.runWithModules( + 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(res.getOutput()); + 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()) --- old/test/lib/jdk/test/lib/cds/CDSTestUtils.java 2018-04-24 16:22:15.120321342 -0700 +++ new/test/lib/jdk/test/lib/cds/CDSTestUtils.java 2018-04-24 16:22:14.791290287 -0700 @@ -211,10 +211,6 @@ return this; } - - public OutputAnalyzer getOutput() { - return output; - } } // Specify this property to copy sdandard output of the child test process to --- old/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java 2018-04-24 16:22:15.876392703 -0700 +++ /dev/null 2018-02-08 21:21:41.723217456 -0800 @@ -1,67 +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", - "javax/annotation/processing/FilerException"), // from java.compiler module - "-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", "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", "Hello") - .assertNormalExit(output -> output.shouldNotMatch(class_pattern)); - } -}