mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8153268: javac accepts enums being referenced by 'uses' statement
Reviewed-by: jjg
This commit is contained in:
parent
8c11293294
commit
9f41228dab
4 changed files with 33 additions and 1 deletions
|
@ -81,6 +81,29 @@ public class UsesTest extends ModuleTestBase {
|
|||
.writeAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnumAsAService(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
tb.writeJavaFiles(src,
|
||||
"module m { uses pkg.EnumST; }",
|
||||
"package pkg; public enum EnumST {A, B}");
|
||||
Path classes = base.resolve("classes");
|
||||
Files.createDirectories(classes);
|
||||
|
||||
List<String> output = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics")
|
||||
.outdir(classes)
|
||||
.files(tb.findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
List<String> expected = Arrays.asList("module-info.java:1:20: compiler.err.service.definition.is.enum: pkg.EnumST",
|
||||
"1 error");
|
||||
if (!output.containsAll(expected)) {
|
||||
throw new Exception("Expected output not found");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleAnnotation(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue