test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
open Cdiff test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java
test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java
Print this page
*** 39,65 ****
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));
}
}
--- 39,67 ----
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));
}
}
test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File