Description
This particular overload of Completable.subscribe()
looks out of design in compare to other RxJava classes like Observable
and Single
.
Spent ~5 minutes trying to understand why such code didn't compile:
Completable
.fromAction(() -> doSomething())
.subscribe(
() -> ui.success(),
error -> ui.error(error)
);
And the reason is because this overload accepts error
handler first and complete
handler second.
I do understand that it comes from Observable.subscribe(onNext, onError, onComplete)
.
But in compare to many other overloads like:
Observable.subscribe(onNext, onError)
Single.subscribe(onSuccess, onError)
// this one has very similar semantic to target overload.Observable.subscribe(onNext)
Single.subscribe(onSuccess)
Error handler is never first parameter in Observable.subscribe()
and Single.subscribe()
.
Another point is that compiler error displayed in IDE makes it even worse:
Completable
is still in @Experimental
, so, we can change this signature as we want. We can @Deprecate
this overload and add "better" alternative and then delete deprecated overload after one-two releases.