generate equals/hashCode: generate deepHashCode for IntelliJ template; do not use deep equals for Objects template as Objects.hash doesn't support it anyway (IDEA-135313)

This commit is contained in:
Anna Kozlova
2015-01-19 19:02:10 +01:00
parent 26f389b07a
commit 88b543d2c6
9 changed files with 24 additions and 50 deletions
@@ -21,8 +21,7 @@ class Test {
public int hashCode() {
int result = myOs != null ? Arrays.hashCode(myOs) : 0;
result = 31 * result + (myIIs != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(myIIs) : 0);
result = 31 * result + (myIIs != null ? Arrays.deepHashCode(myIIs) : 0);
result = 31 * result + (myIs != null ? Arrays.hashCode(myIs) : 0);
return result;
}
@@ -51,14 +51,11 @@ class A {
int result;
long temp;
result = a1 != null ? Arrays.hashCode(a1) : 0;
result = 31 * result + (a2 != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a2) : 0);
result = 31 * result + (a2 != null ? Arrays.deepHashCode(a2) : 0);
result = 31 * result + (a3 != null ? Arrays.hashCode(a3) : 0);
result = 31 * result + (a4 != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a4) : 0);
result = 31 * result + (a4 != null ? Arrays.deepHashCode(a4) : 0);
result = 31 * result + (a5 != null ? Arrays.hashCode(a5) : 0);
result = 31 * result + (a6 != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a6) : 0);
result = 31 * result + (a6 != null ? Arrays.deepHashCode(a6) : 0);
result = 31 * result + (int) a7;
result = 31 * result + (int) a8;
result = 31 * result + a9;
@@ -51,14 +51,11 @@ class A {
int result;
long temp;
result = Arrays.hashCode(a1);
result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a2);
result = 31 * result + Arrays.deepHashCode(a2);
result = 31 * result + Arrays.hashCode(a3);
result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a4);
result = 31 * result + Arrays.deepHashCode(a4);
result = 31 * result + Arrays.hashCode(a5);
result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a6);
result = 31 * result + Arrays.deepHashCode(a6);
result = 31 * result + (int) a7;
result = 31 * result + (int) a8;
result = 31 * result + a9;
@@ -99,14 +99,11 @@ class A {
int result;
long temp;
result = getA1() != null ? Arrays.hashCode(getA1()) : 0;
result = 31 * result + (getA2() != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(getA2()) : 0);
result = 31 * result + (getA2() != null ? Arrays.deepHashCode(getA2()) : 0);
result = 31 * result + (getA3() != null ? Arrays.hashCode(getA3()) : 0);
result = 31 * result + (getA4() != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(getA4()) : 0);
result = 31 * result + (getA4() != null ? Arrays.deepHashCode(getA4()) : 0);
result = 31 * result + (getA5() != null ? Arrays.hashCode(getA5()) : 0);
result = 31 * result + (getA6() != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(getA6()) : 0);
result = 31 * result + (getA6() != null ? Arrays.deepHashCode(getA6()) : 0);
result = 31 * result + (int) getA7();
result = 31 * result + (int) getA8();
result = 31 * result + getA9();
@@ -47,14 +47,11 @@ class A {
@Override
public int hashCode() {
int result = Arrays.hashCode(a1);
result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a2);
result = 31 * result + Arrays.deepHashCode(a2);
result = 31 * result + Arrays.hashCode(a3);
result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a4);
result = 31 * result + Arrays.deepHashCode(a4);
result = 31 * result + Arrays.hashCode(a5);
result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a6);
result = 31 * result + Arrays.deepHashCode(a6);
result = 31 * result + (int) a7;
result = 31 * result + (int) a8;
result = 31 * result + a9;
@@ -63,14 +63,11 @@ class A extends B {
int result = super.hashCode();
long temp;
result = 31 * result + Arrays.hashCode(a1);
result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a2);
result = 31 * result + Arrays.deepHashCode(a2);
result = 31 * result + Arrays.hashCode(a3);
result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a4);
result = 31 * result + Arrays.deepHashCode(a4);
result = 31 * result + Arrays.hashCode(a5);
result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a6);
result = 31 * result + Arrays.deepHashCode(a6);
result = 31 * result + (int) a7;
result = 31 * result + (int) a8;
result = 31 * result + a9;
@@ -51,14 +51,11 @@ class A {
int result1;
long temp1;
result1 = Arrays.hashCode(a1);
result1 = 31 * result1 + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a2);
result1 = 31 * result1 + Arrays.deepHashCode(a2);
result1 = 31 * result1 + Arrays.hashCode(a3);
result1 = 31 * result1 + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a4);
result1 = 31 * result1 + Arrays.deepHashCode(a4);
result1 = 31 * result1 + Arrays.hashCode(a5);
result1 = 31 * result1 + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
Arrays.hashCode(a6);
result1 = 31 * result1 + Arrays.deepHashCode(a6);
result1 = 31 * result1 + (int) a7;
result1 = 31 * result1 + (int) a8;
result1 = 31 * result1 + a9;