Inspectopedia
 
2024.3

Sealed subclass without state and overridden equals

Info
New
Last modified: 03 December 2024

Reports direct inheritors of sealed classes that have no state and overridden equals() method.

It's highly recommended to override equals() to provide comparison stability, or convert the class to an object to reach the same effect.

Example:

The quick-fix converts a class into an object: