mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
java.util.Objects equals/hashCode: use Arrays for array fields, ensure single array is not passed to Objects.hashCode vararg to avoid confusion (IDEA-140111)
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
import java.util.Arrays;
|
||||
|
||||
class A {
|
||||
int[] a1;
|
||||
|
||||
@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 Arrays.equals(a1, a.a1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(a1);
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class A {
|
||||
int[] a1;
|
||||
<caret>
|
||||
}
|
||||
Reference in New Issue
Block a user