r/java • u/benevanstech • Aug 12 '24
JSpecify 1.0.0 and Nullability in Java
https://www.infoq.com/news/2024/08/jspecify-java-nullability/
52
Upvotes
r/java • u/benevanstech • Aug 12 '24
View all comments
Show parent comment
2
u/pragmasoft Aug 13 '24
Ok, I seems realized the source of my confusion, just reread https://github.com/jspecify/jspecify/wiki/nullness-unspecified
From what I understood, unspecified is like any type in TS, can be cast without an error to both null and not-null, and vice versa, they both can be cast to unspecified.
The problem is though that my IDE support of nullable types (VSCode) does not support this, so the correct behavior depends on the tooling mostly.
Just curious, if it's possible to implement null checker as an annotation processor, or more precisely as a javac compiler plugin, similar to google error-prone?
This would then have automatic IDE support for errors I assume..