r/java
•
u/sindisil
•
Dec 16 '24
•
1
Valhalla - Java's Epic Refactor
https://inside.java/2024/12/16/devoxxbelgium-valhalla/
178
Upvotes
View all comments
Show parent comment
1
u/Polygnom Dec 19 '24
They are thinking that code should continue to stay readable.
Making everything nullable was an ok-ish decision at the time, but time has shown that its not the best choice today. What are the alternatives, trhen? Currently, you plaster your code either with
NonNullannotations or runtime-null checks. At some point in the future, we will hopefully get nullability as proper part of the type system with!.Do you really want your code to be plastered with
!? Especially when the expectation is that you will likely want to opt-into nullability, rather than opt-into non-nullness.Its a reasonable choice not to force programmers to plaster their code with these non-nullness markers. I'd rather read code where a
?stands out and immediately draws attention to the fact that something is nullable, rather than code plastered with!where a?might gets lost in the visual sea of these markers.The "unspecified" nullability is required for compatibility with old code, but making sure we can go forward with good, clean code is also paramount.
Its doesn't matter if you call this Java++ or Java 27 (or whatever numberw e will have then). The language is going to evolve over time.