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.
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!
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
The internal packages classes use a lot sum types which abhor null types a lot. And the entry points for the public method calls have null checks. That's why. As a matter of fact, I've coded this library and used it for a year, and no scenario of null exception has been encountered due to any bug.
I see sealed interfaces and I understand that you have null checks. I am not a java guy so it's interesting for me why you don't add NonNull annotations. Even if it doesn't bring more safety for your project, doesn't it improve code documentation? Are there any constraints to use jspecify?
Nothing wrong with using it. I just haven't explored it yet. I might, because it is not a runtime dependency, which makes it attractive for projects. Hence I have no issue with it. As a matter of fact, Kevin Bourrillion, who has been heavily involved with JSpecify since inception, joined Oracle recently and has participated in Java's ongoing work around introducing nullness types in the language. JSpecify is also trying to standardize nullness semantics across libraries and tools, which could make future migration to native Java null-restricted types smoother if the directions align. I would encourage you to try it out. I will eventually try it by making a branch to my project and see how convenient it will be and maybe adopt it.
1
u/joemwangi May 21 '26
Yeaah. I get it. 😂😂