Files
codeql/java/ql/test-kotlin2/query-tests/MissingInstanceofInEquals/Test.kt
2023-11-17 14:07:13 +00:00

26 lines
561 B
Kotlin

data class D(val x: Int) {}
data class E(val x: Int) {
override fun equals(other: Any?): Boolean {
return (other as? E)?.x == this.x
}
}
data class F(val x: Int) {
override fun equals(other: Any?): Boolean {
return other != null && other::class == this::class
}
}
data class G(val x: Int) {
override fun equals(other: Any?): Boolean {
return other != null && other.javaClass == this.javaClass
}
}
data class H(val x: Int) {
override fun equals(other: Any?): Boolean {
return other != null
}
}