Skip to content

Commit fedb543

Browse files
authored
2.x: fix compilation errors when using Java 8 (#4893)
* Fix Java 8 compilation problems * Suppress warnings for java 6
1 parent e2e70d2 commit fedb543

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

src/main/java/io/reactivex/Flowable.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,12 +1886,13 @@ public static <T> Flowable<T> fromFuture(Future<? extends T> future, long timeou
18861886
* @return a Flowable that emits the item from the source {@link Future}
18871887
* @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
18881888
*/
1889+
@SuppressWarnings({ "unchecked", "cast" })
18891890
@CheckReturnValue
18901891
@BackpressureSupport(BackpressureKind.FULL)
18911892
@SchedulerSupport(SchedulerSupport.CUSTOM)
18921893
public static <T> Flowable<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit, Scheduler scheduler) {
18931894
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
1894-
return fromFuture(future, timeout, unit).subscribeOn(scheduler);
1895+
return fromFuture((Future<T>)future, timeout, unit).subscribeOn(scheduler);
18951896
}
18961897

18971898
/**
@@ -1923,12 +1924,13 @@ public static <T> Flowable<T> fromFuture(Future<? extends T> future, long timeou
19231924
* @return a Flowable that emits the item from the source {@link Future}
19241925
* @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
19251926
*/
1927+
@SuppressWarnings({ "cast", "unchecked" })
19261928
@CheckReturnValue
19271929
@BackpressureSupport(BackpressureKind.FULL)
19281930
@SchedulerSupport(SchedulerSupport.CUSTOM)
19291931
public static <T> Flowable<T> fromFuture(Future<? extends T> future, Scheduler scheduler) {
19301932
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
1931-
return fromFuture(future).subscribeOn(scheduler);
1933+
return fromFuture((Future<T>)future).subscribeOn(scheduler);
19321934
}
19331935

19341936
/**
@@ -4145,13 +4147,14 @@ public static <T, R> Flowable<R> zip(Iterable<? extends Publisher<? extends T>>
41454147
* @return a Flowable that emits the zipped results
41464148
* @see <a href="http://reactivex.io/documentation/operators/zip.html">ReactiveX operators documentation: Zip</a>
41474149
*/
4150+
@SuppressWarnings({ "rawtypes", "unchecked", "cast" })
41484151
@CheckReturnValue
41494152
@BackpressureSupport(BackpressureKind.FULL)
41504153
@SchedulerSupport(SchedulerSupport.NONE)
41514154
public static <T, R> Flowable<R> zip(Publisher<? extends Publisher<? extends T>> sources,
41524155
final Function<? super Object[], ? extends R> zipper) {
41534156
ObjectHelper.requireNonNull(zipper, "zipper is null");
4154-
return fromPublisher(sources).toList().flatMapPublisher(FlowableInternalHelper.<T, R>zipIterable(zipper));
4157+
return fromPublisher(sources).toList().flatMapPublisher((Function)FlowableInternalHelper.<T, R>zipIterable(zipper));
41554158
}
41564159

41574160
/**

src/test/java/io/reactivex/internal/operators/flowable/FlowableGroupByTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,10 +1638,10 @@ public void accept(GroupedFlowable<Integer, Integer> g) {
16381638
@Test
16391639
public void keySelectorAndDelayError() {
16401640
Flowable.just(1).concatWith(Flowable.<Integer>error(new TestException()))
1641-
.groupBy(Functions.identity(), true)
1642-
.flatMap(new Function<GroupedFlowable<Object, Integer>, Flowable<Integer>>() {
1641+
.groupBy(Functions.<Integer>identity(), true)
1642+
.flatMap(new Function<GroupedFlowable<Integer, Integer>, Flowable<Integer>>() {
16431643
@Override
1644-
public Flowable<Integer> apply(GroupedFlowable<Object, Integer> g) throws Exception {
1644+
public Flowable<Integer> apply(GroupedFlowable<Integer, Integer> g) throws Exception {
16451645
return g;
16461646
}
16471647
})
@@ -1652,10 +1652,10 @@ public Flowable<Integer> apply(GroupedFlowable<Object, Integer> g) throws Except
16521652
@Test
16531653
public void keyAndValueSelectorAndDelayError() {
16541654
Flowable.just(1).concatWith(Flowable.<Integer>error(new TestException()))
1655-
.groupBy(Functions.identity(), Functions.<Integer>identity(), true)
1656-
.flatMap(new Function<GroupedFlowable<Object, Integer>, Flowable<Integer>>() {
1655+
.groupBy(Functions.<Integer>identity(), Functions.<Integer>identity(), true)
1656+
.flatMap(new Function<GroupedFlowable<Integer, Integer>, Flowable<Integer>>() {
16571657
@Override
1658-
public Flowable<Integer> apply(GroupedFlowable<Object, Integer> g) throws Exception {
1658+
public Flowable<Integer> apply(GroupedFlowable<Integer, Integer> g) throws Exception {
16591659
return g;
16601660
}
16611661
})

src/test/java/io/reactivex/internal/operators/observable/ObservableGroupByTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,10 +1448,10 @@ public Integer apply(Integer i) {
14481448
@Test
14491449
public void keySelectorAndDelayError() {
14501450
Observable.just(1).concatWith(Observable.<Integer>error(new TestException()))
1451-
.groupBy(Functions.identity(), true)
1452-
.flatMap(new Function<GroupedObservable<Object, Integer>, ObservableSource<Integer>>() {
1451+
.groupBy(Functions.<Integer>identity(), true)
1452+
.flatMap(new Function<GroupedObservable<Integer, Integer>, ObservableSource<Integer>>() {
14531453
@Override
1454-
public ObservableSource<Integer> apply(GroupedObservable<Object, Integer> g) throws Exception {
1454+
public ObservableSource<Integer> apply(GroupedObservable<Integer, Integer> g) throws Exception {
14551455
return g;
14561456
}
14571457
})
@@ -1462,10 +1462,10 @@ public ObservableSource<Integer> apply(GroupedObservable<Object, Integer> g) thr
14621462
@Test
14631463
public void keyAndValueSelectorAndDelayError() {
14641464
Observable.just(1).concatWith(Observable.<Integer>error(new TestException()))
1465-
.groupBy(Functions.identity(), Functions.<Integer>identity(), true)
1466-
.flatMap(new Function<GroupedObservable<Object, Integer>, ObservableSource<Integer>>() {
1465+
.groupBy(Functions.<Integer>identity(), Functions.<Integer>identity(), true)
1466+
.flatMap(new Function<GroupedObservable<Integer, Integer>, ObservableSource<Integer>>() {
14671467
@Override
1468-
public ObservableSource<Integer> apply(GroupedObservable<Object, Integer> g) throws Exception {
1468+
public ObservableSource<Integer> apply(GroupedObservable<Integer, Integer> g) throws Exception {
14691469
return g;
14701470
}
14711471
})

0 commit comments

Comments
 (0)