Here lie dragons.
The first rule is “NEVER override equals
or hashCode
in a case class”. If you need to override them, then revert to a normal class.
And if you decide to implement equals
and hashCode
on a normal class (if you override one, you must override BOTH), here’s a StackOverflow Answer I created when I hit this exact same issue in the last year or so.