github / github/codeql

Java: Some generic classes have two `StaticInitializer`

Đang mở
#5,730 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

### 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`).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.