69 } |
69 } |
70 |
70 |
71 @Test |
71 @Test |
72 public void testAddExportUndefinedModule(Path base) throws Exception { |
72 public void testAddExportUndefinedModule(Path base) throws Exception { |
73 Path src = base.resolve("src"); |
73 Path src = base.resolve("src"); |
74 tb.writeJavaFiles(src, "package test; import undef.Any; public class Test {}"); |
74 tb.writeJavaFiles(src, "package test; import undefPackage.Any; public class Test {}"); |
75 Path classes = base.resolve("classes"); |
75 Path classes = base.resolve("classes"); |
76 tb.createDirectories(classes); |
76 tb.createDirectories(classes); |
77 |
77 |
78 List<String> log = new JavacTask(tb) |
78 List<String> log = new JavacTask(tb) |
79 .options("--add-exports", "undef/undef=ALL-UNNAMED", "-XDrawDiagnostics") |
79 .options("--add-exports", "undefModule/undefPackage=ALL-UNNAMED", |
|
80 "-XDrawDiagnostics") |
80 .outdir(classes) |
81 .outdir(classes) |
81 .files(findJavaFiles(src)) |
82 .files(findJavaFiles(src)) |
82 .run(Task.Expect.FAIL) |
83 .run(Task.Expect.FAIL) |
83 .writeAll() |
84 .writeAll() |
84 .getOutputLines(Task.OutputKind.DIRECT); |
85 .getOutputLines(Task.OutputKind.DIRECT); |
85 |
86 |
86 List<String> expected = Arrays.asList("- compiler.err.cant.find.module: undef", |
87 List<String> expected = Arrays.asList("- compiler.warn.module.for.option.not.found: --add-exports, undefModule", |
87 "Test.java:1:27: compiler.err.doesnt.exist: undef", |
88 "Test.java:1:34: compiler.err.doesnt.exist: undefPackage", |
88 "2 errors"); |
89 "1 error", "1 warning"); |
89 |
90 |
90 if (!expected.equals(log)) |
91 if (!expected.equals(log)) |
91 throw new Exception("expected output not found: " + log); |
92 throw new Exception("expected output not found: " + log); |
92 } |
93 } |
93 |
94 |