Skip to content

Commit d7aede0

Browse files
committed
Add a test with a polymorphic class value in a Java annotation.
1 parent 8a73d28 commit d7aede0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tasty-query/shared/src/test/scala/tastyquery/TypeSuite.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,6 +2640,14 @@ class TypeSuite extends UnrestrictedUnpicklingSuite {
26402640
ok
26412641
}
26422642

2643+
val otherAnnotatedMethod = JavaAnnotationsClass.findNonOverloadedDecl(termName("otherAnnotatedMethod"))
2644+
2645+
checkAnnotArgs(otherAnnotatedMethod, JavaAnnotClassValueClass) {
2646+
case List(Literal(const)) if const.tag == Constants.ClazzTag =>
2647+
// Note that `isRef` only accepts a `TypeRef` of the given symbol; not an `AppliedType`
2648+
assert(clue(const.typeValue).isRef(ctx.findTopLevelClass("java.util.List")))
2649+
}
2650+
26432651
val annotatedParams = JavaAnnotationsClass.findNonOverloadedDecl(termName("annotatedParams"))
26442652
val List(Right(_), Left(paramSyms)) = annotatedParams.paramSymss: @unchecked
26452653

test-sources/src/main/scala/javadefined/JavaAnnotations.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ public int annotatedMethod() {
2424
return 1;
2525
}
2626

27+
@JavaAnnotClassValue(java.util.List.class)
28+
public int otherAnnotatedMethod() {
29+
return 1;
30+
}
31+
2732
public <T> int annotatedParams(
2833
int noAnnot,
2934
@JavaAnnotSingleValue(123)

0 commit comments

Comments
 (0)