PreferJavaUtilObjectsEquals does not check for existing equals method
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
Localiza la receta PreferJavaUtilObjectsEquals y cualquier prueba relacionada, y después reproduce el fragmento de Java del issue. Se considera terminado cuando la migración produce llamadas calificadas a Objects.equals sin introducir una importación estática sombreada o sin usar cuando ya existe un método equals.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Java
- Estrellas
- 156
- Forks
- 129
- Merge medio
- 14 h 30 min
- PR fusionados (30 d)
- 43
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de openrewrite/rewrite-migrate-java
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
openrewrite/rewrite-migrate-java#1246 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 32/100
openrewrite/rewrite-migrate-java#1227 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
OptionalNotPresentToIsEmpty rewrites `!isPresent()` on a non-`java.util.Optional` type, producing uncompilable `isEmpty()`Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 70/100
openrewrite/rewrite-migrate-java#1146 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 50/100
openrewrite/rewrite-migrate-java#1119 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
openrewrite/rewrite-migrate-java#1069 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de openrewrite/rewrite-migrate-java
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
openhab/openhab-addons#21921 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
objectionary/eo-graphs#85 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
objectionary/lints#1544 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
objectionary/hone-maven-plugin#1309 ·
Los mantenedores suelen responder en 1 día
-
chore s3
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día