14
14
package io .reactivex ;
15
15
16
16
import java .util .List ;
17
+ import java .util .regex .Pattern ;
17
18
18
19
import static org .junit .Assert .*;
19
20
import org .junit .Test ;
@@ -695,8 +696,11 @@ public void completableDocRefersToCompletableTypes() throws Exception {
695
696
int idx = m .javadoc .indexOf ("Flowable" , jdx );
696
697
if (idx >= 0 ) {
697
698
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
+ }
700
704
}
701
705
jdx = idx + 6 ;
702
706
} else {
@@ -708,8 +712,11 @@ public void completableDocRefersToCompletableTypes() throws Exception {
708
712
int idx = m .javadoc .indexOf ("Single" , jdx );
709
713
if (idx >= 0 ) {
710
714
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
+ }
713
720
}
714
721
jdx = idx + 6 ;
715
722
} else {
@@ -721,8 +728,11 @@ public void completableDocRefersToCompletableTypes() throws Exception {
721
728
int idx = m .javadoc .indexOf ("SingleSource" , jdx );
722
729
if (idx >= 0 ) {
723
730
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
+ }
726
736
}
727
737
jdx = idx + 6 ;
728
738
} else {
@@ -734,8 +744,11 @@ public void completableDocRefersToCompletableTypes() throws Exception {
734
744
int idx = m .javadoc .indexOf (" Observable" , jdx );
735
745
if (idx >= 0 ) {
736
746
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
+ }
739
752
}
740
753
jdx = idx + 6 ;
741
754
} else {
@@ -747,8 +760,11 @@ public void completableDocRefersToCompletableTypes() throws Exception {
747
760
int idx = m .javadoc .indexOf ("ObservableSource" , jdx );
748
761
if (idx >= 0 ) {
749
762
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
+ }
752
768
}
753
769
jdx = idx + 6 ;
754
770
} else {
0 commit comments