80 .run(Task.Expect.SUCCESS) |
80 .run(Task.Expect.SUCCESS) |
81 .writeAll(); |
81 .writeAll(); |
82 } |
82 } |
83 |
83 |
84 @Test |
84 @Test |
|
85 public void testEnumAsAService(Path base) throws Exception { |
|
86 Path src = base.resolve("src"); |
|
87 tb.writeJavaFiles(src, |
|
88 "module m { uses pkg.EnumST; }", |
|
89 "package pkg; public enum EnumST {A, B}"); |
|
90 Path classes = base.resolve("classes"); |
|
91 Files.createDirectories(classes); |
|
92 |
|
93 List<String> output = new JavacTask(tb) |
|
94 .options("-XDrawDiagnostics") |
|
95 .outdir(classes) |
|
96 .files(tb.findJavaFiles(src)) |
|
97 .run(Task.Expect.FAIL) |
|
98 .writeAll() |
|
99 .getOutputLines(Task.OutputKind.DIRECT); |
|
100 List<String> expected = Arrays.asList("module-info.java:1:20: compiler.err.service.definition.is.enum: pkg.EnumST", |
|
101 "1 error"); |
|
102 if (!output.containsAll(expected)) { |
|
103 throw new Exception("Expected output not found"); |
|
104 } |
|
105 } |
|
106 |
|
107 @Test |
85 public void testSimpleAnnotation(Path base) throws Exception { |
108 public void testSimpleAnnotation(Path base) throws Exception { |
86 Path src = base.resolve("src"); |
109 Path src = base.resolve("src"); |
87 tb.writeJavaFiles(src, |
110 tb.writeJavaFiles(src, |
88 "module m { uses p.C; }", |
111 "module m { uses p.C; }", |
89 "package p; public @interface C { }"); |
112 "package p; public @interface C { }"); |