Java: Some generic classes have two `StaticInitializer`
- Lingua principale
- CodeQL
- Stelle
- 10.1k
- Fork
- 2.1k
- Merge medio
- 2g 15h
- PR unite (30g)
- 141
Descrizione
### Version
CodeQL CLI 2.5.1
### Description
It appears that in some situations generic classes have two `StaticInitializer` elements, a regular one with source information initializing static fields and another one where `StaticInitializer.getBody()` has no result and which has no source location.
I was not able to pinpoint what exactly is causing it. Trying to create a database using `javac` for a single source file does not seem to trigger it.
### Example
CodeQL query:
```ql
import java
from ClassOrInterface c, StaticInitializer s
where
c.fromSource()
and s = c.getAMethod()
and count(c.getAMethod().(StaticInitializer)) > 1
select c, s
```
[Query Console link](https://lgtm.com/query/2605405991256877475/)
This can also be reproduced locally by using autobuilder to build the Gson project (at least Gson commit `1215841e46f1e90d964d335acbc0d8c9aad43590`).
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.