Back to Intellij Community

KotlinCovariantEquals

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/KotlinCovariantEquals.html

2025.3-rc-2344 B
Original Source

Reports equals() that takes an argument type other than Any? if the class does not have another equals() that takes Any? as its argument type.

Example:

class Foo {
      fun equals(other: Foo?): Boolean {
          return true
      }
  }

To fix the problem create equals() method that takes an argument of type Any?.