Skip to content

Commit

Permalink
Improve test coverage for class loading elements with annotations of …
Browse files Browse the repository at this point in the history
…different retentions

openjdk#2955
  • Loading branch information
cushon committed Nov 11, 2024
1 parent a968404 commit d160b2a
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -407,6 +409,12 @@ R scan(Iterable<? extends TypeMirror> 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
Expand Down Expand Up @@ -529,6 +537,10 @@ public class Inner6<T extends Object & Cloneable & @TA(17) Serializable> {}
@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")
Expand Down

0 comments on commit d160b2a

Please sign in to comment.