mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8172158: Annotation processor not run with -source <= 8
Avoiding use of module prefix to map annotations to processors when running without modules. Reviewed-by: darcy, jjg
This commit is contained in:
parent
61175156de
commit
4ec30a933a
2 changed files with 44 additions and 10 deletions
|
@ -23,7 +23,7 @@
|
|||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8133884 8162711 8133896
|
||||
* @bug 8133884 8162711 8133896 8172158
|
||||
* @summary Verify that annotation processing works.
|
||||
* @library /tools/lib
|
||||
* @modules
|
||||
|
@ -979,6 +979,38 @@ public class AnnotationProcessing extends ModuleTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisambiguateAnnotationsNoModules(Path base) throws Exception {
|
||||
Path classes = base.resolve("classes");
|
||||
|
||||
Files.createDirectories(classes);
|
||||
|
||||
Path src = base.resolve("src");
|
||||
|
||||
tb.writeJavaFiles(src,
|
||||
"package api; public @interface A {}",
|
||||
"package api; public @interface B {}",
|
||||
"package impl; import api.*; @A @B public class T {}");
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("-processor", SelectAnnotationATestAP.class.getName() + "," + SelectAnnotationBTestAP.class.getName(),
|
||||
"-source", "8", "-target", "8")
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run()
|
||||
.writeAll()
|
||||
.getOutputLines(OutputKind.STDERR);
|
||||
|
||||
List<String> expected = Arrays.asList("SelectAnnotationATestAP",
|
||||
"SelectAnnotationBTestAP",
|
||||
"SelectAnnotationATestAP",
|
||||
"SelectAnnotationBTestAP");
|
||||
|
||||
if (!expected.equals(log)) {
|
||||
throw new AssertionError("Output does not match; output: " + log);
|
||||
}
|
||||
}
|
||||
|
||||
@SupportedAnnotationTypes("m2x/api.A")
|
||||
public static final class SelectAnnotationATestAP extends AbstractProcessor {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue