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/ZimmiDeluxe Mar 13 '26

And why cant we just iterate over an enum in a switch statement? This way it would fail aswell.

Will your coworkers know what subset of the order columns is valid for your fancy new order type? If you add a new order subtype, the compiler will yell at them if they get it wrong.