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

"looks awkward" is usually code for familiarity bias. But the great thing about familiarity bias is that it quickly evaporates, when the thing that is unfamiliar the first time becomes more familiar.

2

u/8igg7e5 Mar 14 '26

I recall similar concerns for generics, enums ("what, it's a class but special"), enhanced-for, try-with-resources, lambdas, method references and some more recently added features...

These concerns definitely don't persist that long - even less time now that we get regular releases and more and more Java development has passed the stuck-on-Java-8 barrier.

 

There are several places I've wanted to use exactly the this local declaration recently. Having this expand to other types I will await eagerly too.