Code Insight: Preserve identifier quotes in "Generate equals()/hashCode()/toString()" actions
#KT-15883 Fixed
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
class Example(val `in`: String, val `cl ass`: String, val `valid`: Boolean) {
|
||||
<caret>
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
class Example(val `in`: String, val `cl ass`: String, val `valid`: Boolean) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
|
||||
other as Example
|
||||
|
||||
if (`in` != other.`in`) return false
|
||||
if (`cl ass` != other.`cl ass`) return false
|
||||
if (`valid` != other.`valid`) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = `in`.hashCode()
|
||||
result = 31 * result + `cl ass`.hashCode()
|
||||
result = 31 * result + `valid`.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// GENERATOR: MULTIPLE_TEMPLATES
|
||||
class Example(val `in`: String, val `cl ass`: String, val `valid`: Boolean) {
|
||||
<caret>
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// GENERATOR: MULTIPLE_TEMPLATES
|
||||
class Example(val `in`: String, val `cl ass`: String, val `valid`: Boolean) {
|
||||
override fun toString(): String {
|
||||
return "Example(" +
|
||||
"`in`='$`in`'," +
|
||||
"`cl ass`='$`cl ass`'," +
|
||||
"`valid`=$`valid`" +
|
||||
")"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class Example(val `in`: String, val `cl ass`: String, val `valid`: Boolean) {
|
||||
<caret>
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Example(val `in`: String, val `cl ass`: String, val `valid`: Boolean) {
|
||||
override fun toString(): String {
|
||||
return "Example(`in`='$`in`', `cl ass`='$`cl ass`', `valid`=$`valid`)"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user