Skip to content

Commit 8a3ed6b

Browse files
committed
Apply code review suggestions
1 parent 6f7b7c9 commit 8a3ed6b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -414,16 +414,15 @@ private string stubAnnotation(Annotation a) {
414414
private string stubAnnotationSimpleValue(Expr value) {
415415
result = value.(FieldAccess).getField().getQualifiedName()
416416
or
417-
result = value.(Literal).getLiteral()
418-
or
419-
not value instanceof Literal and
420417
(
421-
result = value.(CompileTimeConstantExpr).getStringValue() or
422-
result = value.(CompileTimeConstantExpr).getBooleanValue().toString() or
423-
result = value.(CompileTimeConstantExpr).getIntValue().toString()
424-
)
418+
value instanceof Literal or
419+
value instanceof CompileTimeConstantExpr
420+
) and
421+
result = stubDefaultValue(value.getType())
425422
or
426-
result = value.(Annotation).getType().getName()
423+
// We can't use stubAnnotation here because it causes a non-monotonic recursion.
424+
// Handling the most basic case of a nested annotation for now.
425+
result = "@" + value.(Annotation).getType().getName()
427426
or
428427
result = value.(TypeLiteral).getReferencedType().getName() + ".class"
429428
}
@@ -435,6 +434,7 @@ private string stubAnnotationValue(Expr value) {
435434
result =
436435
"{" +
437436
concat(int i, Expr arrayElement |
437+
i >= 0 and
438438
arrayElement = value.(ArrayInit).getInit(i)
439439
|
440440
stubAnnotationSimpleValue(arrayElement), "," order by i

0 commit comments

Comments
 (0)