github / github/codeql

Java: IntersectionType does not match multiple upper bounds of type variable

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

説明

Per [JLS](https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.9) (emphasis mine):
> Intersection types **can be derived from type parameter bounds (§4.4)** and cast expressions (§15.16); they also arise in the processes of capture conversion (§5.1.10) and least upper bound computation (§4.10.4).

Currently it appears to only match types of cast expressions. (Not sure if it would be useful to cover the other cases as well)
This also contradicts with CodeQL's documentation for [`IntersectionTypeAccess`](https://codeql.github.com/codeql-standard-libraries/java/semmle/code/java/Expr.qll/type.Expr$IntersectionTypeAccess.html) (or at least can cause some confusion):
> Note that intersection types can also occur as the bound of a bounded type, such as a type variable. Each component of such a bound is represented by the QL class TypeBound.

However, once `IntersectionType` also matches bounds of type variables, then `IntersectionTypeAccess` might also match those, so its documentation would need to be adjusted.

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

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

評価

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

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

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