From d0de0254e1ebcb50f2abf5c73d69a61e82013fee Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Mon, 20 May 2019 16:41:08 +0200 Subject: [PATCH] Java: Check compilation unit of the same element in both disjuncts. --- java/ql/src/semmle/code/java/Annotation.qll | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/java/ql/src/semmle/code/java/Annotation.qll b/java/ql/src/semmle/code/java/Annotation.qll index 64a597e1e55..b05635826d9 100755 --- a/java/ql/src/semmle/code/java/Annotation.qll +++ b/java/ql/src/semmle/code/java/Annotation.qll @@ -25,11 +25,11 @@ class Annotation extends @annotation, Expr { /** Gets the element being annotated. */ Element getAnnotatedElement() { - this.getParent().(Field).getDeclaration().getAField() = result and - this.getCompilationUnit().fromSource() - or - not result.(Field).getCompilationUnit().fromSource() and - this.getParent() = result + exists(Element e | e = this.getParent() | + if e.(Field).getCompilationUnit().fromSource() + then result = e.(Field).getDeclaration().getAField() + else result = e + ) } /** Gets the annotation type declaration for this annotation. */