|
41 | 41 | import java.lang.annotation.Annotation; |
42 | 42 | import java.lang.annotation.ElementType; |
43 | 43 | import java.lang.annotation.Repeatable; |
| 44 | +import java.lang.annotation.Retention; |
| 45 | +import java.lang.annotation.RetentionPolicy; |
44 | 46 | import java.lang.annotation.Target; |
45 | 47 | import java.lang.reflect.Method; |
46 | 48 | import java.util.ArrayList; |
@@ -93,13 +95,15 @@ public class BasicAnnoTests extends JavacTestingAbstractProcessor { |
93 | 95 | private static final Map<String, Class<? extends Annotation>> nameToAnnotation = |
94 | 96 | Map.ofEntries(new NameToAnnotationEntry("java.lang.Override", Override.class), |
95 | 97 | new NameToAnnotationEntry("java.lang.annotation.Repeatable", Repeatable.class), |
| 98 | + new NameToAnnotationEntry("java.lang.annotation.Retention", Target.class), |
96 | 99 | new NameToAnnotationEntry("java.lang.annotation.Target", Target.class), |
97 | 100 | new NameToAnnotationEntry("BasicAnnoTests.Test", BasicAnnoTests.Test.class), |
98 | 101 | new NameToAnnotationEntry("BasicAnnoTests.Tests",BasicAnnoTests.Tests.class), |
99 | 102 | new NameToAnnotationEntry("BasicAnnoTests.TA", BasicAnnoTests.TA.class), |
100 | 103 | new NameToAnnotationEntry("BasicAnnoTests.TB", BasicAnnoTests.TB.class), |
101 | 104 | new NameToAnnotationEntry("BasicAnnoTests.TC", BasicAnnoTests.TC.class), |
102 | | - new NameToAnnotationEntry("BasicAnnoTests.TCs", BasicAnnoTests.TCs.class)); |
| 105 | + new NameToAnnotationEntry("BasicAnnoTests.TCs", BasicAnnoTests.TCs.class), |
| 106 | + new NameToAnnotationEntry("BasicAnnoTests.TD", BasicAnnoTests.TD.class)); |
103 | 107 |
|
104 | 108 | static class NameToAnnotationEntry extends AbstractMap.SimpleEntry<String, Class<? extends Annotation>> { |
105 | 109 | public NameToAnnotationEntry(String key, Class<? extends Annotation> entry) { |
@@ -520,6 +524,12 @@ R scan(Iterable<? extends TypeMirror> iter, P p) { |
520 | 524 | TC[] value(); |
521 | 525 | } |
522 | 526 |
|
| 527 | + @Target(ElementType.TYPE_USE) |
| 528 | + @Retention(RetentionPolicy.RUNTIME) |
| 529 | + public @interface TD { |
| 530 | + int value(); |
| 531 | + } |
| 532 | + |
523 | 533 | // Test cases |
524 | 534 |
|
525 | 535 | // TODO: add more cases for arrays |
@@ -657,6 +667,10 @@ public class Inner6<T extends Object & Cloneable & @TA(17) Serializable> {} |
657 | 667 | @Test(posn=1, annoType=TA.class, expect="23") |
658 | 668 | public Set<@TA(23) ? super Object> f9; |
659 | 669 |
|
| 670 | + @Test(posn=0, annoType=TA.class, expect="1") |
| 671 | + @Test(posn=0, annoType=TD.class, expect="2") |
| 672 | + public @TA(1) @TD(2) int f10; |
| 673 | + |
660 | 674 | // Test type use annotations on uses of type variables |
661 | 675 | @Test(posn=6, annoType = TA.class, expect = "25") |
662 | 676 | @Test(posn=6, annoType = TB.class, expect = "26") |
|
0 commit comments