Kotlin printer: apply for construct-then-configure sequences (#140 follow-up)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 45/100
調査の方向性
Start by reading the Kotlin printer and its CST name-resolution checks, then inspect how it represents construction, configuring calls, and the local’s final use. Implementing this rewrite requires preserving Kotlin name binding and the stated single-use cases. Measure apply counts and line counts on langchain4j and jenkins, and confirm compile counts stay unchanged across the five corpora.
索引モデルが issue の本文から書いたものです。
説明
Follow-up of #140 (idiom scorecard: apply 0 in langchain4j's output).
Today. The Kotlin printer never emits apply. also appears only as the mechanical .also { x = it } for Java's assignment as a value.
Shape (Java → Kotlin):
Config c = new Config();
c.setName(name);
c.setTimeout(30);
return c;
return Config().apply {
setName(name) // or name = name, once getX()/setX() print as properties
setTimeout(30)
}
The same holds where the last statement is an assignment this.config = c, or c is passed on once.
What decides it (corrected 2026-10-23, see the evaluation below):
- Every statement between construction and the last use calls a method on the new object, with arguments that do not mention it.
The new object does not escape before the last configuring call; that is the modification and independence analyses' job.Wrong:T().apply { a(); b() }runs the same calls in the same order as the Java statements, so escape changes nothing. The analyses do not decide this rewrite.- Name resolution, which the printer checks with the CST it already has:
- Inside the block, unqualified names resolve to
T's members first. An argumentsize()ornamethat meant the enclosing class's would silently rebind. - An outer
thismust becomethis@Outer.
- Inside the block, unqualified names resolve to
- The local is not used afterwards except for the single return / assignment / argument the
applyreplaces, or it stays aval x = T().apply { … }.
Not: with/run. They are taste, and a reviewer won't miss them.
Measure. apply count and line count on langchain4j and jenkins; compile counts unchanged across the five corpora.
🤖 Generated with Claude Code
- 主要言語
- Java
- スター
- 1
- フォーク
- 1
- 平均マージ
- 1時間 13分
- マージ済み 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 が 5 日前に担当しました。 オープンbuild/ci good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
CodeLaser/maddi#4 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
front-end:csharp
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 61/100
CodeLaser/maddi#185 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 14/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
CodeLaser/maddi の issue をすべて見る
似ている issue
-
bug web-ui
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
jenkinsci/jenkins#27705 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
googleads/googleads-mobile-flutter#1541 ·
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
Julow/Unexpected-Keyboard#1490 ·
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
Vakore/ZappierGames#275 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
unitycatalog/unitycatalog#2148 ·
メンテナーはふだん 2 日以内に返信