@@ -36,7 +36,7 @@ abstract private class GeneratedType extends ClassOrInterface {
36
36
}
37
37
38
38
private string stubAnnotations ( ) {
39
- result = concat ( "@" + stubAnnotation ( this .( AnnotationType ) .getAnAnnotation ( ) ) + "\n" )
39
+ result = concat ( stubAnnotation ( this .( AnnotationType ) .getAnAnnotation ( ) ) + "\n" )
40
40
}
41
41
42
42
/** Gets the entire Java stub code for this type. */
@@ -398,20 +398,22 @@ private string stubMember(Member m) {
398
398
)
399
399
}
400
400
401
+ language [ monotonicAggregates]
401
402
private string stubAnnotation ( Annotation a ) {
402
403
if exists ( a .getAValue ( ) )
403
404
then
404
405
result =
405
- a .getType ( ) .getName ( ) + "(" +
406
+ "@" + a .getType ( ) .getName ( ) + "(" +
406
407
concat ( string name , Expr value |
407
408
value = a .getValue ( name )
408
409
|
409
410
name + "=" + stubAnnotationValue ( value ) , ","
410
411
) + ")"
411
- else result = a .getType ( ) .getName ( )
412
+ else result = "@" + a .getType ( ) .getName ( )
412
413
}
413
414
414
- private string stubAnnotationSimpleValue ( Expr value ) {
415
+ language [ monotonicAggregates]
416
+ private string stubAnnotationValue ( Expr value ) {
415
417
result = value .( FieldAccess ) .getField ( ) .getQualifiedName ( )
416
418
or
417
419
(
@@ -422,15 +424,9 @@ private string stubAnnotationSimpleValue(Expr value) {
422
424
then result = "\"\""
423
425
else result = stubDefaultValue ( value .getType ( ) )
424
426
or
425
- // We can't use stubAnnotation here because it causes a non-monotonic recursion.
426
- // Handling the most basic case of a nested annotation for now.
427
- result = "@" + value .( Annotation ) .getType ( ) .getName ( )
427
+ result = stubAnnotation ( value )
428
428
or
429
429
result = value .( TypeLiteral ) .getReferencedType ( ) .getName ( ) + ".class"
430
- }
431
-
432
- private string stubAnnotationValue ( Expr value ) {
433
- result = stubAnnotationSimpleValue ( value )
434
430
or
435
431
value instanceof ArrayInit and
436
432
result =
@@ -439,7 +435,7 @@ private string stubAnnotationValue(Expr value) {
439
435
i >= 0 and
440
436
arrayElement = value .( ArrayInit ) .getInit ( i )
441
437
|
442
- stubAnnotationSimpleValue ( arrayElement ) , "," order by i
438
+ stubAnnotationValue ( arrayElement ) , "," order by i
443
439
) + "}"
444
440
}
445
441
0 commit comments