mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
Java: don't add instance check when generating equals() (IDEA-357686)
GitOrigin-RevId: 21a0555c2fe6be705fe4d510c8d8d08238af4585
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9ad64512e3
commit
7fbe663b37
@@ -24,7 +24,6 @@
|
||||
#end
|
||||
##
|
||||
#macro(addEqualsPrologue)
|
||||
if(this == $paramName) return true;
|
||||
#addInstanceOfToText()
|
||||
#if ($superHasEquals)
|
||||
if(!super.equals($paramName)) return false;
|
||||
|
||||
@@ -5,7 +5,6 @@ class A {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {<caret>
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
A a1 = (A) o;
|
||||
return a == a1.a;
|
||||
|
||||
@@ -3,7 +3,6 @@ abstract class SuperTest {
|
||||
}
|
||||
class Test extends SuperTest {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ class A {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
final A a = (A) o;
|
||||
return i == a.i &&
|
||||
|
||||
@@ -15,7 +15,6 @@ class A extends I {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
final A a = (A) o;
|
||||
|
||||
@@ -6,7 +6,6 @@ class Test {
|
||||
int[] myIs;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -3,7 +3,6 @@ class Arrays {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Arrays arrays = (Arrays) o;
|
||||
|
||||
@@ -6,7 +6,6 @@ class Test {
|
||||
int[] myIs;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -5,7 +5,6 @@ class A<T extends String, K> {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final A<?, ?> a = (A<?, ?>) o;
|
||||
|
||||
@@ -22,7 +22,6 @@ class A {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final A a = (A) o;
|
||||
|
||||
@@ -21,7 +21,6 @@ class A {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final A a = (A) o;
|
||||
|
||||
@@ -70,7 +70,6 @@ class A {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final A a = (A) o;
|
||||
|
||||
@@ -20,7 +20,6 @@ class A {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final A a = (A) o;
|
||||
|
||||
@@ -32,7 +32,6 @@ class A extends B {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ class A extends B {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
final A a = (A) o;
|
||||
|
||||
@@ -6,7 +6,6 @@ class Test {
|
||||
Test b;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -7,7 +7,6 @@ class Test {
|
||||
double c;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -3,7 +3,6 @@ class Test {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -7,7 +7,6 @@ class A {
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof A)) return false;
|
||||
|
||||
final A a = (A) o;
|
||||
|
||||
@@ -3,7 +3,6 @@ class Integer {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Integer integer = (Integer) o;
|
||||
|
||||
@@ -5,7 +5,6 @@ class Test {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Integer integer = (Integer) o;
|
||||
|
||||
@@ -21,7 +21,6 @@ class A {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final A a = (A) o;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
public class Test {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ class Test {
|
||||
@org.jetbrains.annotations.NotNull Object d;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -2,7 +2,6 @@ class Test {
|
||||
double d;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -2,7 +2,6 @@ class Test {
|
||||
double d;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -4,7 +4,6 @@ class Test {
|
||||
Object d;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -2,7 +2,6 @@ class Test {
|
||||
float d;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -3,7 +3,6 @@ class Simple {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object p_o_r) {
|
||||
if (this == p_o_r) return true;
|
||||
if (p_o_r == null || getClass() != p_o_r.getClass()) return false;
|
||||
|
||||
final Simple l_that_v = (Simple) p_o_r;
|
||||
|
||||
@@ -4,7 +4,6 @@ public class Test {
|
||||
int h;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Test test = (Test) o;
|
||||
|
||||
@@ -8,7 +8,6 @@ public class X {
|
||||
private double d = 1.0;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final X x = (X) o;
|
||||
|
||||
@@ -6,7 +6,6 @@ class X {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
final X x = (X) o;
|
||||
return Objects.deepEquals(s, x.s);
|
||||
|
||||
@@ -6,7 +6,6 @@ class A {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
final A a = (A) o;
|
||||
return Objects.deepEquals(a1, a.a1);
|
||||
|
||||
@@ -5,7 +5,6 @@ class X {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
final X x = (X) o;
|
||||
return Objects.equals(s, x.s);
|
||||
|
||||
@@ -8,7 +8,6 @@ abstract class SuperTest {
|
||||
}
|
||||
class Test extends SuperTest {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user