--- old/test/hotspot/jtreg/runtime/cds/appcds/RewriteBytecodesTest.java 2019-08-09 19:42:59.843545529 -0700 +++ new/test/hotspot/jtreg/runtime/cds/appcds/RewriteBytecodesTest.java 2019-08-09 19:42:59.288525389 -0700 @@ -24,7 +24,7 @@ /* * @test - * @summary Use ClassLoader.defineClass() to load a class with rewritten bytecode. Make sure + * @summary Use Lookup.defineClass() to load a class with rewritten bytecode. Make sure * the archived class with the same name is not loaded. * @requires vm.cds * @library /test/lib @@ -54,7 +54,6 @@ OutputAnalyzer output = TestCommon.exec(appJar, // command-line arguments ... - "--add-opens=java.base/java.lang=ALL-UNNAMED", use_whitebox_jar, "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", --- old/test/hotspot/jtreg/runtime/cds/appcds/customLoader/LoaderSegregationTest.java 2019-08-09 19:43:01.054589473 -0700 +++ new/test/hotspot/jtreg/runtime/cds/appcds/customLoader/LoaderSegregationTest.java 2019-08-09 19:43:00.502569442 -0700 @@ -39,6 +39,7 @@ * test-classes/OnlyBuiltin.java * test-classes/OnlyUnregistered.java * ../test-classes/Util.java + * ../test-classes/Hello.java * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * @run driver LoaderSegregationTest @@ -74,7 +75,7 @@ String customJarPath = JarBuilder.build("LoaderSegregation_custom", "CustomLoadee", "CustomLoadee2", "CustomInterface2_ia", "CustomInterface2_ib", "CustomLoadee3", "CustomLoadee3Child", - "OnlyBuiltin", "OnlyUnregistered"); + "OnlyBuiltin", "OnlyUnregistered", "Hello"); // Dump the archive String classlist[] = new String[] { @@ -112,8 +113,6 @@ output = TestCommon.exec(TestCommon.concatPaths(appJar, app2Jar), // command-line arguments ... - "--add-opens=java.base/java.lang=ALL-UNNAMED", - "--add-opens=java.base/java.security=ALL-UNNAMED", use_whitebox_jar, "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", --- old/test/hotspot/jtreg/runtime/cds/appcds/customLoader/test-classes/LoaderSegregation.java 2019-08-09 19:43:02.283634071 -0700 +++ new/test/hotspot/jtreg/runtime/cds/appcds/customLoader/test-classes/LoaderSegregation.java 2019-08-09 19:43:01.736614221 -0700 @@ -82,7 +82,8 @@ { // UNREGISTERED LOADER URLClassLoader urlClassLoader = new URLClassLoader(urls); - Class c2 = Util.defineClassFromJAR(urlClassLoader, jarFile, ONLY_BUILTIN); + Class> peerClass = Class.forName("Hello", false, urlClassLoader); + Class c2 = Util.defineClassFromJAR(peerClass, jarFile, ONLY_BUILTIN); if (c2.getClassLoader() != urlClassLoader) { throw new RuntimeException("Error in test"); --- old/test/hotspot/jtreg/runtime/cds/appcds/test-classes/RewriteBytecodes.java 2019-08-09 19:43:03.507678487 -0700 +++ new/test/hotspot/jtreg/runtime/cds/appcds/test-classes/RewriteBytecodes.java 2019-08-09 19:43:02.965658819 -0700 @@ -30,7 +30,7 @@ String from = "___xxx___"; String to = "___yyy___"; File clsFile = new File(args[0]); - Class superClass = Util.defineModifiedClass(RewriteBytecodes.class.getClassLoader(), clsFile, from, to); + Class superClass = Util.defineModifiedClass(RewriteBytecodes.class, clsFile, from, to); Child child = new Child(); --- old/test/hotspot/jtreg/runtime/cds/appcds/test-classes/Util.java 2019-08-09 19:43:05.010733027 -0700 +++ new/test/hotspot/jtreg/runtime/cds/appcds/test-classes/Util.java 2019-08-09 19:43:04.455712887 -0700 @@ -23,19 +23,21 @@ */ import java.io.*; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodHandles.Lookup; import java.lang.reflect.*; import java.util.jar.*; public class Util { /** - * Invoke the loader.defineClass() class method to define the class stored in clsFile, + * Define the class as stored in clsFile, in the same loader as peerClass, * with the following modification: *