Java: Improve AnnotationPresentCheck.ql

This commit is contained in:
Marcono1234
2021-10-11 01:03:46 +02:00
parent 9c9c5c09ff
commit a74d423d82

View File

@@ -19,9 +19,8 @@ where
m.getNumberOfParameters() = 1 and
c.getArgument(0).getType() = p and
p.getATypeArgument() = t and
not exists(Annotation a |
not exists(RetentionAnnotation a |
t.getAnAnnotation() = a and
a.getType().hasQualifiedName("java.lang.annotation", "Retention") and
a.getAValue().(VarAccess).getVariable().hasName("RUNTIME")
)
select c, "Call to isAnnotationPresent where no annotation has the RUNTIME retention policy."