Apply var to method invocations
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
まず、#217 で参照されている既存の基本的な var の作業と、そのレシピテストを確認します。次に、Java メソッドの戻り値の型とジェネリック呼び出しがどのように表現されているかを追跡します。提示されている変更前と変更後の例を受け入れ条件として使用し、short、byte、および戻り値の型が一致しない場合について明記された除外も含めます。この issue では実装ファイルやテストパスが示されていないため、まずそれらを特定する必要があります。
索引モデルが issue の本文から書いたものです。
説明
What problem are you trying to solve?
While developing basic var usage with #217 java reveals that local variable type inference is a big field, so we decided to split.
One open area is applying var to variable declarations initialized by method invocations.
What precondition(s) should be checked before applying this recipe?
varis not applicable if
- the method has return type ´short´ or
byte - the method's return type does not match the type definition in the left-hand side
Describe the situation before applying the recipe
class A {
String getHello() {
return "Hello Rewrite";
}
void simple(String bar) {
String msg = getHello(); // (1)
System.out.println(msg);
}
void generic(String bar) {
List<String> msgs = List.of("Hello", "Rewrite"); // (2)
System.out.println(msgs);
}
}
Describe the situation after applying the recipe
class A {
String getHello() {
return "Hello Rewrite";
}
void simple(String bar) {
var msg = getHello(); // (1)
System.out.println(msg);
}
void generic(String bar) {
var msgs = List.of("Hello", "Rewrite"); // (2)
System.out.println(msgs);
}
}
Have you considered any alternatives or workarounds?
An alternative would be to no support var in combination with methods
Any additional context
It may be a good idea to implement this as an independent recipe, this would increase separation of concern and make configuration easier.
Are you interested in contributing this recipe to OpenRewrite?
Yes, but need additional support understanding generics.
- 主要言語
- Java
- スター
- 156
- フォーク
- 129
- 平均マージ
- 3日 8時間
- マージ済み PR(30日)
- 14
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openrewrite/rewrite-migrate-java のほかの issue
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
openrewrite/rewrite-migrate-java#1246 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
openrewrite/rewrite-migrate-java#1228 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 32/100
openrewrite/rewrite-migrate-java#1227 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
openrewrite/rewrite-migrate-java#1146 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 50/100
openrewrite/rewrite-migrate-java#1119 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
openrewrite/rewrite-migrate-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
bisq-network/bisq#8097 ·
メンテナーはふだん 1 日以内に返信
-
area/frontend good first issue kind/cooldown
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/datasketches-java#773 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
cpinitiative/usaco-guide#6665 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
trinodb/trino-gateway#1301 ·
メンテナーはふだん 1 日以内に返信