You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are looking for a simple and easy-to-use null security solution, but the existing solutions are not satisfactory
Since jsr305 is almost indefinitely shelved, various independent solutions appear in the community, making it difficult to have a unified and easy-to-use API and perfect IDE support
Combining several common solutions, I personally think that the org.springframework.lang solution is the best, comprehensive API ease of use and possible compatibility, but the IDE support is not enough.
question
Consider the following needs:
First of all, should not add annotations to all code, all fields, all parameters! This is the reason why I haven't been able to use jetbrainsAnnotations extensively so far
Use @NonNullApi (scope = parameters + return values) and/or @NonNullFields
(scope = fields) to set the default behavior to non-nullable in order to avoid annotating
your whole codebase with @nonnull.
-- org.springframework.lang.NonNull
By default, the entire module (JPMS module) / entire package / entire class is NotNull or Nullable.
Separately mark a small number of inconsistent APIs (properties, method parameters, method return values, etc.)
Similar issue: All parameters NotNull/Nullable #80
By default, all attributes in the entire module (JPMS module) / entire package / entire class are NotNull or Nullable.
Separately mark a small number of inconsistent APIs (properties, method parameters, method return values, etc.)
By default, all method parameters or return values in the entire module (JPMS module) / entire package / entire class are NotNull or Nullable.
Separately mark a small number of inconsistent APIs (properties, method parameters, method return values, etc.)
Increase Target ElementType.PACKAGEElementType.MODULE to satisfy Question 1
Added javax.annotation.Nonnull and javax.annotation.Nullable as meta-annotations (optional dependencies) for maximum compatibility
Add org.springframework.lang.NonNullApiorg.springframework.lang.NonNullFields similar annotations to meet some scenarios in Question 2 and Question 3
Add semantic annotations opposite to org.springframework.lang.NonNullApiorg.springframework.lang.NonNullFields to meet more flexible scenarios
It is not enough to just modify this repository, it is still necessary for the IDE to provide similar support and allow inspection of javax.annotation.Nonnull similar annotations as meta-annotations for all custom annotations
The text was updated successfully, but these errors were encountered:
broken thoughts
We are looking for a simple and easy-to-use null security solution, but the existing solutions are not satisfactory
Since
jsr305
is almost indefinitely shelved, various independent solutions appear in the community, making it difficult to have a unified and easy-to-use API and perfect IDE supportCombining several common solutions, I personally think that the
org.springframework.lang
solution is the best, comprehensive API ease of use and possible compatibility, but the IDE support is not enough.question
Consider the following needs:
First of all, should not add annotations to all code, all fields, all parameters! This is the reason why I haven't been able to use jetbrainsAnnotations extensively so far
NotNull
orNullable
.Separately mark a small number of inconsistent APIs (properties, method parameters, method return values, etc.)
Similar issue: All parameters NotNull/Nullable #80
NotNull
orNullable
.Separately mark a small number of inconsistent APIs (properties, method parameters, method return values, etc.)
NotNull
orNullable
.Separately mark a small number of inconsistent APIs (properties, method parameters, method return values, etc.)
suggestion
org.jetbrains.annotations.NotNull
org.jetbrains.annotations.Nullable
Modifications:ElementType.PACKAGE
ElementType.MODULE
to satisfyQuestion 1
javax.annotation.Nonnull
andjavax.annotation.Nullable
as meta-annotations (optional dependencies) for maximum compatibilityorg.springframework.lang.NonNullApi
org.springframework.lang.NonNullFields
similar annotations to meet some scenarios inQuestion 2
andQuestion 3
org.springframework.lang.NonNullApi
org.springframework.lang.NonNullFields
to meet more flexible scenariosIt is not enough to just modify this repository, it is still necessary for the IDE to provide similar support and allow inspection of
javax.annotation.Nonnull
similar annotations as meta-annotations for all custom annotationsThe text was updated successfully, but these errors were encountered: