81 |
81 |
82 ClassFileInstaller.writeClassToDisk("p1/c1", |
82 ClassFileInstaller.writeClassToDisk("p1/c1", |
83 InMemoryJavaCompiler.compile("p1.c1", source1), System.getProperty("test.classes")); |
83 InMemoryJavaCompiler.compile("p1.c1", source1), System.getProperty("test.classes")); |
84 |
84 |
85 // Test #2: Load two modules defined to the same customer class loader. |
85 // Test #2: Load two modules defined to the same customer class loader. |
86 // m1's module readability list and package p2's exportability should |
86 // m1x's module readability list and package p2's exportability should |
87 // not be walked at a GC safepoint since both modules are defined to |
87 // not be walked at a GC safepoint since both modules are defined to |
88 // the same loader and thus have the exact same life cycle. |
88 // the same loader and thus have the exact same life cycle. |
89 pb = ProcessTools.createJavaProcessBuilder( |
89 pb = ProcessTools.createJavaProcessBuilder( |
90 "-Xbootclasspath/a:.", |
90 "-Xbootclasspath/a:.", |
91 "-Xlog:modules=trace", |
91 "-Xlog:modules=trace", |
95 oa.shouldNotContain("must be walked") |
95 oa.shouldNotContain("must be walked") |
96 .shouldNotContain("being walked") |
96 .shouldNotContain("being walked") |
97 .shouldHaveExitValue(0); |
97 .shouldHaveExitValue(0); |
98 |
98 |
99 // Test #3: Load two modules in differing custom class loaders. |
99 // Test #3: Load two modules in differing custom class loaders. |
100 // m1's module readability list and package p2's exportability list must |
100 // m1x's module readability list and package p2's exportability list must |
101 // be walked at a GC safepoint since both modules are defined to non-builtin |
101 // be walked at a GC safepoint since both modules are defined to non-builtin |
102 // class loaders which could die and thus be unloaded. |
102 // class loaders which could die and thus be unloaded. |
103 pb = ProcessTools.createJavaProcessBuilder( |
103 pb = ProcessTools.createJavaProcessBuilder( |
104 "-Xbootclasspath/a:.", |
104 "-Xbootclasspath/a:.", |
105 "-Xlog:modules=trace", |
105 "-Xlog:modules=trace", |
106 "ModuleNonBuiltinCLMain"); |
106 "ModuleNonBuiltinCLMain"); |
107 |
107 |
108 oa = new OutputAnalyzer(pb.start()); |
108 oa = new OutputAnalyzer(pb.start()); |
109 oa.shouldContain("module m1 reads list must be walked") |
109 oa.shouldContain("module m1x reads list must be walked") |
110 .shouldContain("package p2 defined in module m2, exports list must be walked") |
110 .shouldContain("package p2 defined in module m2x, exports list must be walked") |
111 .shouldNotContain("module m2 reads list must be walked") |
111 .shouldNotContain("module m2x reads list must be walked") |
112 .shouldHaveExitValue(0); |
112 .shouldHaveExitValue(0); |
113 |
113 |
114 // Test #4: Load two modules in differing custom class loaders, |
114 // Test #4: Load two modules in differing custom class loaders, |
115 // of which one has been designated as the custom system class loader |
115 // of which one has been designated as the custom system class loader |
116 // via -Djava.system.class.loader=CustomSystemClassLoader. Since |
116 // via -Djava.system.class.loader=CustomSystemClassLoader. Since |
117 // m3 is defined to the system class loader, m2's module readability |
117 // m3x is defined to the system class loader, m2x's module readability |
118 // list does not have to be walked at a GC safepoint, but package p2's |
118 // list does not have to be walked at a GC safepoint, but package p2's |
119 // exportability list does. |
119 // exportability list does. |
120 pb = ProcessTools.createJavaProcessBuilder( |
120 pb = ProcessTools.createJavaProcessBuilder( |
121 "-Djava.system.class.loader=CustomSystemClassLoader", |
121 "-Djava.system.class.loader=CustomSystemClassLoader", |
122 "-Xbootclasspath/a:.", |
122 "-Xbootclasspath/a:.", |
123 "-Xlog:modules=trace", |
123 "-Xlog:modules=trace", |
124 "ModuleNonBuiltinCLMain"); |
124 "ModuleNonBuiltinCLMain"); |
125 |
125 |
126 oa = new OutputAnalyzer(pb.start()); |
126 oa = new OutputAnalyzer(pb.start()); |
127 oa.shouldContain("package p2 defined in module m2, exports list must be walked") |
127 oa.shouldContain("package p2 defined in module m2x, exports list must be walked") |
128 .shouldNotContain("module m2 reads list must be walked") |
128 .shouldNotContain("module m2x reads list must be walked") |
129 .shouldHaveExitValue(0); |
129 .shouldHaveExitValue(0); |
130 |
130 |
131 } |
131 } |
132 } |
132 } |