-
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: Consumer contract is violated when using doOnEvent #5442
Comments
BiConsumer is also violated when using |
Removing the annotation from @sakuna63 BiConsumer doesn't have the annotations. |
I just stumbled upon this while using Kotlin, too. However I wonder how a function argument annotated with |
Maybe RxKotlin has/could have workarounds for these. /cc @thomasnield |
Sorry, I read old source code. |
This was introduced with #5023 |
@akarnokd If there's just one call that passes |
@akarnokd no, the problem cannot be remidied in kotlin which completely prevents the usage of that operator in kotlin. |
If you can think you can resolve this with minimal changes, PR welcome. |
By the way this issue emerged with the release of Kotlin 1.1.3. Although |
Ah, that explains why I just recently starting having problems. |
Huh, I thought implementing Completable
.fromCallable { }
.doOnEvent(object : Consumer<Throwable> {
override fun accept(t: Throwable?) { // Error: 'accept' overrides nothing
println("event: $t")
}
})
.subscribe() But Kotlin compiler (1.1.3-eap34) does not even let such code to compile, so there is probably no clear way to solve this in Kotlin without using Java code. |
Is |
The following code showcases the problem:
t
in this case is annotated with@NonNull
but it will benull
since the completable completes.This is a real pain in Kotlin since the following code crashes in runtime:
Completable.complete() .doOnEvent {}
The text was updated successfully, but these errors were encountered: