Skip to content

Commit 73df316

Browse files
committed
Test varargs annotation
1 parent 6d5f962 commit 73df316

File tree

2 files changed

+57
-7
lines changed

2 files changed

+57
-7
lines changed

java/ql/integration-tests/all-platforms/kotlin/annotation-id-consistency/PrintAst.expected

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,50 @@ test.kt:
6969
# 9| 3: [TypeAccess] Class<T>[]
7070
# 9| 0: [TypeAccess] Class<T>
7171
# 9| 0: [TypeAccess] T
72-
# 11| 6: [Class] Annotated
72+
# 11| 6: [Interface] VarargAnnotation
7373
#-----| -3: (Annotations)
74-
# 11| 1: [Annotation] Ann1
74+
# 0| 1: [Annotation] Repeatable
75+
# 0| 1: [TypeLiteral] Container.class
76+
# 0| 0: [TypeAccess] Container
77+
# 0| 2: [Annotation] Retention
78+
# 0| 1: [VarAccess] RetentionPolicy.RUNTIME
79+
# 0| -1: [TypeAccess] RetentionPolicy
80+
# 11| 3: [Annotation] Repeatable
81+
# 0| 1: [Interface] Container
82+
#-----| -3: (Annotations)
83+
# 0| 1: [Annotation] RepeatableContainer
84+
# 0| 2: [Annotation] Retention
85+
# 0| 1: [VarAccess] RetentionPolicy.RUNTIME
86+
# 0| -1: [TypeAccess] RetentionPolicy
87+
# 0| 1: [Method] value
88+
# 0| 3: [TypeAccess] VarargAnnotation[]
89+
# 0| 0: [TypeAccess] VarargAnnotation
90+
# 12| 2: [Method] x
91+
# 12| 3: [TypeAccess] int[]
92+
# 14| 7: [Class] Annotated
93+
#-----| -3: (Annotations)
94+
# 0| 1: [Annotation] Container
95+
# 0| 1: [ArrayInit] {...}
96+
# 16| 1: [Annotation] VarargAnnotation
97+
# 0| 1: [ArrayInit] {...}
98+
# 17| 2: [Annotation] VarargAnnotation
99+
# 0| 1: [ArrayInit] {...}
100+
# 0| 1: [IntegerLiteral] 1
101+
# 18| 3: [Annotation] VarargAnnotation
102+
# 0| 1: [ArrayInit] {...}
103+
# 0| 1: [IntegerLiteral] 1
104+
# 0| 1: [IntegerLiteral] 2
105+
# 19| 4: [Annotation] VarargAnnotation
106+
# 0| 1: [ArrayInit] {...}
107+
# 0| 1: [IntegerLiteral] 1
108+
# 0| 1: [IntegerLiteral] 2
109+
# 0| 1: [IntegerLiteral] 3
110+
# 20| 5: [Annotation] VarargAnnotation
111+
# 0| 1: [ArrayInit] {...}
112+
# 0| 1: [IntegerLiteral] 1
113+
# 0| 1: [IntegerLiteral] 2
114+
# 0| 1: [IntegerLiteral] 3
115+
# 14| 2: [Annotation] Ann1
75116
# 0| 1: [IntegerLiteral] 1
76117
# 0| 1: [Annotation] Ann2
77118
# 0| 1: [StringLiteral] "Hello"
@@ -91,11 +132,11 @@ test.kt:
91132
# 0| 0: [TypeAccess] String
92133
# 0| 1: [TypeLiteral] int.class
93134
# 0| 0: [TypeAccess] int
94-
# 12| 2: [Annotation] GenericAnnotation<>
95-
# 13| 1: [Constructor] Annotated
96-
# 11| 5: [BlockStmt] { ... }
97-
# 11| 0: [SuperConstructorInvocationStmt] super(...)
98-
# 13| 1: [BlockStmt] { ... }
135+
# 15| 3: [Annotation] GenericAnnotation<>
136+
# 21| 1: [Constructor] Annotated
137+
# 14| 5: [BlockStmt] { ... }
138+
# 14| 0: [SuperConstructorInvocationStmt] super(...)
139+
# 21| 1: [BlockStmt] { ... }
99140
# 0| [TypeLiteral] String.class
100141
# 0| 0: [TypeAccess] String
101142
# 0| [ArrayInit] {...}

java/ql/integration-tests/all-platforms/kotlin/annotation-id-consistency/test.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ annotation class Ann3(val a: Int) { }
88

99
annotation class GenericAnnotation<T : Any>(val x: KClass<T>, val y: Array<KClass<T>>) { }
1010

11+
@Repeatable
12+
annotation class VarargAnnotation(vararg val x: Int) { }
13+
1114
@Ann1(1, Ann2("Hello", String::class, intArrayOf(1, 2, 3), arrayOf(Ann3(1), Ann3(2)), arrayOf(String::class, Int::class)))
1215
@GenericAnnotation<String>(String::class, arrayOf(String::class, String::class))
16+
@VarargAnnotation
17+
@VarargAnnotation(1)
18+
@VarargAnnotation(1, 2)
19+
@VarargAnnotation(*[1, 2, 3])
20+
@VarargAnnotation(*intArrayOf(1, 2, 3))
1321
class Annotated { }
22+

0 commit comments

Comments
 (0)