-
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
2.x BiConsumer nullability annotations violated #5216
Comments
Indeed, those use cases should override the default annotation with |
@akarnokd I can submit a PR if @davidschreiber can't, but what do you suggest? An exclusive |
That would be a breaking change. I see 3 options:
|
Well I don't think it's a breaking change, it's just an interface extending 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);
}
});
} What do you think? |
Yes, you can simply delete the annotations or ignore them in your code. |
Yes I know, but sometimes it's important to let developers know about property nullability, but ok thank you about your suggestions. |
With kotlin it's actually more of an issue because if you create a biConsumer subclass it will take both parameters NonNull and throw an exception at runtime. I think the correct solution here is to remove the annotation (makes sense, sometimes it's nullable, sometimes it it's nonNull, ) |
Closing via #5257 |
RxJava 2.0.7
The
BiConsumer
interface has both parameters of itsaccept()
method marked as@NonNull
. However, when using theBiConsumer
interface as result callback for aSingle
, the received parameter values are mutually exclusive being a non-null value and the other one beingnull
. Although it seems to make sense in use, it violates the interface annotations and makes usage, at least, confusing.The text was updated successfully, but these errors were encountered: