Skip to content

Commit 6f1124d

Browse files
committed
Handle more annotation element value types
1 parent 1ece12e commit 6f1124d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

java/ql/src/utils/stub-generator/Stubs.qll

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,20 @@ private string stubAnnotation(Annotation a) {
412412
}
413413

414414
private string stubAnnotationSimpleValue(Expr value) {
415-
result = value.(FieldAccess).getField().getQualifiedName() or
416-
result = value.(Literal).toString()
415+
result = value.(FieldAccess).getField().getQualifiedName()
416+
or
417+
result = value.(Literal).getLiteral()
418+
or
419+
not value instanceof Literal and
420+
(
421+
result = value.(CompileTimeConstantExpr).getStringValue() or
422+
result = value.(CompileTimeConstantExpr).getBooleanValue().toString() or
423+
result = value.(CompileTimeConstantExpr).getIntValue().toString()
424+
)
425+
or
426+
result = value.(Annotation).getType().getName()
427+
or
428+
result = value.(TypeLiteral).getReferencedType().getName() + ".class"
417429
}
418430

419431
private string stubAnnotationValue(Expr value) {

0 commit comments

Comments
 (0)