Why is the plugin generating `equals` like this? ...
# intellij
h
Why is the plugin generating
equals
like this?
Copy code
class Foo(val name: String) {

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false
        
        other as Foo

        if (name != other.name) return false

        return true
    }
}
Why not simply using
is
?
Copy code
override fun equals(other: Any?): Boolean {
    if (this === other) return true
    if (other !is Foo) return false

    if (name != other.name) return false

    return true
}
Is there a catch?