Java: Some generic classes have two `StaticInitializer`
- Dominant language
- CodeQL
- Stars
- 10.1k
- Forks
- 2.1k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 141
Description
### 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`).
Contributor guide
Assessment
This issue has not been assessed yet.