@@ -44,8 +44,10 @@ public static void main(String[] args) throws Exception {
44
44
45
45
static void test () throws Exception {
46
46
String topArchiveName = getNewArchiveName ();
47
- String appJar = ClassFileInstaller .getJarPath ("ArrayKlasses.jar" );
48
- String mainClass = "ArrayKlassesApp" ;
47
+ final String appJar = ClassFileInstaller .getJarPath ("ArrayKlasses.jar" );
48
+ final String mainClass = "ArrayKlassesApp" ;
49
+ final String runtimeLogOptions =
50
+ "-Xlog:class+load,class+load+array=debug,cds+dynamic=debug,cds=debug,cds+unshareable=trace" ;
49
51
50
52
// Case 1
51
53
// Create a dynamic archive with the ArrayKlassesApp app class and its
@@ -62,14 +64,17 @@ static void test() throws Exception {
62
64
// Case 1
63
65
// At runtime , the ArrayKlasesApp and its array class should be loaded
64
66
// from the dynamic archive.
65
- run2 (null , topArchiveName ,
66
- "-Xlog:class+load,class+load+array=debug,cds+dynamic=debug,cds=debug" ,
67
+ run2 (null , topArchiveName , runtimeLogOptions ,
67
68
"-cp" , appJar , mainClass )
68
69
.assertNormalExit (output -> {
69
70
output .shouldContain ("ArrayKlassesApp source: shared objects file (top)" )
71
+ .shouldContain ("restore: ArrayKlassesApp with class loader: jdk.internal.loader.ClassLoaders$AppClassLoader" )
70
72
.shouldContain ("[LArrayKlassesApp; source: shared objects file (top)" )
73
+ .shouldContain ("restore: [LArrayKlassesApp; with class loader: jdk.internal.loader.ClassLoaders$AppClassLoader" )
71
74
.shouldContain ("[[LArrayKlassesApp; source: shared objects file (top)" )
75
+ .shouldContain ("restore: [[LArrayKlassesApp; with class loader: jdk.internal.loader.ClassLoaders$AppClassLoader" )
72
76
.shouldContain ("[[[LArrayKlassesApp; source: shared objects file (top)" )
77
+ .shouldContain ("restore: [[[LArrayKlassesApp; with class loader: jdk.internal.loader.ClassLoaders$AppClassLoader" )
73
78
.shouldHaveExitValue (0 );
74
79
});
75
80
@@ -90,14 +95,17 @@ static void test() throws Exception {
90
95
// Case 2
91
96
// At runtime, the java/util/Date class should be loaded from the default
92
97
// CDS archive; its array class should be loaded from the dynamic archive.
93
- run2 (null , topArchiveName ,
94
- "-Xlog:class+load,class+load+array=debug,cds+dynamic=debug,cds=debug" ,
98
+ run2 (null , topArchiveName , runtimeLogOptions ,
95
99
"-cp" , appJar , mainClass , "system" )
96
100
.assertNormalExit (output -> {
97
101
output .shouldContain ("java.util.Date source: shared objects file" )
102
+ .shouldContain ("restore: java.util.Date with class loader: boot" )
98
103
.shouldContain ("[Ljava.util.Date; source: shared objects file (top)" )
104
+ .shouldContain ("restore: [Ljava.util.Date; with class loader: boot" )
99
105
.shouldContain ("[[Ljava.util.Date; source: shared objects file (top)" )
106
+ .shouldContain ("restore: [[Ljava.util.Date; with class loader: boot" )
100
107
.shouldContain ("[[[Ljava.util.Date; source: shared objects file (top)" )
108
+ .shouldContain ("restore: [[[Ljava.util.Date; with class loader: boot" )
101
109
.shouldHaveExitValue (0 );
102
110
});
103
111
@@ -116,13 +124,15 @@ static void test() throws Exception {
116
124
// Case 3
117
125
// At runtime, the [J should be loaded from the default CDS archive;
118
126
// the higher-dimension array should be loaded from the dynamic archive.
119
- run2 (null , topArchiveName ,
120
- "-Xlog:class+load,class+load+array=debug,cds+dynamic=debug,cds=debug" ,
127
+ run2 (null , topArchiveName , runtimeLogOptions ,
121
128
"-cp" , appJar , mainClass , "primitive" )
122
129
.assertNormalExit (output -> {
123
130
output .shouldContain ("[J source: shared objects file" )
131
+ .shouldContain ("restore: [J with class loader: boot" )
124
132
.shouldContain ("[[J source: shared objects file (top)" )
133
+ .shouldContain ("restore: [[J with class loader: boot" )
125
134
.shouldContain ("[[[J source: shared objects file (top)" )
135
+ .shouldContain ("restore: [[[J with class loader: boot" )
126
136
.shouldHaveExitValue (0 );
127
137
});
128
138
@@ -142,13 +152,18 @@ static void test() throws Exception {
142
152
// Case 4
143
153
// At runtime, the 4-dimension array of java/lang/Integer should be
144
154
// loaded from the dynamic archive.
145
- run2 (null , topArchiveName ,
146
- "-Xlog:class+load,class+load+array=debug,cds+dynamic=debug,cds=debug" ,
155
+ run2 (null , topArchiveName , runtimeLogOptions ,
147
156
"-cp" , appJar , mainClass , "integer-array" )
148
157
.assertNormalExit (output -> {
149
- output .shouldContain ("[[Ljava.lang.Integer; source: shared objects file (top)" )
158
+ output .shouldContain ("java.lang.Integer source: shared objects file" )
159
+ .shouldContain ("restore: java.lang.Integer with class loader: boot" )
160
+ .shouldContain ("restore: [Ljava.lang.Integer; with class loader: boot" )
161
+ .shouldContain ("[[Ljava.lang.Integer; source: shared objects file (top)" )
162
+ .shouldContain ("restore: [[Ljava.lang.Integer; with class loader: boot" )
150
163
.shouldContain ("[[[Ljava.lang.Integer; source: shared objects file (top)" )
164
+ .shouldContain ("restore: [[[Ljava.lang.Integer; with class loader: boot" )
151
165
.shouldContain ("[[[[Ljava.lang.Integer; source: shared objects file (top)" )
166
+ .shouldContain ("restore: [[[[Ljava.lang.Integer; with class loader: boot" )
152
167
.shouldHaveExitValue (0 );
153
168
});
154
169
}
0 commit comments