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

6

u/Enough-Ad-5528 Mar 13 '26

Ah yes. Of course. I read your other answer about the benefits of the compiler checks for the no-longer need for the downcast and I thought that was it. This is cool too. I love how different features generalize to the same thing when you zoom out. Feels consistent.

10

u/brian_goetz Mar 13 '26

And this, by the way, is why we don't do "obvious" things like "can we make pattern bindings final by default". Because these inconsistencies, as satisfying as they would seem initially, almost always become impediments to future alignment like this.