301 throw new Exception("expected output not found"); |
301 throw new Exception("expected output not found"); |
302 } |
302 } |
303 |
303 |
304 @Test |
304 @Test |
305 public void relativePath(Path base) throws Exception { |
305 public void relativePath(Path base) throws Exception { |
306 final Path modules = base.resolve("modules"); |
306 Path modules = base.resolve("modules"); |
307 new ModuleBuilder(tb, "m1").build(modules); |
307 new ModuleBuilder(tb, "m1").build(modules); |
308 |
308 |
309 Path src = base.resolve("src"); |
309 Path src = base.resolve("src"); |
310 tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); |
310 tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); |
311 |
311 |
317 .writeAll(); |
317 .writeAll(); |
318 } |
318 } |
319 |
319 |
320 @Test |
320 @Test |
321 public void duplicatePaths_1(Path base) throws Exception { |
321 public void duplicatePaths_1(Path base) throws Exception { |
322 final Path modules = base.resolve("modules"); |
322 Path modules = base.resolve("modules"); |
323 new ModuleBuilder(tb, "m1").build(modules); |
323 new ModuleBuilder(tb, "m1").build(modules); |
324 |
324 |
325 Path src = base.resolve("src"); |
325 Path src = base.resolve("src"); |
326 tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); |
326 tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); |
327 |
327 |
333 .writeAll(); |
333 .writeAll(); |
334 } |
334 } |
335 |
335 |
336 @Test |
336 @Test |
337 public void duplicatePaths_2(Path base) throws Exception { |
337 public void duplicatePaths_2(Path base) throws Exception { |
338 final Path modules = base.resolve("modules"); |
338 Path modules = base.resolve("modules"); |
339 new ModuleBuilder(tb, "m1").build(modules); |
339 new ModuleBuilder(tb, "m1").build(modules); |
340 |
340 |
341 Path src = base.resolve("src"); |
341 Path src = base.resolve("src"); |
342 tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); |
342 tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); |
343 |
343 |
350 .writeAll(); |
350 .writeAll(); |
351 } |
351 } |
352 |
352 |
353 @Test |
353 @Test |
354 public void oneModuleHidesAnother(Path base) throws Exception { |
354 public void oneModuleHidesAnother(Path base) throws Exception { |
355 final Path module = base.resolve("modules"); |
355 Path modules = base.resolve("modules"); |
356 new ModuleBuilder(tb, "m1") |
356 new ModuleBuilder(tb, "m1") |
357 .exports("pkg1") |
357 .exports("pkg1") |
358 .classes("package pkg1; public class E { }") |
358 .classes("package pkg1; public class E { }") |
359 .build(module); |
359 .build(modules); |
360 |
360 |
361 final Path deepModuleDir = module.resolve("deepModuleDir"); |
361 Path deepModuleDirSrc = base.resolve("deepModuleDirSrc"); |
|
362 Path deepModuleDir = modules.resolve("deepModuleDir"); |
362 new ModuleBuilder(tb, "m1") |
363 new ModuleBuilder(tb, "m1") |
363 .exports("pkg2") |
364 .exports("pkg2") |
364 .classes("package pkg2; public class E { }") |
365 .classes("package pkg2; public class E { }") |
365 .build(deepModuleDir); |
366 .build(deepModuleDirSrc, deepModuleDir); |
366 |
367 |
367 Path src = base.resolve("src"); |
368 Path src = base.resolve("src"); |
368 tb.writeJavaFiles(src, "module m2 { requires m1; }", " package p; class A { void main() { pkg2.E.class.getName(); } }"); |
369 tb.writeJavaFiles(src, "module m2 { requires m1; }", " package p; class A { void main() { pkg2.E.class.getName(); } }"); |
369 |
370 |
370 new JavacTask(tb, Task.Mode.CMDLINE) |
371 new JavacTask(tb, Task.Mode.CMDLINE) |
371 .options("-XDrawDiagnostics", |
372 .options("-XDrawDiagnostics", |
372 "-modulepath", deepModuleDir + PATH_SEP + module) |
373 "-modulepath", deepModuleDir + PATH_SEP + modules) |
373 .files(findJavaFiles(src)) |
374 .files(findJavaFiles(src)) |
374 .run() |
375 .run() |
375 .writeAll(); |
376 .writeAll(); |
376 } |
377 } |
377 |
378 |
378 @Test |
379 @Test |
379 public void modulesInDifferentContainers(Path base) throws Exception { |
380 public void modulesInDifferentContainers(Path base) throws Exception { |
380 final Path modules = base.resolve("modules"); |
381 Path modules = base.resolve("modules"); |
381 new ModuleBuilder(tb, "m1") |
382 new ModuleBuilder(tb, "m1") |
382 .exports("one") |
383 .exports("one") |
383 .classes("package one; public class A { }") |
384 .classes("package one; public class A { }") |
384 .build(modules); |
385 .build(modules); |
385 |
386 |