Closed ledsoft closed 1 month ago
I am looking at the options, and I think we should consider JSpecify annotations.
jakarta.validation.constraints.NotNull
is used for bean validation. This should stay unchanged for runtime bean validation.
There are also Nonnull
and Nullable
from jakarta.annotation
that are intended for static analysis.
Spring's @NonNull currently uses Nonnull
from the old javax.
However, they seem to be planning a migration to JSpecify.
I suggest using JSpecify, too.
@ledsoft
Once this is resolved, it is possible to change the Intellij idea configuration to use desired annotations for code generation instead of the ones from Jetbrains. And it should be mentioned in implementation docs.
https://www.jetbrains.com/help/idea/annotating-source-code.html#nullability-annotations
I would actually prefer the standard Jakarta Nonnull
. It seems to work with IDEA out of the box and we already depend on Jakarta annotations.
Let's put this one on hold, I will ask a friend at Payara what they use.
Ok, I suggest going with the standard Jakarta annotations. It requires no additional dependencies and works fine with IDEs without any extra configuration.
A mix of JetBrains (
org.jetbrains.annotations
, e.g.@NotNull
) and Spring (org.springframework.lang
, e.g.,@NonNull
) is used within TermIt. We need to unify these to the Spring-based ones.