Skip to content

Commit b338ffe

Browse files
authored
2.x: add a couple of @see to Completable (#5758)
* 2.x: add a couple of @see to Completable * Enable @see in JavadocWording verifier
1 parent 34242e1 commit b338ffe

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

src/main/java/io/reactivex/Completable.java

+8
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,10 @@ public final Completable compose(CompletableTransformer transformer) {
10551055
* @param other the other Completable, not null
10561056
* @return the new Completable which subscribes to this and then the other Completable
10571057
* @throws NullPointerException if other is null
1058+
* @see #andThen(MaybeSource)
1059+
* @see #andThen(ObservableSource)
1060+
* @see #andThen(SingleSource)
1061+
* @see #andThen(Publisher)
10581062
*/
10591063
@CheckReturnValue
10601064
@SchedulerSupport(SchedulerSupport.NONE)
@@ -1130,6 +1134,7 @@ public final Completable delay(final long delay, final TimeUnit unit, final Sche
11301134
* @param onComplete the callback to call when this emits an onComplete event
11311135
* @return the new Completable instance
11321136
* @throws NullPointerException if onComplete is null
1137+
* @see #doFinally(Action)
11331138
*/
11341139
@CheckReturnValue
11351140
@SchedulerSupport(SchedulerSupport.NONE)
@@ -1167,6 +1172,7 @@ public final Completable doOnDispose(Action onDispose) {
11671172
* @param onError the error callback
11681173
* @return the new Completable instance
11691174
* @throws NullPointerException if onError is null
1175+
* @see #doFinally(Action)
11701176
*/
11711177
@CheckReturnValue
11721178
@SchedulerSupport(SchedulerSupport.NONE)
@@ -1254,6 +1260,7 @@ public final Completable doOnSubscribe(Consumer<? super Disposable> onSubscribe)
12541260
* </dl>
12551261
* @param onTerminate the callback to call just before this Completable terminates
12561262
* @return the new Completable instance
1263+
* @see #doFinally(Action)
12571264
*/
12581265
@CheckReturnValue
12591266
@SchedulerSupport(SchedulerSupport.NONE)
@@ -1272,6 +1279,7 @@ public final Completable doOnTerminate(final Action onTerminate) {
12721279
* </dl>
12731280
* @param onAfterTerminate the callback to call after this Completable terminates
12741281
* @return the new Completable instance
1282+
* @see #doFinally(Action)
12751283
*/
12761284
@CheckReturnValue
12771285
@SchedulerSupport(SchedulerSupport.NONE)

src/test/java/io/reactivex/JavadocWording.java

+26-10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package io.reactivex;
1515

1616
import java.util.List;
17+
import java.util.regex.Pattern;
1718

1819
import static org.junit.Assert.*;
1920
import org.junit.Test;
@@ -695,8 +696,11 @@ public void completableDocRefersToCompletableTypes() throws Exception {
695696
int idx = m.javadoc.indexOf("Flowable", jdx);
696697
if (idx >= 0) {
697698
if (!m.signature.contains("Flowable")) {
698-
e.append("java.lang.RuntimeException: Completable doc mentions Flowable but not in the signature\r\n at io.reactivex.")
699-
.append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
699+
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Flowable");
700+
if (!p.matcher(m.javadoc).find()) {
701+
e.append("java.lang.RuntimeException: Completable doc mentions Flowable but not in the signature\r\n at io.reactivex.")
702+
.append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
703+
}
700704
}
701705
jdx = idx + 6;
702706
} else {
@@ -708,8 +712,11 @@ public void completableDocRefersToCompletableTypes() throws Exception {
708712
int idx = m.javadoc.indexOf("Single", jdx);
709713
if (idx >= 0) {
710714
if (!m.signature.contains("Single")) {
711-
e.append("java.lang.RuntimeException: Completable doc mentions Single but not in the signature\r\n at io.reactivex.")
712-
.append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
715+
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Single");
716+
if (!p.matcher(m.javadoc).find()) {
717+
e.append("java.lang.RuntimeException: Completable doc mentions Single but not in the signature\r\n at io.reactivex.")
718+
.append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
719+
}
713720
}
714721
jdx = idx + 6;
715722
} else {
@@ -721,8 +728,11 @@ public void completableDocRefersToCompletableTypes() throws Exception {
721728
int idx = m.javadoc.indexOf("SingleSource", jdx);
722729
if (idx >= 0) {
723730
if (!m.signature.contains("SingleSource")) {
724-
e.append("java.lang.RuntimeException: Completable doc mentions SingleSource but not in the signature\r\n at io.reactivex.")
725-
.append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
731+
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*SingleSource");
732+
if (!p.matcher(m.javadoc).find()) {
733+
e.append("java.lang.RuntimeException: Completable doc mentions SingleSource but not in the signature\r\n at io.reactivex.")
734+
.append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
735+
}
726736
}
727737
jdx = idx + 6;
728738
} else {
@@ -734,8 +744,11 @@ public void completableDocRefersToCompletableTypes() throws Exception {
734744
int idx = m.javadoc.indexOf(" Observable", jdx);
735745
if (idx >= 0) {
736746
if (!m.signature.contains("Observable")) {
737-
e.append("java.lang.RuntimeException: Completable doc mentions Observable but not in the signature\r\n at io.reactivex.")
738-
.append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
747+
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Observable");
748+
if (!p.matcher(m.javadoc).find()) {
749+
e.append("java.lang.RuntimeException: Completable doc mentions Observable but not in the signature\r\n at io.reactivex.")
750+
.append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
751+
}
739752
}
740753
jdx = idx + 6;
741754
} else {
@@ -747,8 +760,11 @@ public void completableDocRefersToCompletableTypes() throws Exception {
747760
int idx = m.javadoc.indexOf("ObservableSource", jdx);
748761
if (idx >= 0) {
749762
if (!m.signature.contains("ObservableSource")) {
750-
e.append("java.lang.RuntimeException: Completable doc mentions ObservableSource but not in the signature\r\n at io.reactivex.")
751-
.append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
763+
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*ObservableSource");
764+
if (!p.matcher(m.javadoc).find()) {
765+
e.append("java.lang.RuntimeException: Completable doc mentions ObservableSource but not in the signature\r\n at io.reactivex.")
766+
.append("Completable (Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
767+
}
752768
}
753769
jdx = idx + 6;
754770
} else {

0 commit comments

Comments
 (0)