Generate equals/hashCode(): Support content equality from stdlib

#KT-22361 Fixed
This commit is contained in:
Alexey Sedunov
2018-07-06 21:17:39 +03:00
parent 5fcc6cfa0b
commit b441c76313
5 changed files with 76 additions and 30 deletions
@@ -1,5 +1,3 @@
import java.util.Arrays
data class A(val a: IntArray) {
<caret>override fun equals(other: Any?): Boolean {
if (this === other) return true
@@ -7,12 +5,12 @@ data class A(val a: IntArray) {
other as A
if (!Arrays.equals(a, other.a)) return false
if (!a.contentEquals(other.a)) return false
return true
}
override fun hashCode(): Int {
return Arrays.hashCode(a)
return a.contentHashCode()
}
}