Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not as fun as still having no null safety in Java.




As if Python was any better in that regard, as dynamic language.

Python with type checking is statically type checked. So yes, Python with type checking is better in that regard. And it's safer than Java because there are more classes of errors that Python with type checking will pick up during static type checking than what the Java compiler will pick up.

If Python with added sugar counts, same goes to Java with added sugar.

Can you name any tool that adds static null safety to Java?

JSpecify does. And the work for adding null restricted types to Java has already started:

https://openjdk.org/jeps/8303099


Thank you for sharing this, I was unaware of this and it does seem very promising. I hope that the JEP gets done soon.

As this is, in fact, tacked on, I guess you don't really get much benefit unless you rewrite all your code with these still non-standard annotations.

It does not seem like pointing JSpecify at a standard spring boot codebase will do anything for you. Whereas pointing Mypy to a standard Python codebase will type hints that conform to the language spec will do something for you, as null safety is not tacked on but baked in for python type hints.

Also, the syntax seems awkward and clunky as heck, but I guess for something as essential as null safety it's worth it.

---

From JSpecify, I found the Checker Framework, which also seems really interesting and seems like it supports checking for more types of annotations than just JSpecify annotations. https://checkerframework.org/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: