-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Remove unnecessary Nullable
annotation
#2688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@CodePlayer Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@CodePlayer Thank you for signing the Contributor License Agreement! |
I think 2 things:
As 1 example, libraries, frameworks or otherwise, should never return a Even more unsettling is the fact that
Equally unfortunate is that fact that, you are right, there are many places where Spring Data Redis uses an underlying API that might return If you were to checkout the spring-data-redis codebase and setup a IDE project, you would see a lot of warnings with regard to nullability. IMO, this is really part of a much larger effort to align things correctly. However, this requires team attention (and I have brought such concerns to their attention already) in order to scope and prioritize this effort appropriately. |
Closing in favor of Issue #2707. |
"always code defensively" -- it's correct. However, it is impossible for our developers to perform Consider that in the regardless of the pipeline or transaction mode, many methods ( such as These codes will NOT return However, during the execution of the pipeline or transaction model, the developer did NOT obtain the return value after each row of Redis calls. Even if there is, all the return values are My suggestion is NOT to remove all |
Remove unnecessary
@Nullable
annotations in Redis's Operation interfaces.Many Redis APIs return
null
ONLY in pipeline or transaction mode, and these operations are not necessarily marked as@Nullable
.However, the IDE will perform WRONG Null checks on related codes and mislead developers, even though we hardly use pipeline and transaction modes.
What's more, in pipeline or transaction mode, some methods of Spring Data Redis are currently marked as
@Nullable
, while other methods are not marked. The style is NOT uniform, which is easily confusing.Therefore, I think that for those Redis APIs that cannot return
null
in normal mode, the@Nullable
annotation should be removed uniformly.