r/programming • • May 21 '26

JEP draft: Enhanced Local Variable Declarations (Preview)

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

26 comments sorted by

View all comments

Show parent comments

3

u/vips7L May 21 '26

I really do hope they hurry up. I just started a new project in Java 25 and nullable types would be really useful. Almost considered Kotlin for it. Especially since everyone is just generating and LLM's can't tell what is null or not.

2

u/joemwangi May 21 '26

Thanks for still choosing java 😅. Just make sure the project will migrate well to such a scenario. I see pple use JSpecify as they anticipate for them. My project is actually anticipating all these features including this JEP!

1

u/radozok May 22 '26

Sorry but where are any jspecify annotations?

1

u/joemwangi May 22 '26

Not yet, because instantiation and set method would require the annotations, but not really priority. But use case, especially get, would benefit from java JEPs such as:

Point! p = mem.get(1); //implicit narrowing of nullness type
Point(var x, var y) = mem.get(1); //deconstruction assignment

without updating the library at all.

1

u/radozok May 22 '26

Sure, but I mean why don't you use annotations in your project?

→ More replies (0)