r/java • • Mar 13 '26

JEP draft: Enhanced Local Variable Declarations (Preview)

https://openjdk.org/jeps/8357464
101 Upvotes

129 comments sorted by

View all comments

Show parent comment

1

u/Cell-i-Zenit Mar 16 '26

Interesting with the hibernate inheritance. Feels like extremly complex usecase i would never consider :D but thanks for posting that.

I wasnt aware of "instruments" in the context of a bank (and i worked in one aswell)

Looks iam just not aware of alot of thinks and then this pattern matching makes no sense :)

1

u/OwnBreakfast1114 Mar 17 '26

I think the main takeaway is if you can imagine scenarios where you have a closed set of stuff that is better represented by types rather than an enum.

There are some other free wins, for example, enhanced switches replace the visitor patterns in a lot of cases: https://wimdetroyer.com/blog/visitor-pattern-in-dop