PreferJavaUtilObjectsEquals does not check for existing equals method
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
PreferJavaUtilObjectsEquals recipe と関連するテストを探し、issue にある Java スニペットを再現します。既存の equals メソッドがある場合に、影付きまたは未使用の static import を導入せず、修飾された Objects.equals 呼び出しを生成できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.23.1</version>
<configuration>
<activeRecipes>
<recipe>org.openrewrite.java.migrate.guava.NoGuavaJava11</recipe>
</activeRecipes>
<failOnDryRunResults>true</failOnDryRunResults>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-migrate-java</artifactId>
<version>2.10.0</version>
</dependency>
</dependencies>
</plugin>
What is the smallest, simplest way to reproduce the problem?
I haven't compiled this, but I hope the point gets across: the unconditional static import of java.util.Objects.equals is shadowed by the existing equals method
import static com.google.common.base.Objects.equal;
class A {
int foo;
int ba;
@Override
boolean equals(A other) {
//omitting the nullchecks
return equal(foo, other.foo) && equal(ba, other.ba);
}
}
What did you expect to see?
import java.util.Objects;
class A {
int foo;
int ba;
@Override
boolean equals(A other) {
//omitting the nullchecks
return Objects.equals(foo, other.foo) && Objects.equals(ba, other.ba);
}
}
What did you see instead?
import static java.util.Objects.equals; //unused!
class A {
int foo;
int ba;
@Override
boolean equals(A other) {
//omitting the nullchecks
return equals(foo, other.foo) && equals(ba, other.ba);
}
}
Are you interested in contributing a fix to OpenRewrite?
No, just letting you know.
- 主要言語
- Java
- スター
- 156
- フォーク
- 129
- 平均マージ
- 7時間 21分
- マージ済み PR(30日)
- 42
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openrewrite/rewrite-migrate-java のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
openrewrite/rewrite-migrate-java#1289 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
openrewrite/rewrite-migrate-java#1246 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 32/100
openrewrite/rewrite-migrate-java#1227 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
OptionalNotPresentToIsEmpty rewrites `!isPresent()` on a non-`java.util.Optional` type, producing uncompilable `isEmpty()`再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 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
-
Flight SQL JDBC parses boolean properties case-sensitively, silently disabling TLS for useEncryption=TRUE対応中かも @Arawoof06 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
apache/arrow-java#1357 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
apache/rocketmq-dashboard#6610 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
MetricsHub/metricshub-community#1396 ·
メンテナーはふだん 1 日以内に返信
-
L: java:gradle L: java:maven L: ruby:bundler T: bug 🐞
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
dependabot/dependabot-core#16547 ·
メンテナーはふだん 1 日以内に返信
-
Citationcount column sorts alphabetically instead of numerically対応中かも @kpunia306 が今日担当しました。 オープンstatus: needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
JabRef/jabref#17459 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信