-
Notifications
You must be signed in to change notification settings - Fork 24
Description
I would like to encourage you to migrate your project from JetBrains nullable annotations to JSpecify.
https://jspecify.dev/
JSpecify is developed collaboratively by major players across the Java ecosystem, aiming to be the unified, open standard for nullness annotations: i.e. Google (Android, Error Prone, Guava), JetBrains (IDEA, Kotlin), OpenJDK team, Spring, Sonar, etc
Spring 7 (Nov. 2025) uses JSpecify and Uber NullAway for ultimate Null Safety
https://spring.io/blog/2025/03/10/null-safety-in-spring-apps-with-jspecify-and-null-away
PS:
Instead of adding @nonnull repeatedly on individual elements, it is better to use @NullMarked at the class or package level. This sets a “non-null by default” policy, meaning all elements are treated as non-null unless explicitly annotated with @nullable. This approach makes the code cleaner and reduces annotation clutter.
https://jspecify.dev/docs/using/
In addition to adopting JSpecify's @nullable and @nonnull annotations, you may also wish to adopt @NullMarked. If your code already annotates all its @nullable types, then you can (with rare exceptions) remove any @nonnull annotations in favor of putting a @NullMarked annotation on the whole class, package, or module.
@NullMarked is similar to JSR-305's @ParametersAreNonnullByDefault and custom @TypeQualifierDefault annotations. Still, @NullMarked differs from those, including in its effect on generics, so you may need to take advantage of your new ability to annotate locations like type arguments (as in Future<@nullable Credentials>). @NullMarked is likely to have an effect closer to what you want, but it may require additional work on your part.