Skip to content

Commit

Permalink
2.x: add a couple of @see to Completable (#5758)
Browse files Browse the repository at this point in the history
* 2.x: add a couple of @see to Completable

* Enable @see in JavadocWording verifier
  • Loading branch information
akarnokd authored Dec 10, 2017
1 parent 34242e1 commit b338ffe
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
8 changes: 8 additions & 0 deletions src/main/java/io/reactivex/Completable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1254,6 +1260,7 @@ public final Completable doOnSubscribe(Consumer<? super Disposable> onSubscribe)
* </dl>
* @param onTerminate the callback to call just before this Completable terminates
* @return the new Completable instance
* @see #doFinally(Action)
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
Expand All @@ -1272,6 +1279,7 @@ public final Completable doOnTerminate(final Action onTerminate) {
* </dl>
* @param onAfterTerminate the callback to call after this Completable terminates
* @return the new Completable instance
* @see #doFinally(Action)
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
Expand Down
36 changes: 26 additions & 10 deletions src/test/java/io/reactivex/JavadocWording.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit b338ffe

Please sign in to comment.