From 3f1197cadb021030483c24e9fb04d6a0ccc6ce44 Mon Sep 17 00:00:00 2001 From: Marvin Ramin Date: Wed, 19 Apr 2017 20:18:44 +0200 Subject: [PATCH 1/3] correct javadoc note in Observable.doOnDispose() The note was claiming Observable.doOnDispose() would be called for terminal events of the Observable, which is not the case --- src/main/java/io/reactivex/Observable.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/io/reactivex/Observable.java b/src/main/java/io/reactivex/Observable.java index 7a6de1636f..ec840f5533 100644 --- a/src/main/java/io/reactivex/Observable.java +++ b/src/main/java/io/reactivex/Observable.java @@ -6895,8 +6895,6 @@ public final Observable doFinally(Action onFinally) { * If the action throws a runtime exception, that exception is rethrown by the {@code dispose()} call, * sometimes as a {@code CompositeException} if there were multiple exceptions along the way. *

- * Note that terminal events trigger the action unless the {@code ObservableSource} is subscribed to via {@code unsafeSubscribe()}. - *

* *

*
Scheduler:
From 256d44b27c0077c878fa3a85606b1104f788df31 Mon Sep 17 00:00:00 2001 From: Marvin Ramin Date: Wed, 19 Apr 2017 20:25:18 +0200 Subject: [PATCH 2/3] small improvement to .doOnDispose javadocs to refer to Actions --- src/main/java/io/reactivex/Completable.java | 6 +++--- src/main/java/io/reactivex/Maybe.java | 4 ++-- src/main/java/io/reactivex/Single.java | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/reactivex/Completable.java b/src/main/java/io/reactivex/Completable.java index ff20df3c22..d26ef6faef 100644 --- a/src/main/java/io/reactivex/Completable.java +++ b/src/main/java/io/reactivex/Completable.java @@ -1107,13 +1107,13 @@ public final Completable doOnComplete(Action onComplete) { } /** - * Returns a Completable which calls the given onDispose callback if the child subscriber cancels - * the subscription. + * Calls the shared {@code Action} if a CompletableObserver subscribed to the current + * Completable disposes the common Disposable it received via onSubscribe. *
*
Scheduler:
*
{@code doOnDispose} does not operate by default on a particular {@link Scheduler}.
*
- * @param onDispose the callback to call when the child subscriber disposes the subscription + * @param onDispose the action to call when the child subscriber disposes the subscription * @return the new Completable instance * @throws NullPointerException if onDispose is null */ diff --git a/src/main/java/io/reactivex/Maybe.java b/src/main/java/io/reactivex/Maybe.java index e5dfbd89ac..bb14d8da34 100644 --- a/src/main/java/io/reactivex/Maybe.java +++ b/src/main/java/io/reactivex/Maybe.java @@ -2441,13 +2441,13 @@ public final Maybe doFinally(Action onFinally) { } /** - * Calls the shared runnable if a MaybeObserver subscribed to the current Maybe + * Calls the shared {@code Action} if a MaybeObserver subscribed to the current Maybe * disposes the common Disposable it received via onSubscribe. *
*
Scheduler:
*
{@code doOnDispose} does not operate by default on a particular {@link Scheduler}.
*
- * @param onDispose the runnable called when the subscription is cancelled (disposed) + * @param onDispose the action called when the subscription is cancelled (disposed) * @return the new Maybe instance */ @CheckReturnValue diff --git a/src/main/java/io/reactivex/Single.java b/src/main/java/io/reactivex/Single.java index 3cef7c9aa4..9a89e5b2cc 100644 --- a/src/main/java/io/reactivex/Single.java +++ b/src/main/java/io/reactivex/Single.java @@ -1926,13 +1926,13 @@ public final Single doOnError(final Consumer onError) { } /** - * Calls the shared runnable if a SingleObserver subscribed to the current Single + * Calls the shared {@code Action} if a SingleObserver subscribed to the current Single * disposes the common Disposable it received via onSubscribe. *
*
Scheduler:
*
{@code doOnDispose} does not operate by default on a particular {@link Scheduler}.
*
- * @param onDispose the runnable called when the subscription is disposed + * @param onDispose the action called when the subscription is disposed * @return the new Single instance * @since 2.0 */ From 6c6c8f47dfa586f4fa6fb1297a39a2ca3a2b028b Mon Sep 17 00:00:00 2001 From: Marvin Ramin Date: Wed, 19 Apr 2017 20:26:22 +0200 Subject: [PATCH 3/3] add @throws mentions to doOnDisposed javadocs --- src/main/java/io/reactivex/Maybe.java | 1 + src/main/java/io/reactivex/Observable.java | 1 + src/main/java/io/reactivex/Single.java | 1 + 3 files changed, 3 insertions(+) diff --git a/src/main/java/io/reactivex/Maybe.java b/src/main/java/io/reactivex/Maybe.java index bb14d8da34..dd79da3bf1 100644 --- a/src/main/java/io/reactivex/Maybe.java +++ b/src/main/java/io/reactivex/Maybe.java @@ -2448,6 +2448,7 @@ public final Maybe doFinally(Action onFinally) { *
{@code doOnDispose} does not operate by default on a particular {@link Scheduler}.
*
* @param onDispose the action called when the subscription is cancelled (disposed) + * @throws NullPointerException if onDispose is null * @return the new Maybe instance */ @CheckReturnValue diff --git a/src/main/java/io/reactivex/Observable.java b/src/main/java/io/reactivex/Observable.java index ec840f5533..abe9fe1ba6 100644 --- a/src/main/java/io/reactivex/Observable.java +++ b/src/main/java/io/reactivex/Observable.java @@ -6904,6 +6904,7 @@ public final Observable doFinally(Action onFinally) { * @param onDispose * the action that gets called when the source {@code ObservableSource}'s Disposable is disposed * @return the source {@code ObservableSource} modified so as to call this Action when appropriate + * @throws NullPointerException if onDispose is null * @see ReactiveX operators documentation: Do */ @CheckReturnValue diff --git a/src/main/java/io/reactivex/Single.java b/src/main/java/io/reactivex/Single.java index 9a89e5b2cc..a5ff633ff5 100644 --- a/src/main/java/io/reactivex/Single.java +++ b/src/main/java/io/reactivex/Single.java @@ -1934,6 +1934,7 @@ public final Single doOnError(final Consumer onError) { * * @param onDispose the action called when the subscription is disposed * @return the new Single instance + * @throws NullPointerException if onDispose is null * @since 2.0 */ @CheckReturnValue