-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Remove @NonNull annotations in BiConsumer method parameter #5257
Conversation
Codecov Report
@@ Coverage Diff @@
## 2.x #5257 +/- ##
============================================
- Coverage 95.97% 95.94% -0.03%
+ Complexity 5751 5743 -8
============================================
Files 628 628
Lines 41077 41077
Branches 5699 5699
============================================
- Hits 39422 39412 -10
- Misses 664 668 +4
- Partials 991 997 +6
Continue to review full report at Codecov.
|
/cc @vanniktech I belive |
It's not that important. It just means nullability contracts need to be defined where |
Well, it's not in all context that @nonnull annotation is correct in |
Might make more sense to delete the annotations since the interface is used in different places where different parameters are sometimes null and sometimes not. Having different interfaces with different annotations tailored for each use case might be the best option although it wouldn't be backwards compatible at least not source and binary compatible. |
@vanniktech like this example? public void biconsumerWithCorrectNullableAnnotationInThrowable() {
Single.just(1).subscribe(new SingleBiConsumer<Integer, Throwable>() {
@Override
public void accept(@Nullable Integer integer, @Nullable Throwable throwable) throws Exception {
assertNull(throwable);
}
});
} Create a extesion of |
This PR is part of #5216
This PR remove @nonnull annotations from
BiConsumer
method parameters, there's no sense use these annotations inSingle
context because in this caseBiConsumer
always brings you a null parameter.