From d160b2a18c24095d07a86d39a92764bc23d6b3a2 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 11 Nov 2024 10:38:27 -0800 Subject: [PATCH] Improve test coverage for class loading elements with annotations of different retentions https://github.com/openjdk/jdk17u-dev/pull/2955 --- .../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 00911eb7e14..858b166ba5f 100644 --- a/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java +++ b/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java @@ -41,6 +41,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; @@ -407,6 +409,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 @@ -529,6 +537,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")