Pattern: Constant return value for equals()
Issue: -
Reports equals()
methods which will always return true
or false
. Equals methods should always report if some other object is equal to the current object.
Example of incorrect code:
override fun equals(other: Any?): Boolean {
return true
}
Example of correct code:
override fun equals(other: Any?): Boolean {
return this == other
}