Skip to content

Commit 80968ee

Browse files
committed
Add test for annotations with annotation-array-typed fields
1 parent bc93a22 commit 80968ee

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Test {
2+
3+
@interface CustomAnnotation {
4+
String value();
5+
}
6+
7+
@interface ArrayValues {
8+
CustomAnnotation[] annotationValues();
9+
}
10+
11+
@ArrayValues(annotationValues = @CustomAnnotation(value = "only")) private int fieldWithSingular;
12+
@ArrayValues(annotationValues = {@CustomAnnotation(value = "val1"), @CustomAnnotation(value = "val2")}) private int fieldWithMultiple;
13+
14+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| Test.java:11:82:11:98 | fieldWithSingular | Test.java:11:3:11:68 | ArrayValues | Test.java:11:35:11:67 | {...} | Test.java:11:35:11:67 | CustomAnnotation |
2+
| Test.java:12:119:12:135 | fieldWithMultiple | Test.java:12:3:12:105 | ArrayValues | Test.java:12:35:12:104 | {...} | Test.java:12:36:12:68 | CustomAnnotation |
3+
| Test.java:12:119:12:135 | fieldWithMultiple | Test.java:12:3:12:105 | ArrayValues | Test.java:12:35:12:104 | {...} | Test.java:12:71:12:103 | CustomAnnotation |
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import java
2+
3+
from Field f, Annotation ann, Expr value, Expr valueChild
4+
where
5+
f.getDeclaringType().fromSource() and
6+
ann = f.getAnAnnotation() and
7+
value = ann.getAValue() and
8+
valueChild.getParent() = value
9+
select f, ann, value, valueChild

0 commit comments

Comments
 (0)