mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
simplified hashCode for nullable arrays (IDEA-144775)
This commit is contained in:
@@ -121,6 +121,7 @@ public int hashCode() {
|
||||
#macro(addFieldHashCode $field $brace)
|
||||
#set($name = $field.accessor)
|
||||
#if ($field.notNull)#adjustHashCodeToArrays($field)
|
||||
#elseif ($field.array && $java_version > 4)#adjustHashCodeToArrays($field)
|
||||
#else
|
||||
#if ($brace)(##
|
||||
#end
|
||||
|
||||
@@ -20,9 +20,9 @@ class Test {
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int result = myOs != null ? Arrays.hashCode(myOs) : 0;
|
||||
result = 31 * result + (myIIs != null ? Arrays.deepHashCode(myIIs) : 0);
|
||||
result = 31 * result + (myIs != null ? Arrays.hashCode(myIs) : 0);
|
||||
int result = Arrays.hashCode(myOs);
|
||||
result = 31 * result + Arrays.deepHashCode(myIIs);
|
||||
result = 31 * result + Arrays.hashCode(myIs);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -50,12 +50,12 @@ class A {
|
||||
public int hashCode() {
|
||||
int result;
|
||||
long temp;
|
||||
result = a1 != null ? Arrays.hashCode(a1) : 0;
|
||||
result = 31 * result + (a2 != null ? Arrays.deepHashCode(a2) : 0);
|
||||
result = 31 * result + (a3 != null ? Arrays.hashCode(a3) : 0);
|
||||
result = 31 * result + (a4 != null ? Arrays.deepHashCode(a4) : 0);
|
||||
result = 31 * result + (a5 != null ? Arrays.hashCode(a5) : 0);
|
||||
result = 31 * result + (a6 != null ? Arrays.deepHashCode(a6) : 0);
|
||||
result = Arrays.hashCode(a1);
|
||||
result = 31 * result + Arrays.deepHashCode(a2);
|
||||
result = 31 * result + Arrays.hashCode(a3);
|
||||
result = 31 * result + Arrays.deepHashCode(a4);
|
||||
result = 31 * result + Arrays.hashCode(a5);
|
||||
result = 31 * result + Arrays.deepHashCode(a6);
|
||||
result = 31 * result + (int) a7;
|
||||
result = 31 * result + (int) a8;
|
||||
result = 31 * result + a9;
|
||||
|
||||
@@ -98,12 +98,12 @@ class A {
|
||||
public int hashCode() {
|
||||
int result;
|
||||
long temp;
|
||||
result = getA1() != null ? Arrays.hashCode(getA1()) : 0;
|
||||
result = 31 * result + (getA2() != null ? Arrays.deepHashCode(getA2()) : 0);
|
||||
result = 31 * result + (getA3() != null ? Arrays.hashCode(getA3()) : 0);
|
||||
result = 31 * result + (getA4() != null ? Arrays.deepHashCode(getA4()) : 0);
|
||||
result = 31 * result + (getA5() != null ? Arrays.hashCode(getA5()) : 0);
|
||||
result = 31 * result + (getA6() != null ? Arrays.deepHashCode(getA6()) : 0);
|
||||
result = Arrays.hashCode(getA1());
|
||||
result = 31 * result + Arrays.deepHashCode(getA2());
|
||||
result = 31 * result + Arrays.hashCode(getA3());
|
||||
result = 31 * result + Arrays.deepHashCode(getA4());
|
||||
result = 31 * result + Arrays.hashCode(getA5());
|
||||
result = 31 * result + Arrays.deepHashCode(getA6());
|
||||
result = 31 * result + (int) getA7();
|
||||
result = 31 * result + (int) getA8();
|
||||
result = 31 * result + getA9();
|
||||
|
||||
Reference in New Issue
Block a user