Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d0de025

Browse files
committed
Java: Check compilation unit of the same element in both disjuncts.
1 parent 9ebeac2 commit d0de025

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

java/ql/src/semmle/code/java/Annotation.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class Annotation extends @annotation, Expr {
2525

2626
/** Gets the element being annotated. */
2727
Element getAnnotatedElement() {
28-
this.getParent().(Field).getDeclaration().getAField() = result and
29-
this.getCompilationUnit().fromSource()
30-
or
31-
not result.(Field).getCompilationUnit().fromSource() and
32-
this.getParent() = result
28+
exists(Element e | e = this.getParent() |
29+
if e.(Field).getCompilationUnit().fromSource()
30+
then result = e.(Field).getDeclaration().getAField()
31+
else result = e
32+
)
3333
}
3434

3535
/** Gets the annotation type declaration for this annotation. */

0 commit comments

Comments
 (0)