Inspectopedia
 
2024.3

Recursive equals call

Warning
New
Last modified: 03 December 2024

Reports recursive equals (==) calls.

In Kotlin, == compares object values by calling equals method under the hood. ===, on the other hand, compares objects by reference.

=== is commonly used in equals method implementation. But === may be mistakenly mixed up with == leading to infinite recursion.

Example:

After the quick-fix is applied: