github / github/codeql

Java: Add predicates for getting annotated types / TypeAccess

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

説明

Would it be possible to add predicates for getting annotated (`ElementType.TYPE_USE`) types? Respectively `TypeAccess` instances which would then allow getting the annotations.

It appears currently one would have to write complicated predicates for getting the respective `TypeAccess`.
E.g. to get the `TypeAccess` of the method return type, the following appears to work:
```
TypeAccess getReturnTypeAccess(Method m) {
exists (TypeAccess typeAccess |
typeAccess.getParent() = m
and result = typeAccess
)
}
```
Though maybe it is incomplete and also returns generic type parameters and `throws` clause types (haven't tested it yet).
Edit: It appears the return type `TypeAccess` has the child index -1 of the method.

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

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

評価

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

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

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