Skip to content

Commit f860ae8

Browse files
committed
Apply review suggestions
1 parent 2036453 commit f860ae8

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ abstract private class GeneratedType extends ClassOrInterface {
3636
}
3737

3838
private string stubAnnotations() {
39-
result = concat(stubAnnotation(this.(AnnotationType).getAnAnnotation()) + "\n")
39+
result =
40+
concat(Annotation an |
41+
this.(AnnotationType).getAnAnnotation() = an
42+
|
43+
stubAnnotation(an), "\n" order by an.getType().getQualifiedName()
44+
)
4045
}
4146

4247
/** Gets the entire Java stub code for this type. */
@@ -110,8 +115,8 @@ abstract private class GeneratedType extends ClassOrInterface {
110115
result = this.getAGeneratedMember().(Field).getType() or
111116
result = this.getAGeneratedMember().(NestedType) or
112117
result = this.(AnnotationType).getAnAnnotation().getType() or
113-
result = this.(AnnotationType).getAnAnnotation().getAValue().getType() or
114-
result = this.(AnnotationType).getAnAnnotation().getAValue().(ArrayInit).getAnInit().getType()
118+
result = this.(AnnotationType).getAnAnnotation().getValue(_).getType() or
119+
result = this.(AnnotationType).getAnAnnotation().getAnArrayValue(_).getType()
115120
}
116121
}
117122

@@ -400,7 +405,7 @@ private string stubMember(Member m) {
400405

401406
language[monotonicAggregates]
402407
private string stubAnnotation(Annotation a) {
403-
if exists(a.getAValue())
408+
if exists(a.getValue(_))
404409
then
405410
result =
406411
"@" + a.getType().getName() + "(" +
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
noGeneratedStubs
22
multipleGeneratedStubs
33
#select
4-
| 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 |
4+
| 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 |
55
| 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 |

0 commit comments

Comments
 (0)