From 6150810cc88b067774e7ffe8cd4d736b8606199d Mon Sep 17 00:00:00 2001 From: akarnokd Date: Fri, 8 Dec 2017 13:23:11 +0100 Subject: [PATCH 1/2] 2.x: add a couple of @see to Completable --- src/main/java/io/reactivex/Completable.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/io/reactivex/Completable.java b/src/main/java/io/reactivex/Completable.java index 172e3caab6..1aafe50fb1 100644 --- a/src/main/java/io/reactivex/Completable.java +++ b/src/main/java/io/reactivex/Completable.java @@ -1055,6 +1055,10 @@ public final Completable compose(CompletableTransformer transformer) { * @param other the other Completable, not null * @return the new Completable which subscribes to this and then the other Completable * @throws NullPointerException if other is null + * @see #andThen(MaybeSource) + * @see #andThen(ObservableSource) + * @see #andThen(SingleSource) + * @see #andThen(Publisher) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -1130,6 +1134,7 @@ public final Completable delay(final long delay, final TimeUnit unit, final Sche * @param onComplete the callback to call when this emits an onComplete event * @return the new Completable instance * @throws NullPointerException if onComplete is null + * @see #doFinally(Action) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -1167,6 +1172,7 @@ public final Completable doOnDispose(Action onDispose) { * @param onError the error callback * @return the new Completable instance * @throws NullPointerException if onError is null + * @see #doFinally(Action) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -1254,6 +1260,7 @@ public final Completable doOnSubscribe(Consumer onSubscribe) * * @param onTerminate the callback to call just before this Completable terminates * @return the new Completable instance + * @see #doFinally(Action) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -1272,6 +1279,7 @@ public final Completable doOnTerminate(final Action onTerminate) { * * @param onAfterTerminate the callback to call after this Completable terminates * @return the new Completable instance + * @see #doFinally(Action) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) From de4c4a2849a9392ea1847fae8dfafb9baf6d0dba Mon Sep 17 00:00:00 2001 From: akarnokd Date: Fri, 8 Dec 2017 14:13:42 +0100 Subject: [PATCH 2/2] Enable @see in JavadocWording verifier --- .../java/io/reactivex/JavadocWording.java | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/test/java/io/reactivex/JavadocWording.java b/src/test/java/io/reactivex/JavadocWording.java index f8c881ee78..3d53fad38f 100644 --- a/src/test/java/io/reactivex/JavadocWording.java +++ b/src/test/java/io/reactivex/JavadocWording.java @@ -14,6 +14,7 @@ package io.reactivex; import java.util.List; +import java.util.regex.Pattern; import static org.junit.Assert.*; import org.junit.Test; @@ -695,8 +696,11 @@ public void completableDocRefersToCompletableTypes() throws Exception { int idx = m.javadoc.indexOf("Flowable", jdx); if (idx >= 0) { if (!m.signature.contains("Flowable")) { - e.append("java.lang.RuntimeException: Completable doc mentions Flowable but not in the signature\r\n at io.reactivex.") - .append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n"); + Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Flowable"); + if (!p.matcher(m.javadoc).find()) { + e.append("java.lang.RuntimeException: Completable doc mentions Flowable but not in the signature\r\n at io.reactivex.") + .append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n"); + } } jdx = idx + 6; } else { @@ -708,8 +712,11 @@ public void completableDocRefersToCompletableTypes() throws Exception { int idx = m.javadoc.indexOf("Single", jdx); if (idx >= 0) { if (!m.signature.contains("Single")) { - e.append("java.lang.RuntimeException: Completable doc mentions Single but not in the signature\r\n at io.reactivex.") - .append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n"); + Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Single"); + if (!p.matcher(m.javadoc).find()) { + e.append("java.lang.RuntimeException: Completable doc mentions Single but not in the signature\r\n at io.reactivex.") + .append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n"); + } } jdx = idx + 6; } else { @@ -721,8 +728,11 @@ public void completableDocRefersToCompletableTypes() throws Exception { int idx = m.javadoc.indexOf("SingleSource", jdx); if (idx >= 0) { if (!m.signature.contains("SingleSource")) { - e.append("java.lang.RuntimeException: Completable doc mentions SingleSource but not in the signature\r\n at io.reactivex.") - .append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n"); + Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*SingleSource"); + if (!p.matcher(m.javadoc).find()) { + e.append("java.lang.RuntimeException: Completable doc mentions SingleSource but not in the signature\r\n at io.reactivex.") + .append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n"); + } } jdx = idx + 6; } else { @@ -734,8 +744,11 @@ public void completableDocRefersToCompletableTypes() throws Exception { int idx = m.javadoc.indexOf(" Observable", jdx); if (idx >= 0) { if (!m.signature.contains("Observable")) { - e.append("java.lang.RuntimeException: Completable doc mentions Observable but not in the signature\r\n at io.reactivex.") - .append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n"); + Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Observable"); + if (!p.matcher(m.javadoc).find()) { + e.append("java.lang.RuntimeException: Completable doc mentions Observable but not in the signature\r\n at io.reactivex.") + .append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n"); + } } jdx = idx + 6; } else { @@ -747,8 +760,11 @@ public void completableDocRefersToCompletableTypes() throws Exception { int idx = m.javadoc.indexOf("ObservableSource", jdx); if (idx >= 0) { if (!m.signature.contains("ObservableSource")) { - e.append("java.lang.RuntimeException: Completable doc mentions ObservableSource but not in the signature\r\n at io.reactivex.") - .append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n"); + Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*ObservableSource"); + if (!p.matcher(m.javadoc).find()) { + e.append("java.lang.RuntimeException: Completable doc mentions ObservableSource but not in the signature\r\n at io.reactivex.") + .append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n"); + } } jdx = idx + 6; } else {