From 6592b5ab268f77f8482cc0e0d5f9a80de1b154b5 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Tue, 8 Oct 2024 10:48:56 -0700 Subject: [PATCH] 8336942: Improve test coverage for class loading elements with annotations of different retentions Reviewed-by: vromero --- .../javac/processing/model/type/BasicAnnoTests.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java b/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java index 85a6f6af9d8..d4540107022 100644 --- a/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java +++ b/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java @@ -40,6 +40,8 @@ import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.ArrayList; @@ -405,6 +407,12 @@ R scan(Iterable iter, P p) { int value(); } + @Target(ElementType.TYPE_USE) + @Retention(RetentionPolicy.RUNTIME) + public @interface TD { + int value(); + } + // Test cases // TODO: add more cases for arrays @@ -527,6 +535,10 @@ public class Inner6 {} @Test(posn=1, annoType=TA.class, expect="23") public Set<@TA(23) ? super Object> f9; + @Test(posn=0, annoType=TA.class, expect="1") + @Test(posn=0, annoType=TD.class, expect="2") + public @TA(1) @TD(2) int f10; + // Test type use annotations on uses of type variables @Test(posn=5, annoType = TA.class, expect = "25") @Test(posn=5, annoType = TB.class, expect = "26")