github / github/codeql

Java: Add Import.getATypeImport

Offen
#4,119 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Java question
Vorherrschende Sprache
CodeQL
Sterne
10.1k
Forks
2.1k
Ø Merge
2 T. 15 Std.
Gemergte PRs (30 T.)
141

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.