[dead]
Exactly, this is what OP was trying to point out. With the record matching feature, you don't need the extra abstract base class anymore.
This is not to say that abstract base classes are never a good idea, but sometimes in Java they were only there for the convenience of one handler method, to prevent the use of instanceof. This didn't improve readability. That's when the record matching can be a good improvement.
Re:Java record pattern matching in JDK 19
by grumpyprole on Saturday May 14, 2022 @02:29PM
(#31380855)
Sometimes it isn't desirable to scatter the logic across many classes, or conflate the data and the handling. The Java world has the "visitor pattern" to help deal with that, but its double-dispatch is clunky, complex and verbose. Pattern matching just generalises switch and makes it more useful. Java is genuinely a better language with this change.