Apply review suggestions

This commit is contained in:
Tony Torralba
2022-10-03 10:38:35 +02:00
parent 2036453176
commit f860ae8c82
2 changed files with 10 additions and 5 deletions

View File

@@ -36,7 +36,12 @@ abstract private class GeneratedType extends ClassOrInterface {
}
private string stubAnnotations() {
result = concat(stubAnnotation(this.(AnnotationType).getAnAnnotation()) + "\n")
result =
concat(Annotation an |
this.(AnnotationType).getAnAnnotation() = an
|
stubAnnotation(an), "\n" order by an.getType().getQualifiedName()
)
}
/** Gets the entire Java stub code for this type. */
@@ -110,8 +115,8 @@ abstract private class GeneratedType extends ClassOrInterface {
result = this.getAGeneratedMember().(Field).getType() or
result = this.getAGeneratedMember().(NestedType) or
result = this.(AnnotationType).getAnAnnotation().getType() or
result = this.(AnnotationType).getAnAnnotation().getAValue().getType() or
result = this.(AnnotationType).getAnAnnotation().getAValue().(ArrayInit).getAnInit().getType()
result = this.(AnnotationType).getAnAnnotation().getValue(_).getType() or
result = this.(AnnotationType).getAnAnnotation().getAnArrayValue(_).getType()
}
}
@@ -400,7 +405,7 @@ private string stubMember(Member m) {
language[monotonicAggregates]
private string stubAnnotation(Annotation a) {
if exists(a.getAValue())
if exists(a.getValue(_))
then
result =
"@" + a.getType().getName() + "(" +

View File

@@ -1,5 +1,5 @@
noGeneratedStubs
multipleGeneratedStubs
#select
| org.test.SampleAnnotationType | // Generated automatically from org.test.SampleAnnotationType for testing purposes\n\npackage org.test;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Target;\n\n@Target(value={ElementType.METHOD})\npublic @interface SampleAnnotationType\n{\n}\n |
| org.test.SampleAnnotationType | // Generated automatically from org.test.SampleAnnotationType for testing purposes\n\npackage org.test;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Target;\n\n@Target(value={java.lang.annotation.ElementType.METHOD})public @interface SampleAnnotationType\n{\n}\n |
| org.test.SampleType | // Generated automatically from org.test.SampleType for testing purposes\n\npackage org.test;\n\n\npublic class SampleType\n{\n public Object sampleField = null;\n public SampleType(){}\n public void sampleMethod(){}\n}\n |