github / github/codeql

Java: Add Import.getATypeImport

Aperta
#4,119 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Java question
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

When working with Javadoc it is often necessary to find out to which type a Javadoc tag refers to. Imports are one way to find this out, however the QL `Import` class does not define a common predicate to get an imported type despite all import types being able to import types in some way.
It would therefore be useful to add a predicate `Import.getATypeImport()` which would behave like this:
- `ImportType`: `getImportedType()`
- `ImportStaticTypeMember`: `getATypeImport()`
- `ImportOnDemandFromPackage`: `getAnImport()`
- `ImportOnDemandFromType`: `getAnImport()`
- `ImportStaticOnDemand`: `getATypeImport()`

Edit: As described by #10498 instead of adding this predicate, it might make more sense to have a predicate for `CompilationUnit` which obtains a type which is available by its simple same in that compilation unit.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.