github / github/codeql

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

オープン
#7,309 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
Java question
主要言語
CodeQL
スター
10.1k
フォーク
2.1k
平均マージ
2日 15時間
マージ済み PR(30日)
141

説明

### 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/)

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。