Skip to content

Commit 579e90d

Browse files
authored
2.x: Cleaunp - rename fields to upstream and downstream (#6129)
* 2.x: Cleaunp - rename fields to upstream and downstream * Make links in MaybeEmitter.setDisposable
1 parent c8b0a0e commit 579e90d

File tree

526 files changed

+5499
-5325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

526 files changed

+5499
-5325
lines changed

src/jmh/java/io/reactivex/MemoryPerf.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ static long memoryUse() {
3535

3636
static final class MyRx2Subscriber implements FlowableSubscriber<Object> {
3737

38-
org.reactivestreams.Subscription s;
38+
org.reactivestreams.Subscription upstream;
3939

4040
@Override
4141
public void onSubscribe(Subscription s) {
42-
this.s = s;
42+
this.upstream = s;
4343
}
4444

4545
@Override
@@ -61,11 +61,11 @@ public void onNext(Object t) {
6161
static final class MyRx2Observer implements io.reactivex.Observer<Object>, io.reactivex.SingleObserver<Object>,
6262
io.reactivex.MaybeObserver<Object>, io.reactivex.CompletableObserver {
6363

64-
Disposable s;
64+
Disposable upstream;
6565

6666
@Override
67-
public void onSubscribe(Disposable s) {
68-
this.s = s;
67+
public void onSubscribe(Disposable d) {
68+
this.upstream = d;
6969
}
7070

7171
@Override

src/main/java/io/reactivex/Completable.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1622,11 +1622,11 @@ public final Completable doFinally(Action onFinally) {
16221622
* // and subsequently this class has to send a Disposable to the downstream.
16231623
* // Note that relaying the upstream's Disposable directly is not allowed in RxJava
16241624
* &#64;Override
1625-
* public void onSubscribe(Disposable s) {
1625+
* public void onSubscribe(Disposable d) {
16261626
* if (upstream != null) {
1627-
* s.cancel();
1627+
* d.dispose();
16281628
* } else {
1629-
* upstream = s;
1629+
* upstream = d;
16301630
* downstream.onSubscribe(this);
16311631
* }
16321632
* }

src/main/java/io/reactivex/CompletableEmitter.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ public interface CompletableEmitter {
5959
void onError(@NonNull Throwable t);
6060

6161
/**
62-
* Sets a Disposable on this emitter; any previous Disposable
63-
* or Cancellation will be disposed/cancelled.
62+
* Sets a Disposable on this emitter; any previous {@link Disposable}
63+
* or {@link Cancellable} will be disposed/cancelled.
6464
* @param d the disposable, null is allowed
6565
*/
6666
void setDisposable(@Nullable Disposable d);
6767

6868
/**
69-
* Sets a Cancellable on this emitter; any previous Disposable
70-
* or Cancellation will be disposed/cancelled.
69+
* Sets a Cancellable on this emitter; any previous {@link Disposable}
70+
* or {@link Cancellable} will be disposed/cancelled.
7171
* @param c the cancellable resource, null is allowed
7272
*/
7373
void setCancellable(@Nullable Cancellable c);

src/main/java/io/reactivex/CompletableSource.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public interface CompletableSource {
2424

2525
/**
2626
* Subscribes the given CompletableObserver to this CompletableSource instance.
27-
* @param cs the CompletableObserver, not null
28-
* @throws NullPointerException if {@code cs} is null
27+
* @param co the CompletableObserver, not null
28+
* @throws NullPointerException if {@code co} is null
2929
*/
30-
void subscribe(@NonNull CompletableObserver cs);
30+
void subscribe(@NonNull CompletableObserver co);
3131
}

src/main/java/io/reactivex/Flowable.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10787,7 +10787,7 @@ public final Single<T> lastOrError() {
1078710787
*
1078810788
* // In the subscription phase, the upstream sends a Subscription to this class
1078910789
* // and subsequently this class has to send a Subscription to the downstream.
10790-
* // Note that relaying the upstream's Subscription directly is not allowed in RxJava
10790+
* // Note that relaying the upstream's Subscription instance directly is not allowed in RxJava
1079110791
* &#64;Override
1079210792
* public void onSubscribe(Subscription s) {
1079310793
* if (upstream != null) {

src/main/java/io/reactivex/FlowableEmitter.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@
5151
public interface FlowableEmitter<T> extends Emitter<T> {
5252

5353
/**
54-
* Sets a Disposable on this emitter; any previous Disposable
55-
* or Cancellation will be disposed/cancelled.
56-
* @param s the disposable, null is allowed
54+
* Sets a Disposable on this emitter; any previous {@link Disposable}
55+
* or {@link Cancellable} will be disposed/cancelled.
56+
* @param d the disposable, null is allowed
5757
*/
58-
void setDisposable(@Nullable Disposable s);
58+
void setDisposable(@Nullable Disposable d);
5959

6060
/**
61-
* Sets a Cancellable on this emitter; any previous Disposable
62-
* or Cancellation will be disposed/cancelled.
61+
* Sets a Cancellable on this emitter; any previous {@link Disposable}
62+
* or {@link Cancellable} will be disposed/cancelled.
6363
* @param c the cancellable resource, null is allowed
6464
*/
6565
void setCancellable(@Nullable Cancellable c);

src/main/java/io/reactivex/Maybe.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -3237,11 +3237,11 @@ public final Single<Boolean> isEmpty() {
32373237
* // and subsequently this class has to send a Disposable to the downstream.
32383238
* // Note that relaying the upstream's Disposable directly is not allowed in RxJava
32393239
* &#64;Override
3240-
* public void onSubscribe(Disposable s) {
3240+
* public void onSubscribe(Disposable d) {
32413241
* if (upstream != null) {
3242-
* s.cancel();
3242+
* d.dispose();
32433243
* } else {
3244-
* upstream = s;
3244+
* upstream = d;
32453245
* downstream.onSubscribe(this);
32463246
* }
32473247
* }

src/main/java/io/reactivex/MaybeEmitter.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ public interface MaybeEmitter<T> {
6767
void onComplete();
6868

6969
/**
70-
* Sets a Disposable on this emitter; any previous Disposable
71-
* or Cancellation will be unsubscribed/cancelled.
72-
* @param s the disposable, null is allowed
70+
* Sets a Disposable on this emitter; any previous {@link Disposable}
71+
* or {@link Cancellable} will be disposed/cancelled.
72+
* @param d the disposable, null is allowed
7373
*/
74-
void setDisposable(@Nullable Disposable s);
74+
void setDisposable(@Nullable Disposable d);
7575

7676
/**
77-
* Sets a Cancellable on this emitter; any previous Disposable
78-
* or Cancellation will be unsubscribed/cancelled.
77+
* Sets a Cancellable on this emitter; any previous {@link Disposable}
78+
* or {@link Cancellable} will be disposed/cancelled.
7979
* @param c the cancellable resource, null is allowed
8080
*/
8181
void setCancellable(@Nullable Cancellable c);

src/main/java/io/reactivex/Observable.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9409,11 +9409,11 @@ public final Single<T> lastOrError() {
94099409
* // and subsequently this class has to send a Disposable to the downstream.
94109410
* // Note that relaying the upstream's Disposable directly is not allowed in RxJava
94119411
* &#64;Override
9412-
* public void onSubscribe(Disposable s) {
9412+
* public void onSubscribe(Disposable d) {
94139413
* if (upstream != null) {
9414-
* s.dispose();
9414+
* d.dispose();
94159415
* } else {
9416-
* upstream = s;
9416+
* upstream = d;
94179417
* downstream.onSubscribe(this);
94189418
* }
94199419
* }

src/main/java/io/reactivex/ObservableEmitter.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@
5050
public interface ObservableEmitter<T> extends Emitter<T> {
5151

5252
/**
53-
* Sets a Disposable on this emitter; any previous Disposable
54-
* or Cancellation will be unsubscribed/cancelled.
53+
* Sets a Disposable on this emitter; any previous {@link Disposable}
54+
* or {@link Cancellable} will be disposed/cancelled.
5555
* @param d the disposable, null is allowed
5656
*/
5757
void setDisposable(@Nullable Disposable d);
5858

5959
/**
60-
* Sets a Cancellable on this emitter; any previous Disposable
61-
* or Cancellation will be unsubscribed/cancelled.
60+
* Sets a Cancellable on this emitter; any previous {@link Disposable}
61+
* or {@link Cancellable} will be disposed/cancelled.
6262
* @param c the cancellable resource, null is allowed
6363
*/
6464
void setCancellable(@Nullable Cancellable c);

src/main/java/io/reactivex/Single.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -2708,11 +2708,11 @@ public final T blockingGet() {
27082708
* // and subsequently this class has to send a Disposable to the downstream.
27092709
* // Note that relaying the upstream's Disposable directly is not allowed in RxJava
27102710
* &#64;Override
2711-
* public void onSubscribe(Disposable s) {
2711+
* public void onSubscribe(Disposable d) {
27122712
* if (upstream != null) {
2713-
* s.cancel();
2713+
* d.dispose();
27142714
* } else {
2715-
* upstream = s;
2715+
* upstream = d;
27162716
* downstream.onSubscribe(this);
27172717
* }
27182718
* }

src/main/java/io/reactivex/SingleEmitter.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ public interface SingleEmitter<T> {
6363

6464
/**
6565
* Sets a Disposable on this emitter; any previous Disposable
66-
* or Cancellation will be unsubscribed/cancelled.
67-
* @param s the disposable, null is allowed
66+
* or Cancellable will be disposed/cancelled.
67+
* @param d the disposable, null is allowed
6868
*/
69-
void setDisposable(@Nullable Disposable s);
69+
void setDisposable(@Nullable Disposable d);
7070

7171
/**
72-
* Sets a Cancellable on this emitter; any previous Disposable
73-
* or Cancellation will be unsubscribed/cancelled.
72+
* Sets a Cancellable on this emitter; any previous {@link Disposable}
73+
* or {@link Cancellable} will be disposed/cancelled.
7474
* @param c the cancellable resource, null is allowed
7575
*/
7676
void setCancellable(@Nullable Cancellable c);

src/main/java/io/reactivex/internal/observers/BasicFuseableObserver.java

+23-23
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
public abstract class BasicFuseableObserver<T, R> implements Observer<T>, QueueDisposable<R> {
2929

3030
/** The downstream subscriber. */
31-
protected final Observer<? super R> actual;
31+
protected final Observer<? super R> downstream;
3232

3333
/** The upstream subscription. */
34-
protected Disposable s;
34+
protected Disposable upstream;
3535

3636
/** The upstream's QueueDisposable if not null. */
37-
protected QueueDisposable<T> qs;
37+
protected QueueDisposable<T> qd;
3838

3939
/** Flag indicating no further onXXX event should be accepted. */
4040
protected boolean done;
@@ -44,26 +44,26 @@ public abstract class BasicFuseableObserver<T, R> implements Observer<T>, QueueD
4444

4545
/**
4646
* Construct a BasicFuseableObserver by wrapping the given subscriber.
47-
* @param actual the subscriber, not null (not verified)
47+
* @param downstream the subscriber, not null (not verified)
4848
*/
49-
public BasicFuseableObserver(Observer<? super R> actual) {
50-
this.actual = actual;
49+
public BasicFuseableObserver(Observer<? super R> downstream) {
50+
this.downstream = downstream;
5151
}
5252

5353
// final: fixed protocol steps to support fuseable and non-fuseable upstream
5454
@SuppressWarnings("unchecked")
5555
@Override
56-
public final void onSubscribe(Disposable s) {
57-
if (DisposableHelper.validate(this.s, s)) {
56+
public final void onSubscribe(Disposable d) {
57+
if (DisposableHelper.validate(this.upstream, d)) {
5858

59-
this.s = s;
60-
if (s instanceof QueueDisposable) {
61-
this.qs = (QueueDisposable<T>)s;
59+
this.upstream = d;
60+
if (d instanceof QueueDisposable) {
61+
this.qd = (QueueDisposable<T>)d;
6262
}
6363

6464
if (beforeDownstream()) {
6565

66-
actual.onSubscribe(this);
66+
downstream.onSubscribe(this);
6767

6868
afterDownstream();
6969
}
@@ -97,7 +97,7 @@ public void onError(Throwable t) {
9797
return;
9898
}
9999
done = true;
100-
actual.onError(t);
100+
downstream.onError(t);
101101
}
102102

103103
/**
@@ -106,7 +106,7 @@ public void onError(Throwable t) {
106106
*/
107107
protected final void fail(Throwable t) {
108108
Exceptions.throwIfFatal(t);
109-
s.dispose();
109+
upstream.dispose();
110110
onError(t);
111111
}
112112

@@ -116,24 +116,24 @@ public void onComplete() {
116116
return;
117117
}
118118
done = true;
119-
actual.onComplete();
119+
downstream.onComplete();
120120
}
121121

122122
/**
123123
* Calls the upstream's QueueDisposable.requestFusion with the mode and
124124
* saves the established mode in {@link #sourceMode} if that mode doesn't
125125
* have the {@link QueueDisposable#BOUNDARY} flag set.
126126
* <p>
127-
* If the upstream doesn't support fusion ({@link #qs} is null), the method
127+
* If the upstream doesn't support fusion ({@link #qd} is null), the method
128128
* returns {@link QueueDisposable#NONE}.
129129
* @param mode the fusion mode requested
130130
* @return the established fusion mode
131131
*/
132132
protected final int transitiveBoundaryFusion(int mode) {
133-
QueueDisposable<T> qs = this.qs;
134-
if (qs != null) {
133+
QueueDisposable<T> qd = this.qd;
134+
if (qd != null) {
135135
if ((mode & BOUNDARY) == 0) {
136-
int m = qs.requestFusion(mode);
136+
int m = qd.requestFusion(mode);
137137
if (m != NONE) {
138138
sourceMode = m;
139139
}
@@ -149,22 +149,22 @@ protected final int transitiveBoundaryFusion(int mode) {
149149

150150
@Override
151151
public void dispose() {
152-
s.dispose();
152+
upstream.dispose();
153153
}
154154

155155
@Override
156156
public boolean isDisposed() {
157-
return s.isDisposed();
157+
return upstream.isDisposed();
158158
}
159159

160160
@Override
161161
public boolean isEmpty() {
162-
return qs.isEmpty();
162+
return qd.isEmpty();
163163
}
164164

165165
@Override
166166
public void clear() {
167-
qs.clear();
167+
qd.clear();
168168
}
169169

170170
// -----------------------------------------------------------

src/main/java/io/reactivex/internal/observers/BlockingBaseObserver.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public abstract class BlockingBaseObserver<T> extends CountDownLatch
2424
T value;
2525
Throwable error;
2626

27-
Disposable d;
27+
Disposable upstream;
2828

2929
volatile boolean cancelled;
3030

@@ -34,7 +34,7 @@ public BlockingBaseObserver() {
3434

3535
@Override
3636
public final void onSubscribe(Disposable d) {
37-
this.d = d;
37+
this.upstream = d;
3838
if (cancelled) {
3939
d.dispose();
4040
}
@@ -48,7 +48,7 @@ public final void onComplete() {
4848
@Override
4949
public final void dispose() {
5050
cancelled = true;
51-
Disposable d = this.d;
51+
Disposable d = this.upstream;
5252
if (d != null) {
5353
d.dispose();
5454
}

src/main/java/io/reactivex/internal/observers/BlockingFirstObserver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public final class BlockingFirstObserver<T> extends BlockingBaseObserver<T> {
2424
public void onNext(T t) {
2525
if (value == null) {
2626
value = t;
27-
d.dispose();
27+
upstream.dispose();
2828
countDown();
2929
}
3030
}

0 commit comments

Comments
 (0)