@@ -22,6 +22,7 @@ class AnnotationTests extends JavaSrcCode2CpgFixture {
22
22
annotationNode.code shouldBe " @NormalAnnotation(value = \" classAnnotation\" )"
23
23
annotationNode.name shouldBe " NormalAnnotation"
24
24
annotationNode.fullName shouldBe " some.NormalAnnotation"
25
+ annotationNode.lineNumber shouldBe Some (5 )
25
26
}
26
27
27
28
" test annotation node parameter assignment child" in {
@@ -61,6 +62,7 @@ class AnnotationTests extends JavaSrcCode2CpgFixture {
61
62
annotationNode.code shouldBe " @SingleAnnotation(\" classAnnotation\" )"
62
63
annotationNode.name shouldBe " SingleAnnotation"
63
64
annotationNode.fullName shouldBe " some.SingleAnnotation"
65
+ annotationNode.lineNumber shouldBe Some (5 )
64
66
}
65
67
66
68
" test annotation node parameter assignment child" in {
@@ -99,6 +101,7 @@ class AnnotationTests extends JavaSrcCode2CpgFixture {
99
101
annotationNode.code shouldBe " @MarkerAnnotation()"
100
102
annotationNode.name shouldBe " MarkerAnnotation"
101
103
annotationNode.fullName shouldBe " some.MarkerAnnotation"
104
+ annotationNode.lineNumber shouldBe Some (5 )
102
105
}
103
106
104
107
" test annotation node parameter assignment child" in {
@@ -119,11 +122,11 @@ class AnnotationTests extends JavaSrcCode2CpgFixture {
119
122
|""" .stripMargin)
120
123
121
124
" test annotation node properties" in {
122
- import scala .jdk .CollectionConverters ._
123
125
val annotationNode = cpg.method.nameExact(io.joern.x2cpg.Defines .ConstructorMethodName ).annotation.head
124
126
annotationNode.code shouldBe " @MarkerAnnotation()"
125
127
annotationNode.name shouldBe " MarkerAnnotation"
126
128
annotationNode.fullName shouldBe " some.MarkerAnnotation"
129
+ annotationNode.lineNumber shouldBe Some (5 )
127
130
}
128
131
129
132
" test annotation node parameter assignment child" in {
@@ -146,6 +149,7 @@ class AnnotationTests extends JavaSrcCode2CpgFixture {
146
149
annotationNode.code shouldBe " @MarkerAnnotation"
147
150
annotationNode.name shouldBe " MarkerAnnotation"
148
151
annotationNode.fullName shouldBe " some.MarkerAnnotation"
152
+ annotationNode.lineNumber shouldBe Some (5 )
149
153
}
150
154
}
151
155
@@ -162,6 +166,7 @@ class AnnotationTests extends JavaSrcCode2CpgFixture {
162
166
annotationNode.code shouldBe " @MarkerAnnotation"
163
167
annotationNode.name shouldBe " MarkerAnnotation"
164
168
annotationNode.fullName shouldBe " some.MarkerAnnotation"
169
+ annotationNode.lineNumber shouldBe Some (4 )
165
170
}
166
171
}
167
172
@@ -181,6 +186,7 @@ class AnnotationTests extends JavaSrcCode2CpgFixture {
181
186
annotationNode.code shouldBe " @NormalAnnotation(value = 2)"
182
187
annotationNode.name shouldBe " NormalAnnotation"
183
188
annotationNode.fullName shouldBe " some.NormalAnnotation"
189
+ annotationNode.lineNumber shouldBe Some (5 )
184
190
}
185
191
186
192
" test annotation node parameter value" in {
@@ -207,6 +213,7 @@ class AnnotationTests extends JavaSrcCode2CpgFixture {
207
213
annotationNode.code shouldBe " @NormalAnnotation(value = { \" aaa\" , \" bbb\" })"
208
214
annotationNode.name shouldBe " NormalAnnotation"
209
215
annotationNode.fullName shouldBe " some.NormalAnnotation"
216
+ annotationNode.lineNumber shouldBe Some (5 )
210
217
}
211
218
212
219
" test annotation node parameter assignment child" in {
@@ -255,6 +262,7 @@ class AnnotationTests extends JavaSrcCode2CpgFixture {
255
262
annotationNode.code shouldBe " @NormalAnnotation(value = @OtherAnnotation)"
256
263
annotationNode.name shouldBe " NormalAnnotation"
257
264
annotationNode.fullName shouldBe " some.NormalAnnotation"
265
+ annotationNode.lineNumber shouldBe Some (6 )
258
266
}
259
267
260
268
" test annotation node parameter value" in {
@@ -286,10 +294,12 @@ class AnnotationTests extends JavaSrcCode2CpgFixture {
286
294
wildcard1.name shouldBe " Wildcard1"
287
295
wildcard1.fullName shouldBe " b.Wildcard1"
288
296
wildcard1.code shouldBe " @Wildcard1"
297
+ wildcard1.lineNumber shouldBe Some (6 )
289
298
290
299
wildcard2.name shouldBe " Wildcard2"
291
300
wildcard2.fullName shouldBe " b.Wildcard2"
292
301
wildcard2.code shouldBe " @Wildcard2"
302
+ wildcard2.lineNumber shouldBe Some (7 )
293
303
294
304
case result => fail(s " Expected 3 annotations for Foo but got $result" )
295
305
}
0 commit comments