Skip to content

Commit 2f1f32e

Browse files
committed
overridden onFoo() methods in Subscriber subclasses need their own javadocs (#1849 #1850).
Also: Observer javadocs are a bit too groovy.
1 parent 8ea7f99 commit 2f1f32e

File tree

4 files changed

+79
-3
lines changed

4 files changed

+79
-3
lines changed

src/main/java/rx/Observer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public interface Observer<T> {
5050
/**
5151
* Provides the Observer with a new item to observe.
5252
* <p>
53-
* The {@link Observable} may call this closure 0 or more times.
53+
* The {@link Observable} may call this method 0 or more times.
5454
* <p>
55-
* The {@code Observable} will not call this closure again after it calls either {@link #onCompleted} or
55+
* The {@code Observable} will not call this method again after it calls either {@link #onCompleted} or
5656
* {@link #onError}.
5757
*
5858
* @param t

src/main/java/rx/observers/SafeSubscriber.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ public SafeSubscriber(Subscriber<? super T> actual) {
6868
this.actual = actual;
6969
}
7070

71+
/**
72+
* Notifies the Subscriber that the {@code Observable} has finished sending push-based notifications.
73+
* <p>
74+
* The {@code Observable} will not call this method if it calls {@link #onError}.
75+
*/
7176
@Override
7277
public void onCompleted() {
7378
if (!done) {
@@ -87,6 +92,15 @@ public void onCompleted() {
8792
}
8893
}
8994

95+
/**
96+
* Notifies the Subscriber that the {@code Observable} has experienced an error condition.
97+
* <p>
98+
* If the {@code Observable} calls this method, it will not thereafter call {@link #onNext} or
99+
* {@link #onCompleted}.
100+
*
101+
* @param e
102+
* the exception encountered by the Observable
103+
*/
90104
@Override
91105
public void onError(Throwable e) {
92106
// we handle here instead of another method so we don't add stacks to the frame
@@ -98,6 +112,17 @@ public void onError(Throwable e) {
98112
}
99113
}
100114

115+
/**
116+
* Provides the Subscriber with a new item to observe.
117+
* <p>
118+
* The {@code Observable} may call this method 0 or more times.
119+
* <p>
120+
* The {@code Observable} will not call this method again after it calls either {@link #onCompleted} or
121+
* {@link #onError}.
122+
*
123+
* @param args
124+
* the item emitted by the Observable
125+
*/
101126
@Override
102127
public void onNext(T args) {
103128
try {
@@ -114,7 +139,8 @@ public void onNext(T args) {
114139
}
115140

116141
/**
117-
* The logic for {@code onError} without the {@code isFinished} check so it can be called from within {@code onCompleted}.
142+
* The logic for {@code onError} without the {@code isFinished} check so it can be called from within
143+
* {@code onCompleted}.
118144
*
119145
* @see <a href="https://github.com/ReactiveX/RxJava/issues/630">the report of this bug</a>
120146
*/

src/main/java/rx/observers/SerializedSubscriber.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,41 @@ public SerializedSubscriber(Subscriber<? super T> s) {
4141
this.s = new SerializedObserver<T>(s);
4242
}
4343

44+
/**
45+
* Notifies the Subscriber that the {@code Observable} has finished sending push-based notifications.
46+
* <p>
47+
* The {@code Observable} will not call this method if it calls {@link #onError}.
48+
*/
4449
@Override
4550
public void onCompleted() {
4651
s.onCompleted();
4752
}
4853

54+
/**
55+
* Notifies the Subscriber that the {@code Observable} has experienced an error condition.
56+
* <p>
57+
* If the {@code Observable} calls this method, it will not thereafter call {@link #onNext} or
58+
* {@link #onCompleted}.
59+
*
60+
* @param e
61+
* the exception encountered by the Observable
62+
*/
4963
@Override
5064
public void onError(Throwable e) {
5165
s.onError(e);
5266
}
5367

68+
/**
69+
* Provides the Subscriber with a new item to observe.
70+
* <p>
71+
* The {@code Observable} may call this method 0 or more times.
72+
* <p>
73+
* The {@code Observable} will not call this method again after it calls either {@link #onCompleted} or
74+
* {@link #onError}.
75+
*
76+
* @param t
77+
* the item emitted by the Observable
78+
*/
5479
@Override
5580
public void onNext(T t) {
5681
s.onNext(t);

src/main/java/rx/observers/TestSubscriber.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ public void onNext(T t) {
6262
});
6363
}
6464

65+
/**
66+
* Notifies the Subscriber that the {@code Observable} has finished sending push-based notifications.
67+
* <p>
68+
* The {@code Observable} will not call this method if it calls {@link #onError}.
69+
*/
6570
@Override
6671
public void onCompleted() {
6772
try {
@@ -82,6 +87,15 @@ public List<Notification<T>> getOnCompletedEvents() {
8287
return testObserver.getOnCompletedEvents();
8388
}
8489

90+
/**
91+
* Notifies the Subscriber that the {@code Observable} has experienced an error condition.
92+
* <p>
93+
* If the {@code Observable} calls this method, it will not thereafter call {@link #onNext} or
94+
* {@link #onCompleted}.
95+
*
96+
* @param e
97+
* the exception encountered by the Observable
98+
*/
8599
@Override
86100
public void onError(Throwable e) {
87101
try {
@@ -102,6 +116,17 @@ public List<Throwable> getOnErrorEvents() {
102116
return testObserver.getOnErrorEvents();
103117
}
104118

119+
/**
120+
* Provides the Subscriber with a new item to observe.
121+
* <p>
122+
* The {@code Observable} may call this method 0 or more times.
123+
* <p>
124+
* The {@code Observable} will not call this method again after it calls either {@link #onCompleted} or
125+
* {@link #onError}.
126+
*
127+
* @param t
128+
* the item emitted by the Observable
129+
*/
105130
@Override
106131
public void onNext(T t) {
107132
lastSeenThread = Thread.currentThread();

0 commit comments

Comments
 (0)