Java: Javadoc.getCommentedElement / Documentable.getJavadoc does not work for annotated elements
- Lingua principale
- CodeQL
- Stelle
- 10.1k
- Fork
- 2.1k
- Merge medio
- 2g 15h
- PR unite (30g)
- 141
Descrizione
**Description of the issue**
It appears `Javadoc.getCommentedElement()` respectively `Documentable.getJavadoc()`, to which it delegates, does not work for annotated elements.
Example query for demo projects on https://lgtm.com/query/lang:java/:
```ql
import java
from Javadoc javadoc, int javadocEnd, Documentable documentable, int documentableStart
where
not exists (javadoc.getCommentedElement())
and not isNormalComment(javadoc)
and javadocEnd = javadoc.getLocation().getEndLine()
and documentable.getCompilationUnit() = javadoc.getFile()
and documentableStart = documentable.getLocation().getStartLine()
and documentableStart < javadocEnd + 3
and documentableStart > javadocEnd
select javadoc, documentable
```
Also note that there appears to be something weird going on, because when trying to exclude annotated elements from that query, it still finds them:
```
and not exists (documentable.(Annotatable).getAnAnnotation())
```
Though on the other hand checking `not exists (annotation.getAnnotatedElement())` does not find anything.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.