TypeInfo: a way to reach the anonymous and local classes declared in a type's bodies
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 49/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
Start by tracing how ParseConstructorCall and ParseTypeDeclaration create TypeInfo for anonymous and local classes, then inspect TypeInfo.subTypes() and recursiveSubTypeStream(). The issue proposes storing those classes in declaration order or exposing a body-walking stream; choose an approach that preserves subTypes() as member types only. Done when callers can discover nested anonymous and local classes recursively, including the example loop, without each writing its own body walk.
索引モデルが issue の本文から書いたものです。
説明
What is missing
TypeInfo.subTypes() returns the member types, and recursiveSubTypeStream() is built on it. Anonymous classes (new T() { … }) and local classes (declared in a method body) are not in either: ParseConstructorCall and ParseTypeDeclaration give them a TypeInfo with an enclosing type and a stable index (getAndIncrementAnonymousTypes), but nothing adds them to the enclosing type, so the only way to find them is to visit every method body and field initializer for ConstructorCall.anonymousClass() and LocalTypeDeclaration.typeInfo(), recursively.
Every tool that wants "all the code in this compilation unit" (a search over methods, a rewrite of loop bodies, a census of calls) rediscovers this the hard way: a loop inside
return new HttpResponse() {
@Override
public void generateResponse(StaplerRequest2 req, StaplerResponse2 rsp, Object node) {
for (Map.Entry<String, String> header : headers.entrySet()) {
rsp.setHeader(header.getKey(), header.getValue());
}
}
};
is simply never seen when the tool walks primary.recursiveSubTypeStream().flatMap(TypeInfo::constructorAndMethodStream). In a large code base (Jenkins core) this hid a few percent of the sites of one rewrite.
Proposal
Either of:
TypeInfo.localTypes(): the anonymous and local classes whose enclosing type this is, in declaration order, filled by the parser at the two places that mint them; and arecursiveSubTypeStreamIncludingLocal()(or a boolean parameter) that descends into them as it does into member types; or- a documented
TypeInfo.anonymousAndLocalTypeStream()that performs the body walk once, in the API, so that callers do not each write it.
The first is cheaper for callers and keeps subTypes() as it is (member types only), which some callers surely depend on.
Workaround used
A helper that walks constructorAndMethodStream() bodies and field initializers with Element.visit, collecting ConstructorCall.anonymousClass() and LocalTypeDeclaration.typeInfo() into a queue, deduplicated by identity, until the queue is empty.
Seen on 0.9.5-alpha.13.
- 主要言語
- Java
- スター
- 1
- フォーク
- 1
- 平均マージ
- 1時間 44分
- マージ済み PR(30日)
- 6
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CodeLaser/maddi のほかの issue
-
Javadoc warnings are the only noise on an otherwise clean CI run対応中かも @jayeshamundkar06-bit が 3 日前に担当しました。 オープンbuild/ci good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
CodeLaser/maddi#4 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 14/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
front-end:rust
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
メンテナーはふだん 1 日以内に返信
CodeLaser/maddi の issue をすべて見る
似ている issue
-
API `/api/dataverses/{identifier}/dataset/linkingDataverses?alreadyLinking=true` returns at most 1 collection対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンType: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
javaoperatorsdk.client.oauth-token has no effect on the Kubernetes client対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
MCP add-on: JSON responses with non-ASCII characters are truncated (wrong Content-Length)対応中かも @dhanushbs10 が今日担当しました。 オープンadd-on bug in:mcp
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Map.Coordinate does not implement proper equals対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンvaadin-map
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
vaadin/flow-components#10586 ·
メンテナーはふだん 1 日以内に返信
-
WeReadInstaller writes the launcher database on the main thread at handover (Activity pause timeout)オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100