1414package io .reactivex ;
1515
1616import java .util .List ;
17+ import java .util .regex .Pattern ;
1718
1819import static org .junit .Assert .*;
1920import 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