mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Fix stub generator
Add line break after all stubbed annotations to avoid malformed code See https://github.com/github/codeql/pull/8695\#discussion_r985674245
This commit is contained in:
@@ -36,12 +36,15 @@ abstract private class GeneratedType extends ClassOrInterface {
|
||||
}
|
||||
|
||||
private string stubAnnotations() {
|
||||
result =
|
||||
concat(Annotation an |
|
||||
this.(AnnotationType).getAnAnnotation() = an
|
||||
|
|
||||
stubAnnotation(an), "\n" order by an.getType().getQualifiedName()
|
||||
)
|
||||
if exists(this.(AnnotationType).getAnAnnotation())
|
||||
then
|
||||
result =
|
||||
concat(Annotation an |
|
||||
this.(AnnotationType).getAnAnnotation() = an
|
||||
|
|
||||
stubAnnotation(an), "\n" order by an.getType().getQualifiedName()
|
||||
) + "\n"
|
||||
else result = ""
|
||||
}
|
||||
|
||||
/** Gets the entire Java stub code for this type. */
|
||||
|
||||
@@ -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={java.lang.annotation.ElementType.METHOD})public @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})\npublic @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 |
|
||||
|
||||
Reference in New Issue
Block a user