Skip to content

Commit 8213986

Browse files
committed
Javadoc changes:
* flesh out and update @throws sections * add @warn nags to missing javadocs * standardize formatting * fix dead links to images
1 parent fb1a806 commit 8213986

26 files changed

+304
-96
lines changed

rxjava-core/src/main/java/rx/Observable.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4146,8 +4146,8 @@ public final Observable<T> finallyDo(Action0 action) {
41464146
}
41474147

41484148
/**
4149-
* Returns an Observable that emits only the very first item emitted by the source Observable, or raises an
4150-
* {@code NoSuchElementException} if the source Observable is empty.
4149+
* Returns an Observable that emits only the very first item emitted by the source Observable, or notifies
4150+
* of an {@code NoSuchElementException} if the source Observable is empty.
41514151
* <p>
41524152
* <img width="640" height="310" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/first.png">
41534153
* <p>
@@ -4164,7 +4164,7 @@ public final Observable<T> first() {
41644164

41654165
/**
41664166
* Returns an Observable that emits only the very first item emitted by the source Observable that satisfies
4167-
* a specified condition, or raises an {@code NoSuchElementException} if no such items are emitted.
4167+
* a specified condition, or notifies of an {@code NoSuchElementException} if no such items are emitted.
41684168
* <p>
41694169
* <img width="640" height="310" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/firstN.png">
41704170
* <p>
@@ -4486,7 +4486,7 @@ public final <TRight, TLeftDuration, TRightDuration, R> Observable<R> join(Obser
44864486

44874487
/**
44884488
* Returns an Observable that emits the last item emitted by the source Observable or notifies observers of
4489-
* an {@code NoSuchElementException} if the source Observable is empty.
4489+
* a {@code NoSuchElementException} if the source Observable is empty.
44904490
* <p>
44914491
* <img width="640" height="305" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/last.png">
44924492
* <p>
@@ -4503,7 +4503,7 @@ public final Observable<T> last() {
45034503

45044504
/**
45054505
* Returns an Observable that emits only the last item emitted by the source Observable that satisfies a
4506-
* given condition, or an {@code NoSuchElementException} if no such items are emitted.
4506+
* given condition, or notifies of a {@code NoSuchElementException} if no such items are emitted.
45074507
* <p>
45084508
* <img width="640" height="305" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/last.p.png">
45094509
* <p>
@@ -5964,8 +5964,8 @@ public final Observable<T> share() {
59645964

59655965
/**
59665966
* Returns an Observable that emits the single item emitted by the source Observable, if that Observable
5967-
* emits only a single item. If the source Observable emits more than one item or no items, throw an
5968-
* {@code NoSuchElementException}.
5967+
* emits only a single item. If the source Observable emits more than one item or no items, notify of an
5968+
* {@code IllegalArgumentException} or {@code NoSuchElementException} respectively.
59695969
* <p>
59705970
* <img width="640" height="315" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/single.png">
59715971
* <p>
@@ -5986,7 +5986,8 @@ public final Observable<T> single() {
59865986
/**
59875987
* Returns an Observable that emits the single item emitted by the source Observable that matches a
59885988
* specified predicate, if that Observable emits one such item. If the source Observable emits more than one
5989-
* such item or no such items, throw an {@code NoSuchElementException}.
5989+
* such item or no such items, notify of an {@code IllegalArgumentException} or
5990+
* {@code NoSuchElementException} respectively.
59905991
* <p>
59915992
* <img width="640" height="315" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/single.p.png">
59925993
* <p>
@@ -6987,6 +6988,8 @@ public final Observable<T> takeFirst(Func1<? super T, Boolean> predicate) {
69876988
* the number of items to emit from the end of the sequence of items emitted by the source
69886989
* Observable
69896990
* @return an Observable that emits only the last {@code count} items emitted by the source Observable
6991+
* @throws IndexOutOfBoundsException
6992+
* if {@code count} is less than zero
69906993
* @see <a href="https://github.com/Netflix/RxJava/wiki/Filtering-Observables#wiki-takelast">RxJava Uncyclo: takeLast()</a>
69916994
*/
69926995
public final Observable<T> takeLast(final int count) {
@@ -7032,7 +7035,7 @@ public final Observable<T> takeLast(int count, long time, TimeUnit unit) {
70327035
* @return an Observable that emits at most {@code count} items from the source Observable that were emitted
70337036
* in a specified window of time before the Observable completed, where the timing information is
70347037
* provided by the given {@code scheduler}
7035-
* @throws IllegalArgumentException
7038+
* @throws IndexOutOfBoundsException
70367039
* if {@code count} is less than zero
70377040
*/
70387041
public final Observable<T> takeLast(int count, long time, TimeUnit unit, Scheduler scheduler) {

rxjava-core/src/main/java/rx/internal/operators/BlockingOperatorLatest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,20 @@
2626
import rx.exceptions.Exceptions;
2727

2828
/**
29-
* Wait for and iterate over the latest values of the source observable.
30-
* If the source works faster than the iterator, values may be skipped, but
31-
* not the onError or onCompleted events.
29+
* Wait for and iterate over the latest values of the source observable. If the source works faster than the
30+
* iterator, values may be skipped, but not the {@code onError} or {@code onCompleted} events.
3231
*/
3332
public final class BlockingOperatorLatest {
3433
/** Utility class. */
3534
private BlockingOperatorLatest() {
3635
throw new IllegalStateException("No instances!");
3736
}
3837

38+
/**
39+
* @warn latest() missing javadoc
40+
* @param source
41+
* @return
42+
*/
3943
public static <T> Iterable<T> latest(final Observable<? extends T> source) {
4044
return new Iterable<T>() {
4145
@Override

rxjava-core/src/main/java/rx/internal/operators/BlockingOperatorMostRecent.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
*/
3030
public final class BlockingOperatorMostRecent {
3131

32+
/**
33+
* @warn mostRecent() missing javadocs
34+
* @param source
35+
* @param initialValue
36+
* @return
37+
*/
3238
public static <T> Iterable<T> mostRecent(final Observable<? extends T> source, final T initialValue) {
3339

3440
return new Iterable<T>() {

rxjava-core/src/main/java/rx/internal/operators/BlockingOperatorNext.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
*/
3434
public final class BlockingOperatorNext {
3535

36+
/**
37+
* @warn next() missing javadocs
38+
* @param items
39+
* @return
40+
*/
3641
public static <T> Iterable<T> next(final Observable<? extends T> items) {
3742
return new Iterable<T>() {
3843
@Override

rxjava-core/src/main/java/rx/internal/operators/BufferUntilSubscriber.java

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,33 @@
2727
import rx.subscriptions.Subscriptions;
2828

2929
/**
30-
* A solution to the "time gap" problem that occurs with `groupBy` and `pivot` => https://github.com/Netflix/RxJava/issues/844
31-
*
30+
* A solution to the "time gap" problem that occurs with {@code groupBy} and {@code pivot}.
31+
* <p>
3232
* This currently has temporary unbounded buffers. It needs to become bounded and then do one of two things:
33-
*
34-
* 1) blow up and make the user do something about it
35-
* 2) work with the backpressure solution ... still to be implemented (such as co-routines)
36-
*
37-
* Generally the buffer should be very short lived (milliseconds) and then stops being involved.
38-
* It can become a memory leak though if a GroupedObservable backed by this class is emitted but never subscribed to (such as filtered out).
39-
* In that case, either a time-bomb to throw away the buffer, or just blowing up and making the user do something about it is needed.
40-
*
41-
* For example, to filter out GroupedObservables, perhaps they need a silent `subscribe()` on them to just blackhole the data.
42-
*
43-
* This is an initial start at solving this problem and solves the immediate problem of `groupBy` and `pivot` and trades off the possibility of memory leak for deterministic functionality.
33+
* <ol>
34+
* <li>blow up and make the user do something about it</li>
35+
* <li>work with the backpressure solution ... still to be implemented (such as co-routines)</li>
36+
* </ol><p>
37+
* Generally the buffer should be very short lived (milliseconds) and then stops being involved. It can become a
38+
* memory leak though if a {@code GroupedObservable} backed by this class is emitted but never subscribed to
39+
* (such as filtered out). In that case, either a time-bomb to throw away the buffer, or just blowing up and
40+
* making the user do something about it is needed.
41+
* <p>
42+
* For example, to filter out {@code GroupedObservable}s, perhaps they need a silent {@code subscribe()} on them
43+
* to just blackhole the data.
44+
* <p>
45+
* This is an initial start at solving this problem and solves the immediate problem of {@code groupBy} and
46+
* {@code pivot} and trades off the possibility of memory leak for deterministic functionality.
4447
*
48+
* @see <a href="https://github.com/Netflix/RxJava/issues/844">the Github issue describing the time gap problem</a>
49+
* @warn type param "T" undescribed
4550
* @param <T>
4651
*/
4752
public class BufferUntilSubscriber<T> extends Subject<T, T> {
4853

54+
/**
55+
* @warn create() undescribed
56+
*/
4957
public static <T> BufferUntilSubscriber<T> create() {
5058
State<T> state = new State<T>();
5159
return new BufferUntilSubscriber<T>(state);
@@ -136,8 +144,8 @@ public void onNext(T t) {
136144
* from the producer and will drain the queue of any items received during the race of the initial drain and
137145
* switching this.
138146
*
139-
* It will then immediately swap itself out for the actual (after a single notification), but since this is now
140-
* being done on the same producer thread no further buffering will occur.
147+
* It will then immediately swap itself out for the actual (after a single notification), but since this is
148+
* now being done on the same producer thread no further buffering will occur.
141149
*/
142150
private static final class PassThruObserver<T> extends Subscriber<T> {
143151

rxjava-core/src/main/java/rx/internal/operators/NotificationLite.java

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
import rx.Observer;
2222

2323
/**
24-
* For use in internal operators that need something like materialize and dematerialize wholly
25-
* within the implementation of the operator but don't want to incur the allocation cost of actually
26-
* creating {@link rx.Notification} objects for every onNext and onComplete.
24+
* For use in internal operators that need something like materialize and dematerialize wholly within the
25+
* implementation of the operator but don't want to incur the allocation cost of actually creating
26+
* {@link rx.Notification} objects for every {@code onNext} and {@code onComplete}.
2727
*
28-
* An object is allocated inside {@link #error(Throwable)} to wrap the {@link Throwable} but this
29-
* shouldn't effect performance because exceptions should be exceptionally rare.
28+
* An object is allocated inside {@link #error(Throwable)} to wrap the {@link Throwable} but this shouldn't
29+
* affect performance because exceptions should be exceptionally rare.
3030
*
31-
* It's implemented as a singleton to maintain some semblance of type safety that is completely
32-
* non-existent.
31+
* It's implemented as a singleton to maintain some semblance of type safety that is completely non-existent.
3332
*
3433
* @param <T>
34+
* @warn type param <T> undescribed
3535
*/
3636
public final class NotificationLite<T> {
3737
private NotificationLite() {
@@ -40,6 +40,9 @@ private NotificationLite() {
4040
@SuppressWarnings("rawtypes")
4141
private static final NotificationLite INSTANCE = new NotificationLite();
4242

43+
/**
44+
* @warn instance() undocumented
45+
*/
4346
@SuppressWarnings("unchecked")
4447
public static <T> NotificationLite<T> instance() {
4548
return INSTANCE;
@@ -63,10 +66,11 @@ public OnErrorSentinel(Throwable e) {
6366
}
6467

6568
/**
66-
* Creates a lite onNext notification for the value passed in without doing any allocation. Can
69+
* Creates a lite {@code onNext} notification for the value passed in without doing any allocation. Can
6770
* be unwrapped and sent with the {@link #accept} method.
6871
*
6972
* @param t
73+
* @warn parameter "t" undescribed
7074
* @return the value or a null token
7175
*/
7276
public Object next(T t) {
@@ -77,7 +81,7 @@ public Object next(T t) {
7781
}
7882

7983
/**
80-
* Creates a lite onComplete notification without doing any allocation. Can be unwrapped and
84+
* Creates a lite {@code onComplete} notification without doing any allocation. Can be unwrapped and
8185
* sent with the {@link #accept} method.
8286
*
8387
* @return the completion token
@@ -87,10 +91,13 @@ public Object completed() {
8791
}
8892

8993
/**
90-
* Create a lite onError notification. This call does new up an object to wrap the {@link Throwable} but since there should only be one of these the performance impact should
91-
* be small. Can be unwrapped and sent with the {@link #accept} method.
94+
* Create a lite {@code onError} notification. This call does new up an object to wrap the {@link Throwable}
95+
* but since there should only be one of these the performance impact should be small. Can be unwrapped and
96+
* sent with the {@link #accept} method.
9297
*
98+
* @warn description doesn't parse in English ("This call does new up an object...")
9399
* @param e
100+
* @warn parameter "e" undescribed
94101
* @return an object encapsulating the exception
95102
*/
96103
public Object error(Throwable e) {
@@ -101,9 +108,10 @@ public Object error(Throwable e) {
101108
* Unwraps the lite notification and calls the appropriate method on the {@link Observer}.
102109
*
103110
* @param o
104-
* the {@link Observer} to call onNext, onCompleted or onError.
111+
* the {@link Observer} to call onNext, onCompleted, or onError.
112+
* @warn parameter "n" undescribed
105113
* @param n
106-
* @return true if the n was a termination event
114+
* @return true if {@code n} was a termination event
107115
* @throws IllegalArgumentException
108116
* if the notification is null.
109117
* @throws NullPointerException
@@ -129,18 +137,28 @@ public boolean accept(Observer<? super T> o, Object n) {
129137
}
130138
}
131139

140+
/**
141+
* @warn isCompleted() undocumented
142+
*/
132143
public boolean isCompleted(Object n) {
133144
return n == ON_COMPLETED_SENTINEL;
134145
}
135146

147+
/**
148+
* @warn isError() undocumented
149+
*/
136150
public boolean isError(Object n) {
137151
return n instanceof OnErrorSentinel;
138152
}
139153

140154
/**
141-
* If there is custom logic that isn't as simple as call the right method on an {@link Observer} then this method can be used to get the {@link rx.Notification.Kind}
155+
* If there is custom logic that isn't as simple as call the right method on an {@link Observer} then this
156+
* method can be used to get the {@link rx.Notification.Kind}.
142157
*
143158
* @param n
159+
* @warn parameter "n" undescribed
160+
* @throws IllegalArgumentException
161+
* if the notification is null.
144162
* @return the kind of the raw object
145163
*/
146164
public Kind kind(Object n) {
@@ -156,11 +174,12 @@ else if (n instanceof OnErrorSentinel)
156174
}
157175

158176
/**
159-
* returns value passed in {@link #next(Object)} method call. Bad things happen if you call this
160-
* the onComplete or onError notification type. For performance you are expected to use this
177+
* Returns the value passed in {@link #next(Object)} method call. Bad things happen if you call this
178+
* the {@code onComplete} or {@code onError} notification type. For performance you are expected to use this
161179
* when it is appropriate.
162180
*
163181
* @param n
182+
* @warn parameter "n" undescribed
164183
* @return the unwrapped value, which can be null
165184
*/
166185
@SuppressWarnings("unchecked")
@@ -169,13 +188,13 @@ public T getValue(Object n) {
169188
}
170189

171190
/**
172-
* returns {@link Throwable} passed in {@link #error(Throwable)} method call. Bad things happen
173-
* if you
174-
* call this the onComplete or onNext notification type. For performance you are expected to use
175-
* this when it is appropriate.
191+
* Returns the {@link Throwable} passed to the {@link #error(Throwable)} method call. Bad things happen if
192+
* you call this on the {@code onComplete} or {@code onNext} notification type. For performance you are
193+
* expected to use this when it is appropriate.
176194
*
177195
* @param n
178-
* @return The {@link Throwable} wrapped inside n
196+
* @warn parameter "n" undescribed
197+
* @return the {@link Throwable} wrapped inside n
179198
*/
180199
public Throwable getError(Object n) {
181200
return ((OnErrorSentinel) n).e;

0 commit comments

Comments
 (0)