--- a/test/hotspot/jtreg/runtime/appcds/javaldr/AnonVmClassesDuringDump.java Fri Nov 16 23:39:51 2018 +0100
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/AnonVmClassesDuringDump.java Fri Nov 16 16:10:25 2018 -0800
@@ -47,6 +47,8 @@
"AnonVmClassesDuringDumpTransformer",
};
+ public static String cdsDiagnosticOption = "-XX:+AllowArchivingWithJavaAgent";
+
public static void main(String[] args) throws Throwable {
String agentJar =
ClassFileInstaller.writeJar("AnonVmClassesDuringDumpTransformer.jar",
@@ -58,6 +60,7 @@
TestCommon.testDump(appJar, TestCommon.list("Hello"),
"-javaagent:" + agentJar,
+ "-XX:+UnlockDiagnosticVMOptions", cdsDiagnosticOption,
// Set the following property to see logs for dynamically generated classes
// in STDOUT
"-Djava.lang.invoke.MethodHandle.DUMP_CLASS_FILES=true");
@@ -70,11 +73,13 @@
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")
+ TestCommon.run("-cp", appJar,
+ "-XX:+UnlockDiagnosticVMOptions", cdsDiagnosticOption, "Hello")
.assertNormalExit(output -> output.shouldNotMatch(pattern));
// inspect the archive and make sure no anonymous class is in there
TestCommon.run("-cp", appJar,
+ "-XX:+UnlockDiagnosticVMOptions", cdsDiagnosticOption,
"-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary", "Hello")
.assertNormalExit(output -> output.shouldNotMatch(class_pattern));
}