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

Skip to content

Commit 3e5bbd9

Browse files
committed
Java: Account for non-source annotation on second field in multi-field declarations.
1 parent d0de025 commit 3e5bbd9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ class Annotation extends @annotation, Expr {
2727
Element getAnnotatedElement() {
2828
exists(Element e | e = this.getParent() |
2929
if e.(Field).getCompilationUnit().fromSource()
30-
then result = e.(Field).getDeclaration().getAField()
30+
then
31+
exists(FieldDeclaration decl |
32+
decl.getField(0) = e and
33+
result = decl.getAField()
34+
)
3135
else result = e
3236
)
3337
}

0 commit comments

Comments
 (0)