I wonder: why default implementation of equals() and hashCode() methods in data classes are not calling superclass’ equals and hashCode?
Taking aside good practices like open-close principle, composition over inheritance, immutability (legacy code still exists):
Right now when data class inherits open or java class with properties, I have have to (either):
- override properties of this class - fragile solution as I can easily forget to override new property of subclass when modifying superclass and also there are two different methods of testing equality of same properties - which shouldn’t but can lead to errors
- Implement equals and hashCode manually - so I lose one of the benefits of data class
I wonder if it works like this on purpose or it’s something that could be added in future versions of kotlin