Skip to content

Commit fef520e

Browse files
akarnokdzsxwing
authored andcommitted
1.x: javac- and javadoc-related cleanup in components, part 2 (#3951)
* 1.x: javac- and javadoc-related cleanup in components, part 2 final This PR clears the cast warnings introduced by the need to be JDK 9 compilable. * 1.x: javac- and javadoc-related cleanup in components, part 2 final
1 parent c296d52 commit fef520e

File tree

70 files changed

+289
-56
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+289
-56
lines changed

src/main/java/rx/Notification.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
/**
1919
* An object representing a notification sent to an {@link Observable}.
20+
* @param <T> the actual value type held by the Notification
2021
*/
2122
public final class Notification<T> {
2223

@@ -29,6 +30,7 @@ public final class Notification<T> {
2930
/**
3031
* Creates and returns a {@code Notification} of variety {@code Kind.OnNext}, and assigns it a value.
3132
*
33+
* @param <T> the actual value type held by the Notification
3234
* @param t
3335
* the item to assign to the notification as its value
3436
* @return an {@code OnNext} variety of {@code Notification}
@@ -40,6 +42,7 @@ public static <T> Notification<T> createOnNext(T t) {
4042
/**
4143
* Creates and returns a {@code Notification} of variety {@code Kind.OnError}, and assigns it an exception.
4244
*
45+
* @param <T> the actual value type held by the Notification
4346
* @param e
4447
* the exception to assign to the notification
4548
* @return an {@code OnError} variety of {@code Notification}
@@ -51,6 +54,7 @@ public static <T> Notification<T> createOnError(Throwable e) {
5154
/**
5255
* Creates and returns a {@code Notification} of variety {@code Kind.OnCompleted}.
5356
*
57+
* @param <T> the actual value type held by the Notification
5458
* @return an {@code OnCompleted} variety of {@code Notification}
5559
*/
5660
@SuppressWarnings("unchecked")
@@ -61,7 +65,7 @@ public static <T> Notification<T> createOnCompleted() {
6165
/**
6266
* Creates and returns a {@code Notification} of variety {@code Kind.OnCompleted}.
6367
*
64-
* @warn param "type" undescribed
68+
* @param <T> the actual value type held by the Notification
6569
* @param type
6670
* @return an {@code OnCompleted} variety of {@code Notification}
6771
*/
@@ -151,6 +155,7 @@ public boolean isOnNext() {
151155

152156
/**
153157
* Forwards this notification on to a specified {@link Observer}.
158+
* @param observer the target observer to call onXXX methods on based on the kind of this Notification instance
154159
*/
155160
public void accept(Observer<? super T> observer) {
156161
if (isOnNext()) {

src/main/java/rx/Observable.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ public static <T> Observable<T> amb(Observable<? extends T> o1, Observable<? ext
600600
* Observables by means of the given aggregation function
601601
* @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
602602
*/
603-
@SuppressWarnings("unchecked")
603+
@SuppressWarnings({ "unchecked", "cast" })
604604
public static <T1, T2, R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Func2<? super T1, ? super T2, ? extends R> combineFunction) {
605605
return (Observable<R>)combineLatest(Arrays.asList(o1, o2), Functions.fromFunc(combineFunction));
606606
}
@@ -628,7 +628,7 @@ public static <T1, T2, R> Observable<R> combineLatest(Observable<? extends T1> o
628628
* Observables by means of the given aggregation function
629629
* @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
630630
*/
631-
@SuppressWarnings("unchecked")
631+
@SuppressWarnings({ "unchecked", "cast" })
632632
public static <T1, T2, T3, R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Func3<? super T1, ? super T2, ? super T3, ? extends R> combineFunction) {
633633
return (Observable<R>)combineLatest(Arrays.asList(o1, o2, o3), Functions.fromFunc(combineFunction));
634634
}
@@ -658,7 +658,7 @@ public static <T1, T2, T3, R> Observable<R> combineLatest(Observable<? extends T
658658
* Observables by means of the given aggregation function
659659
* @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
660660
*/
661-
@SuppressWarnings("unchecked")
661+
@SuppressWarnings({ "unchecked", "cast" })
662662
public static <T1, T2, T3, T4, R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4,
663663
Func4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> combineFunction) {
664664
return (Observable<R>)combineLatest(Arrays.asList(o1, o2, o3, o4), Functions.fromFunc(combineFunction));
@@ -691,7 +691,7 @@ public static <T1, T2, T3, T4, R> Observable<R> combineLatest(Observable<? exten
691691
* Observables by means of the given aggregation function
692692
* @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
693693
*/
694-
@SuppressWarnings("unchecked")
694+
@SuppressWarnings({ "unchecked", "cast" })
695695
public static <T1, T2, T3, T4, T5, R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4, Observable<? extends T5> o5,
696696
Func5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> combineFunction) {
697697
return (Observable<R>)combineLatest(Arrays.asList(o1, o2, o3, o4, o5), Functions.fromFunc(combineFunction));
@@ -726,7 +726,7 @@ public static <T1, T2, T3, T4, T5, R> Observable<R> combineLatest(Observable<? e
726726
* Observables by means of the given aggregation function
727727
* @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
728728
*/
729-
@SuppressWarnings("unchecked")
729+
@SuppressWarnings({ "unchecked", "cast" })
730730
public static <T1, T2, T3, T4, T5, T6, R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4, Observable<? extends T5> o5, Observable<? extends T6> o6,
731731
Func6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> combineFunction) {
732732
return (Observable<R>)combineLatest(Arrays.asList(o1, o2, o3, o4, o5, o6), Functions.fromFunc(combineFunction));
@@ -763,7 +763,7 @@ public static <T1, T2, T3, T4, T5, T6, R> Observable<R> combineLatest(Observable
763763
* Observables by means of the given aggregation function
764764
* @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
765765
*/
766-
@SuppressWarnings("unchecked")
766+
@SuppressWarnings({ "unchecked", "cast" })
767767
public static <T1, T2, T3, T4, T5, T6, T7, R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4, Observable<? extends T5> o5, Observable<? extends T6> o6, Observable<? extends T7> o7,
768768
Func7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> combineFunction) {
769769
return (Observable<R>)combineLatest(Arrays.asList(o1, o2, o3, o4, o5, o6, o7), Functions.fromFunc(combineFunction));
@@ -802,7 +802,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, R> Observable<R> combineLatest(Observ
802802
* Observables by means of the given aggregation function
803803
* @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
804804
*/
805-
@SuppressWarnings("unchecked")
805+
@SuppressWarnings({ "unchecked", "cast" })
806806
public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4, Observable<? extends T5> o5, Observable<? extends T6> o6, Observable<? extends T7> o7, Observable<? extends T8> o8,
807807
Func8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> combineFunction) {
808808
return (Observable<R>)combineLatest(Arrays.asList(o1, o2, o3, o4, o5, o6, o7, o8), Functions.fromFunc(combineFunction));
@@ -843,7 +843,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Observable<R> combineLatest(Ob
843843
* Observables by means of the given aggregation function
844844
* @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
845845
*/
846-
@SuppressWarnings("unchecked")
846+
@SuppressWarnings({ "unchecked", "cast" })
847847
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4, Observable<? extends T5> o5, Observable<? extends T6> o6, Observable<? extends T7> o7, Observable<? extends T8> o8,
848848
Observable<? extends T9> o9,
849849
Func9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R> combineFunction) {
@@ -1311,6 +1311,7 @@ public static <T> Observable<T> error(Throwable exception) {
13111311
* @return an Observable that emits the item from the source {@link Future}
13121312
* @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
13131313
*/
1314+
@SuppressWarnings("cast")
13141315
public static <T> Observable<T> from(Future<? extends T> future) {
13151316
return (Observable<T>)create(OnSubscribeToObservableFuture.toObservableFuture(future));
13161317
}
@@ -1342,6 +1343,7 @@ public static <T> Observable<T> from(Future<? extends T> future) {
13421343
* @return an Observable that emits the item from the source {@link Future}
13431344
* @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
13441345
*/
1346+
@SuppressWarnings("cast")
13451347
public static <T> Observable<T> from(Future<? extends T> future, long timeout, TimeUnit unit) {
13461348
return (Observable<T>)create(OnSubscribeToObservableFuture.toObservableFuture(future, timeout, unit));
13471349
}
@@ -1372,6 +1374,7 @@ public static <T> Observable<T> from(Future<? extends T> future, long timeout, T
13721374
*/
13731375
public static <T> Observable<T> from(Future<? extends T> future, Scheduler scheduler) {
13741376
// TODO in a future revision the Scheduler will become important because we'll start polling instead of blocking on the Future
1377+
@SuppressWarnings("cast")
13751378
Observable<T> o = (Observable<T>)create(OnSubscribeToObservableFuture.toObservableFuture(future));
13761379
return o.subscribeOn(scheduler);
13771380
}
@@ -5742,6 +5745,7 @@ public final <R> Observable<R> flatMapIterable(Func1<? super T, ? extends Iterab
57425745
* Observable
57435746
* @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a>
57445747
*/
5748+
@SuppressWarnings("cast")
57455749
public final <U, R> Observable<R> flatMapIterable(Func1<? super T, ? extends Iterable<? extends U>> collectionSelector,
57465750
Func2<? super T, ? super U, ? extends R> resultSelector) {
57475751
return (Observable<R>)flatMap(OperatorMapPair.convertSelector(collectionSelector), resultSelector);
@@ -5777,6 +5781,7 @@ public final <U, R> Observable<R> flatMapIterable(Func1<? super T, ? extends Ite
57775781
* @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a>
57785782
* @since (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
57795783
*/
5784+
@SuppressWarnings("cast")
57805785
@Beta
57815786
public final <U, R> Observable<R> flatMapIterable(Func1<? super T, ? extends Iterable<? extends U>> collectionSelector,
57825787
Func2<? super T, ? super U, ? extends R> resultSelector, int maxConcurrent) {
@@ -6554,6 +6559,7 @@ public final Observable<T> onErrorResumeNext(final Func1<Throwable, ? extends Ob
65546559
* @return the original Observable, with appropriately modified behavior
65556560
* @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
65566561
*/
6562+
@SuppressWarnings("cast")
65576563
public final Observable<T> onErrorResumeNext(final Observable<? extends T> resumeSequence) {
65586564
return lift((Operator<T, T>)OperatorOnErrorResumeNextViaFunction.withOther(resumeSequence));
65596565
}
@@ -6584,6 +6590,7 @@ public final Observable<T> onErrorResumeNext(final Observable<? extends T> resum
65846590
* @return the original Observable with appropriately modified behavior
65856591
* @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
65866592
*/
6593+
@SuppressWarnings("cast")
65876594
public final Observable<T> onErrorReturn(Func1<Throwable, ? extends T> resumeFunction) {
65886595
return lift((Operator<T, T>)OperatorOnErrorResumeNextViaFunction.withSingle(resumeFunction));
65896596
}
@@ -6620,6 +6627,7 @@ public final Observable<T> onErrorReturn(Func1<Throwable, ? extends T> resumeFun
66206627
* @return the original Observable, with appropriately modified behavior
66216628
* @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
66226629
*/
6630+
@SuppressWarnings("cast")
66236631
public final Observable<T> onExceptionResumeNext(final Observable<? extends T> resumeSequence) {
66246632
return lift((Operator<T, T>)OperatorOnErrorResumeNextViaFunction.withException(resumeSequence));
66256633
}
@@ -10327,6 +10335,7 @@ public final <T2, R> Observable<R> zipWith(Iterable<? extends T2> other, Func2<?
1032710335
* and emits the results of {@code zipFunction} applied to these pairs
1032810336
* @see <a href="http://reactivex.io/documentation/operators/zip.html">ReactiveX operators documentation: Zip</a>
1032910337
*/
10338+
@SuppressWarnings("cast")
1033010339
public final <T2, R> Observable<R> zipWith(Observable<? extends T2> other, Func2<? super T, ? super T2, ? extends R> zipFunction) {
1033110340
return (Observable<R>)zip(this, other, zipFunction);
1033210341
}

0 commit comments

Comments
 (0)