Generate equals/hashCode(): Swap class literals in comparison
This commit is contained in:
@@ -9,7 +9,7 @@ class A(val n: IntArray, val s: Array<String>) {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as A
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ class Test {
|
||||
var name: String = ""
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Test
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import java.util.Arrays
|
||||
data class A(val a: IntArray) {
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as A
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ class Test {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ class A<T>(val n: T) {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as A<*>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Example
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ class A(val n: Int, val s: String) {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as A
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ class A(val n: Int, val s: String) {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other == null || other::class != this::class) return false
|
||||
if (other == null || this::class != other::class) return false
|
||||
|
||||
other as A
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ class A(val n: Int, val s: String) {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other == null || other::class.js != this::class.js) return false
|
||||
if (other == null || this::class.js != other::class.js) return false
|
||||
|
||||
other as A
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ class A(val n: Int?, val s: String) {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as A
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class A(val n: Int, val s: String) : X() {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
if (!super.equals(other)) return false
|
||||
|
||||
other as A
|
||||
|
||||
@@ -5,7 +5,7 @@ class A(val result: Int, val s: String) {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as A
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ class A {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ class A {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other == null || other::class != this::class) return false
|
||||
if (other == null || this::class != other::class) return false
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class A {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other == null || other::class.js != this::class.js) return false
|
||||
if (other == null || this::class.js != other::class.js) return false
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ class A : X() {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
if (!super.equals(other)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ class A(val n: IntArray?, val s: Array<String>?) {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as A
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ class A(val n: Int) {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as A
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ class A(val n: Int?) {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as A
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ class A(val n: Int) : X() {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
if (!super.equals(other)) return false
|
||||
|
||||
other as A
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ class A(val n: Int) : X() {
|
||||
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
if (!super.equals(other)) return false
|
||||
|
||||
other as A
|
||||
|
||||
Reference in New Issue
Block a user