Skip to content

Commit

Permalink
Convert CompletableOnErrorComplete$onError inner class to static (#7575)
Browse files Browse the repository at this point in the history
* pass predicate to avoid holding reference

* static

* fix compile error

---------

Co-authored-by: Chintan Doshi <chintan.doshi@snap.com>
  • Loading branch information
chintando and Chintan Doshi committed Jun 23, 2023
1 parent 806ec1c commit da34188
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ public CompletableOnErrorComplete(CompletableSource source, Predicate<? super Th
@Override
protected void subscribeActual(final CompletableObserver observer) {

source.subscribe(new OnError(observer));
source.subscribe(new OnError(observer, predicate));
}

final class OnError implements CompletableObserver {
static final class OnError implements CompletableObserver {

private final CompletableObserver downstream;
private final Predicate<? super Throwable> predicate;

OnError(CompletableObserver observer) {
OnError(CompletableObserver observer,
Predicate<? super Throwable> predicate) {
this.downstream = observer;
this.predicate = predicate;
}

@Override
Expand Down

0 comments on commit da34188

Please sign in to comment.