Code Insight: Allow properties with custom setters to be used in generated equals/hashCode/toString

#KT-11908 Fixed
This commit is contained in:
Alexey Sedunov
2016-04-14 17:07:30 +03:00
parent beb5d5e271
commit 38522b09ce
10 changed files with 96 additions and 1 deletions
@@ -0,0 +1,8 @@
class Test {
var serial: String = ""
set(value) {
field = value.toUpperCase()
}
var name: String = ""
<caret>
}
@@ -0,0 +1,25 @@
class Test {
var serial: String = ""
set(value) {
field = value.toUpperCase()
}
var name: String = ""
<caret>override fun equals(other: Any?): Boolean{
if (this === other) return true
if (other?.javaClass != javaClass) return false
other as Test
if (serial != other.serial) return false
if (name != other.name) return false
return true
}
override fun hashCode(): Int{
var result = serial.hashCode()
result = 31 * result + name.hashCode()
return result
}
}