160 new TestCase(base)
161 .testOpts("--module-path", modules.toString())
162 .otherOpts("--module-source-path", src.toString())
163 .files(findJavaFiles(src))
164 .run();
165 }
166
167 /**
168 * Tests that a module being compiled can see classes patches into an existing module
169 * with --patch-module
170 */
171 @Test
172 public void testPatchModule(Path base) throws Exception {
173 Path patchSrc = base.resolve("patchSrc");
174 tb.writeJavaFiles(patchSrc,
175 "package java.util; public class Xyzzy { }");
176 Path patch = base.resolve("patch");
177 Files.createDirectories(patch);
178
179 new JavacTask(tb)
180 .options("-Xmodule:java.base")
181 .outdir(patch)
182 .sourcepath(patchSrc)
183 .files(findJavaFiles(patchSrc))
184 .run()
185 .writeAll();
186
187 Path src = base.resolve("src");
188 tb.writeJavaFiles(src,
189 "public class C { java.util.Xyzzy x; }");
190
191 new TestCase(base)
192 .testOpts("--patch-module", "java.base=" + patch)
193 .files(findJavaFiles(src))
194 .run();
195 }
196
197 /**
198 * Tests that options in @files are also effective.
199 * The test is similar to testModulePath, except that the test options are provided in an @-file.
200 */
|
160 new TestCase(base)
161 .testOpts("--module-path", modules.toString())
162 .otherOpts("--module-source-path", src.toString())
163 .files(findJavaFiles(src))
164 .run();
165 }
166
167 /**
168 * Tests that a module being compiled can see classes patches into an existing module
169 * with --patch-module
170 */
171 @Test
172 public void testPatchModule(Path base) throws Exception {
173 Path patchSrc = base.resolve("patchSrc");
174 tb.writeJavaFiles(patchSrc,
175 "package java.util; public class Xyzzy { }");
176 Path patch = base.resolve("patch");
177 Files.createDirectories(patch);
178
179 new JavacTask(tb)
180 .options("--patch-module", "java.base=" + patchSrc.toString())
181 .outdir(patch)
182 .sourcepath(patchSrc)
183 .files(findJavaFiles(patchSrc))
184 .run()
185 .writeAll();
186
187 Path src = base.resolve("src");
188 tb.writeJavaFiles(src,
189 "public class C { java.util.Xyzzy x; }");
190
191 new TestCase(base)
192 .testOpts("--patch-module", "java.base=" + patch)
193 .files(findJavaFiles(src))
194 .run();
195 }
196
197 /**
198 * Tests that options in @files are also effective.
199 * The test is similar to testModulePath, except that the test options are provided in an @-file.
200 */
|