Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8fe2bcc + 3e5bbd9 commit 64aa111Copy full SHA for 64aa111
1 file changed
java/ql/src/semmle/code/java/Annotation.qll
@@ -25,11 +25,15 @@ class Annotation extends @annotation, Expr {
25
26
/** Gets the element being annotated. */
27
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
+ exists(Element e | e = this.getParent() |
+ if e.(Field).getCompilationUnit().fromSource()
+ then
+ exists(FieldDeclaration decl |
+ decl.getField(0) = e and
33
+ result = decl.getAField()
34
+ )
35
+ else result = e
36
37
}
38
39
/** Gets the annotation type declaration for this annotation. */
0 commit comments