File tree Expand file tree Collapse file tree
java/ql/lib/semmle/code/java Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -217,13 +217,15 @@ class Annotatable extends Element {
217217 )
218218 }
219219
220- private Annotation getAnAssociatedAnnotation ( AnnotationType t ) {
221- result .getType ( ) = t and
220+ private Annotation getADeclaredAssociatedAnnotation ( AnnotationType t ) {
222221 // Direct or indirect annotation
223- if getADeclaredAnnotation ( ) .getType ( ) = t or getAnIndirectAnnotation ( ) .getType ( ) = t
224- then (
225- result = getADeclaredAnnotation ( ) or result = getAnIndirectAnnotation ( )
226- ) else (
222+ result .getType ( ) = t and result = [ getADeclaredAnnotation ( ) , getAnIndirectAnnotation ( ) ]
223+ }
224+
225+ private Annotation getAnAssociatedAnnotation ( AnnotationType t ) {
226+ if exists ( getADeclaredAssociatedAnnotation ( t ) )
227+ then result = getADeclaredAssociatedAnnotation ( t )
228+ else (
227229 // Only if neither a direct nor an indirect annotation is present look for an inherited one
228230 t .isInherited ( ) and
229231 // @Inherited only works for classes; cast to Annotatable is necessary because predicate is private
You can’t perform that action at this time.
0 commit comments