r/programming • • Aug 12 '24

JSpecify 1.0.0 and Nullability in Java

https://www.infoq.com/news/2024/08/jspecify-java-nullability/
3 Upvotes

4 comments sorted by

2

u/setoid Aug 13 '24

Out of curiosity, does this let you annotate a class as "not-nullable by default"? For me, a big disadvantage of nullable annocations is that you basically have to mark everything as @NotNull, which turns out to a big pain.

Will this be compatible with https://bugs.openjdk.org/browse/JDK-8303099 ?

1

u/alkorith Aug 13 '24

Use the @NullMarked annotation to mark a class as non-null by default. See: https://jspecify.dev/docs/api/org/jspecify/annotations/NullMarked.html

3

u/Determinant Aug 12 '24

I hope this project succeeds as this will help Java projects.  This should also further improve Kotlin-Java interop since additional nullability information will be available if library authors adopt JSpecify.

1

u/zam0th Aug 13 '24

- We already had one JavaEE!
- Yes, but what about the J2EE?

First they all ignore EE annotations because "EE is shit" and then they literally reinvent the wheel.