Java: Check compilation unit of the same element in both disjuncts.

This commit is contained in:
Anders Schack-Mulligen
2019-05-20 16:41:08 +02:00
parent 9ebeac25ad
commit d0de0254e1

View File

@@ -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. */