Generate equals/hashCode(): Enable for classes without properties
Also: - forbid for enum classes - use javaClass.hashCode() instead of 0 if class has no properties #KT-18418 Fixed
This commit is contained in:
+1
-3
@@ -5,6 +5,4 @@ class Test {
|
||||
var name: String = ""
|
||||
get
|
||||
<caret>
|
||||
}
|
||||
|
||||
// FORCED
|
||||
}
|
||||
+2
-4
@@ -12,9 +12,7 @@ class Test {
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return 0
|
||||
return javaClass.hashCode()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// FORCED
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// NOT_APPLICABLE
|
||||
class A {<caret>
|
||||
fun foo() {
|
||||
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// FORCED
|
||||
class A {
|
||||
fun foo() {
|
||||
|
||||
@@ -11,6 +10,6 @@ class A {
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return 0
|
||||
return javaClass.hashCode()
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// FORCED
|
||||
class A {<caret>
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FORCED
|
||||
open class X {
|
||||
override fun equals(other: Any?) = super.equals(other)
|
||||
override fun hashCode() = super.hashCode()
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FORCED
|
||||
open class X {
|
||||
override fun equals(other: Any?) = super.equals(other)
|
||||
override fun hashCode() = super.hashCode()
|
||||
Reference in New Issue
Block a user