github / github/codeql

Java: Same type specified multiple times in `throws` clause is modeled as single CodeQL `Exception` with multiple locations

Đang mở
#7,309 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Java 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ả

### Description
When a callable declares the same exception type multiple times in a `throws` clause, it is represented by CodeQL as a single `Exception` with multiple `getLocation()` results. This is rather counterintuitive and confusing.
Expected would be that each exception type specified in the `throws` clause has its own `Exception` element with a single location, even if the same exception type occurs multiple times.

### Example
Java code:
```java
public void doSomething() throws IllegalArgumentException, IllegalArgumentException {
}
```

CodeQL query:
```ql
import java

from Exception e
where
e.fromSource()
and count(e.getLocation()) > 1
select e, e.getLocation()

```
[Query Console link](https://lgtm.com/query/4998057520081507908/)

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.