Java: Account for non-source annotation on second field in multi-field declarations.

This commit is contained in:
Anders Schack-Mulligen
2019-05-22 11:33:10 +02:00
parent d0de0254e1
commit 3e5bbd96b1

View File

@@ -27,7 +27,11 @@ class Annotation extends @annotation, Expr {
Element getAnnotatedElement() {
exists(Element e | e = this.getParent() |
if e.(Field).getCompilationUnit().fromSource()
then result = e.(Field).getDeclaration().getAField()
then
exists(FieldDeclaration decl |
decl.getField(0) = e and
result = decl.getAField()
)
else result = e
)
}