@@ -179,6 +179,7 @@ public void maybeDocRefersToMaybeTypes() throws Exception {
179
179
}
180
180
aOrAn (e , m , "Maybe" );
181
181
missingClosingDD (e , m , "Maybe" );
182
+ backpressureMentionedWithoutAnnotation (e , m , "Maybe" );
182
183
}
183
184
}
184
185
@@ -261,6 +262,7 @@ public void flowableDocRefersToFlowableTypes() throws Exception {
261
262
}
262
263
aOrAn (e , m , "Flowable" );
263
264
missingClosingDD (e , m , "Flowable" );
265
+ backpressureMentionedWithoutAnnotation (e , m , "Flowable" );
264
266
}
265
267
}
266
268
@@ -345,6 +347,7 @@ public void observableDocRefersToObservableTypes() throws Exception {
345
347
}
346
348
aOrAn (e , m , "Observable" );
347
349
missingClosingDD (e , m , "Observable" );
350
+ backpressureMentionedWithoutAnnotation (e , m , "Observable" );
348
351
}
349
352
}
350
353
@@ -500,6 +503,7 @@ public void singleDocRefersToSingleTypes() throws Exception {
500
503
501
504
aOrAn (e , m , "Single" );
502
505
missingClosingDD (e , m , "Single" );
506
+ backpressureMentionedWithoutAnnotation (e , m , "Single" );
503
507
}
504
508
}
505
509
@@ -510,62 +514,6 @@ public void singleDocRefersToSingleTypes() throws Exception {
510
514
}
511
515
}
512
516
513
- static void aOrAn (StringBuilder e , RxMethod m , String baseTypeName ) {
514
- aOrAn (e , m , "an" , "Single" , baseTypeName );
515
- aOrAn (e , m , "an" , "Maybe" , baseTypeName );
516
- aOrAn (e , m , "a" , "Observer" , baseTypeName );
517
- aOrAn (e , m , "a" , "Observable" , baseTypeName );
518
- aOrAn (e , m , "an" , "Publisher" , baseTypeName );
519
- aOrAn (e , m , "an" , "Subscriber" , baseTypeName );
520
- aOrAn (e , m , "an" , "Flowable" , baseTypeName );
521
- }
522
-
523
- static void aOrAn (StringBuilder e , RxMethod m , String wrongPre , String word , String baseTypeName ) {
524
- int jdx = 0 ;
525
- for (;;) {
526
- int idx = m .javadoc .indexOf (wrongPre + " " + word , jdx );
527
- if (idx >= 0 ) {
528
- e .append ("java.lang.RuntimeException: a/an typo " )
529
- .append (word )
530
- .append ("\r \n at io.reactivex." )
531
- .append (baseTypeName )
532
- .append (" (" )
533
- .append (baseTypeName )
534
- .append (".java:" ).append (m .javadocLine + lineNumber (m .javadoc , idx ) - 1 ).append (")\r \n \r \n " );
535
- jdx = idx + 6 ;
536
- } else {
537
- break ;
538
- }
539
- }
540
-
541
- }
542
-
543
- static void missingClosingDD (StringBuilder e , RxMethod m , String baseTypeName ) {
544
- int jdx = 0 ;
545
- for (;;) {
546
- int idx1 = m .javadoc .indexOf ("<dd>" , jdx );
547
- int idx2 = m .javadoc .indexOf ("</dd>" , jdx );
548
-
549
- if (idx1 < 0 && idx2 < 0 ) {
550
- break ;
551
- }
552
-
553
- int idx3 = m .javadoc .indexOf ("<dd>" , idx1 + 4 );
554
-
555
- if (idx1 > 0 && idx2 > 0 && (idx3 < 0 || (idx2 < idx3 && idx3 > 0 ))) {
556
- jdx = idx2 + 5 ;
557
- } else {
558
- e .append ("java.lang.RuntimeException: unbalanced <dd></dd> " )
559
- .append ("\r \n at io.reactivex." )
560
- .append (baseTypeName )
561
- .append (" (" )
562
- .append (baseTypeName )
563
- .append (".java:" ).append (m .javadocLine + lineNumber (m .javadoc , idx1 ) - 1 ).append (")\r \n \r \n " );
564
- break ;
565
- }
566
- }
567
- }
568
-
569
517
@ Test
570
518
public void completableDocRefersToCompletableTypes () throws Exception {
571
519
List <RxMethod > list = BaseTypeParser .parse (MaybeNo2Dot0Since .findSource ("Completable" ), "Completable" );
@@ -710,6 +658,7 @@ public void completableDocRefersToCompletableTypes() throws Exception {
710
658
}
711
659
aOrAn (e , m , "Completable" );
712
660
missingClosingDD (e , m , "Completable" );
661
+ backpressureMentionedWithoutAnnotation (e , m , "Completable" );
713
662
}
714
663
}
715
664
@@ -719,4 +668,71 @@ public void completableDocRefersToCompletableTypes() throws Exception {
719
668
fail (e .toString ());
720
669
}
721
670
}
671
+
672
+ static void aOrAn (StringBuilder e , RxMethod m , String baseTypeName ) {
673
+ aOrAn (e , m , "an" , "Single" , baseTypeName );
674
+ aOrAn (e , m , "an" , "Maybe" , baseTypeName );
675
+ aOrAn (e , m , "a" , "Observer" , baseTypeName );
676
+ aOrAn (e , m , "a" , "Observable" , baseTypeName );
677
+ aOrAn (e , m , "an" , "Publisher" , baseTypeName );
678
+ aOrAn (e , m , "an" , "Subscriber" , baseTypeName );
679
+ aOrAn (e , m , "an" , "Flowable" , baseTypeName );
680
+ }
681
+
682
+ static void aOrAn (StringBuilder e , RxMethod m , String wrongPre , String word , String baseTypeName ) {
683
+ int jdx = 0 ;
684
+ for (;;) {
685
+ int idx = m .javadoc .indexOf (wrongPre + " " + word , jdx );
686
+ if (idx >= 0 ) {
687
+ e .append ("java.lang.RuntimeException: a/an typo " )
688
+ .append (word )
689
+ .append ("\r \n at io.reactivex." )
690
+ .append (baseTypeName )
691
+ .append (" (" )
692
+ .append (baseTypeName )
693
+ .append (".java:" ).append (m .javadocLine + lineNumber (m .javadoc , idx ) - 1 ).append (")\r \n \r \n " );
694
+ jdx = idx + 6 ;
695
+ } else {
696
+ break ;
697
+ }
698
+ }
699
+
700
+ }
701
+
702
+ static void missingClosingDD (StringBuilder e , RxMethod m , String baseTypeName ) {
703
+ int jdx = 0 ;
704
+ for (;;) {
705
+ int idx1 = m .javadoc .indexOf ("<dd>" , jdx );
706
+ int idx2 = m .javadoc .indexOf ("</dd>" , jdx );
707
+
708
+ if (idx1 < 0 && idx2 < 0 ) {
709
+ break ;
710
+ }
711
+
712
+ int idx3 = m .javadoc .indexOf ("<dd>" , idx1 + 4 );
713
+
714
+ if (idx1 > 0 && idx2 > 0 && (idx3 < 0 || (idx2 < idx3 && idx3 > 0 ))) {
715
+ jdx = idx2 + 5 ;
716
+ } else {
717
+ e .append ("java.lang.RuntimeException: unbalanced <dd></dd> " )
718
+ .append ("\r \n at io.reactivex." )
719
+ .append (baseTypeName )
720
+ .append (" (" )
721
+ .append (baseTypeName )
722
+ .append (".java:" ).append (m .javadocLine + lineNumber (m .javadoc , idx1 ) - 1 ).append (")\r \n \r \n " );
723
+ break ;
724
+ }
725
+ }
726
+ }
727
+
728
+ static void backpressureMentionedWithoutAnnotation (StringBuilder e , RxMethod m , String baseTypeName ) {
729
+ if (m .backpressureDocLine > 0 && m .backpressureKind == null ) {
730
+ e .append ("java.lang.RuntimeException: backpressure documented but not annotated " )
731
+ .append ("\r \n at io.reactivex." )
732
+ .append (baseTypeName )
733
+ .append (" (" )
734
+ .append (baseTypeName )
735
+ .append (".java:" ).append (m .backpressureDocLine ).append (")\r \n \r \n " );
736
+ }
737
+ }
722
738
}
0 commit comments