Skip to content

3.x: Remove now unnecessary unchecked warning suppressions #6790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/jmh/java/io/reactivex/rxjava3/core/MemoryPerf.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public Object call() throws Exception {
checkMemory(new Callable<Object>() {
@Override
public Object call() throws Exception {
return new io.reactivex.rxjava3.observers.TestObserver<Object>();
return new io.reactivex.rxjava3.observers.TestObserver<>();
}
}, "test-consumer", "Rx2Observable");

Expand Down Expand Up @@ -374,7 +374,7 @@ public Object call() throws Exception {
checkMemory(new Callable<Object>() {
@Override
public Object call() throws Exception {
return new io.reactivex.rxjava3.observers.TestObserver<Object>();
return new io.reactivex.rxjava3.observers.TestObserver<>();
}
}, "test-consumer", "Rx2Flowable");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static class InputForMergeN {
@Setup
public void setup(final Blackhole bh) {
this.bh = bh;
observables = new ArrayList<Flowable<Integer>>();
observables = new ArrayList<>();
for (int i = 0; i < size; i++) {
observables.add(Flowable.just(i));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public void accept(Object o, Integer t) {
assertFalse(added.get());
}

@SuppressWarnings("unchecked")
@Test
public void collectIntoFlowable() {
Flowable.just(1, 1, 1, 1, 2)
Expand Down Expand Up @@ -316,7 +315,6 @@ public void accept(Object o, Integer t) {
assertFalse(added.get());
}

@SuppressWarnings("unchecked")
@Test
public void collectInto() {
Flowable.just(1, 1, 1, 1, 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public void concatWithIterableOfFlowable() {
Flowable<String> f2 = Flowable.just("three", "four");
Flowable<String> f3 = Flowable.just("five", "six");

@SuppressWarnings("unchecked")
Iterable<Flowable<String>> is = Arrays.asList(f1, f2, f3);

List<String> values = Flowable.concat(Flowable.fromIterable(is)).toList().blockingGet();
Expand Down
16 changes: 0 additions & 16 deletions src/test/java/io/reactivex/rxjava3/flowable/FlowableNullTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public void ambVarargsNull() {
Flowable.ambArray((Publisher<Object>[])null);
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void ambVarargsOneIsNull() {
Flowable.ambArray(Flowable.never(), null).blockingLast();
Expand All @@ -68,7 +67,6 @@ public Iterator<Publisher<Object>> iterator() {
}).test().assertError(NullPointerException.class);
}

@SuppressWarnings("unchecked")
@Test
public void ambIterableOneIsNull() {
Flowable.amb(Arrays.asList(Flowable.never(), null))
Expand Down Expand Up @@ -101,7 +99,6 @@ public Object apply(Object[] v) {
}).blockingLast();
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestIterableOneIsNull() {
Flowable.combineLatestDelayError(Arrays.asList(Flowable.never(), null), new Function<Object[], Object>() {
Expand All @@ -112,13 +109,11 @@ public Object apply(Object[] v) {
}).blockingLast();
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestIterableFunctionNull() {
Flowable.combineLatestDelayError(Arrays.asList(just1), null);
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestIterableFunctionReturnsNull() {
Flowable.combineLatestDelayError(Arrays.asList(just1), new Function<Object[], Object>() {
Expand All @@ -144,7 +139,6 @@ public Iterator<Publisher<Object>> iterator() {
}).blockingLast();
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void concatIterableOneIsNull() {
Flowable.concat(Arrays.asList(just1, null)).blockingLast();
Expand All @@ -161,7 +155,6 @@ public void concatArrayNull() {
Flowable.concatArray((Publisher<Object>[])null);
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void concatArrayOneIsNull() {
Flowable.concatArray(just1, null).blockingLast();
Expand Down Expand Up @@ -480,7 +473,6 @@ public Iterator<Publisher<Object>> iterator() {
}, 128, 128).blockingLast();
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void mergeIterableOneIsNull() {
Flowable.merge(Arrays.asList(just1, null), 128, 128).blockingLast();
Expand Down Expand Up @@ -512,7 +504,6 @@ public Iterator<Publisher<Object>> iterator() {
}, 128, 128).blockingLast();
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void mergeDelayErrorIterableOneIsNull() {
Flowable.mergeDelayError(Arrays.asList(just1, null), 128, 128).blockingLast();
Expand Down Expand Up @@ -634,13 +625,11 @@ public Object apply(Object[] v) {
}).blockingLast();
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void zipIterableFunctionNull() {
Flowable.zip(Arrays.asList(just1, just1), null);
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void zipIterableFunctionReturnsNull() {
Flowable.zip(Arrays.asList(just1, just1), new Function<Object[], Object>() {
Expand Down Expand Up @@ -676,13 +665,11 @@ public Object apply(Object[] a) {
}, true, 128).blockingLast();
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void zipIterable2FunctionNull() {
Flowable.zip(Arrays.asList(just1, just1), null, true, 128);
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void zipIterable2FunctionReturnsNull() {
Flowable.zip(Arrays.asList(just1, just1), new Function<Object[], Object>() {
Expand Down Expand Up @@ -2679,7 +2666,6 @@ public void unsafeSubscribeNull() {
just1.subscribe((FlowableSubscriber<Object>)null);
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorIterableFunctionReturnsNull() {
Flowable.combineLatestDelayError(Arrays.asList(just1), new Function<Object[], Object>() {
Expand All @@ -2690,7 +2676,6 @@ public Object apply(Object[] v) {
}, 128).blockingLast();
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorIterableFunctionNull() {
Flowable.combineLatestDelayError(Arrays.asList(just1), null, 128);
Expand Down Expand Up @@ -2731,7 +2716,6 @@ public void doOnDisposeNull() {
just1.doOnCancel(null);
}

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorIterableOneIsNull() {
Flowable.combineLatestDelayError(Arrays.asList(Flowable.never(), null), new Function<Object[], Object>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,6 @@ public void toObservableError() {

@Test
public void zipIterableObject() {
@SuppressWarnings("unchecked")
final List<Flowable<Integer>> flowables = Arrays.asList(Flowable.just(1, 2, 3), Flowable.just(1, 2, 3));
Flowable.zip(flowables, new Function<Object[], Object>() {
@Override
Expand All @@ -1090,7 +1089,6 @@ public Object apply(Object[] o) throws Exception {

@Test
public void combineLatestObject() {
@SuppressWarnings("unchecked")
final List<Flowable<Integer>> flowables = Arrays.asList(Flowable.just(1, 2, 3), Flowable.just(1, 2, 3));
Flowable.combineLatest(flowables, new Function<Object[], Object>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
public class CompletableMaterializeTest extends RxJavaTest {

@Test
@SuppressWarnings("unchecked")
public void error() {
TestException ex = new TestException();
Completable.error(ex)
Expand All @@ -34,7 +33,6 @@ public void error() {
}

@Test
@SuppressWarnings("unchecked")
public void empty() {
Completable.complete()
.materialize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ public void amb() {
Flowable<String> flowable3 = createFlowable(new String[] {
"3", "33", "333", "3333" }, 3000, null);

@SuppressWarnings("unchecked")
Flowable<String> f = Flowable.ambArray(flowable1,
flowable2, flowable3);

Expand Down Expand Up @@ -131,7 +130,6 @@ public void amb2() {
Flowable<String> flowable3 = createFlowable(new String[] {},
3000, new IOException("fake exception"));

@SuppressWarnings("unchecked")
Flowable<String> f = Flowable.ambArray(flowable1,
flowable2, flowable3);

Expand All @@ -158,7 +156,6 @@ public void amb3() {
Flowable<String> flowable3 = createFlowable(new String[] {
"3" }, 3000, null);

@SuppressWarnings("unchecked")
Flowable<String> f = Flowable.ambArray(flowable1,
flowable2, flowable3);

Expand All @@ -171,7 +168,6 @@ public void amb3() {
inOrder.verifyNoMoreInteractions();
}

@SuppressWarnings("unchecked")
@Test
public void producerRequestThroughAmb() {
TestSubscriber<Integer> ts = new TestSubscriber<>(0L);
Expand Down Expand Up @@ -237,7 +233,6 @@ public void backpressure() {
assertEquals(Flowable.bufferSize() * 2, ts.values().size());
}

@SuppressWarnings("unchecked")
@Test
public void subscriptionOnlyHappensOnce() throws InterruptedException {
final AtomicLong count = new AtomicLong();
Expand All @@ -262,7 +257,6 @@ public void accept(Subscription s) {
assertEquals(2, count.get());
}

@SuppressWarnings("unchecked")
@Test
public void secondaryRequestsPropagatedToChildren() throws InterruptedException {
//this aync stream should emit first
Expand Down Expand Up @@ -302,7 +296,6 @@ public void accept(Integer t) {
assertEquals(1, result);
}

@SuppressWarnings("unchecked")
@Test
public void ambCancelsOthers() {
PublishProcessor<Integer> source1 = PublishProcessor.create();
Expand Down Expand Up @@ -347,7 +340,6 @@ public void multipleUse() {
ts2.assertNoErrors();
}

@SuppressWarnings("unchecked")
@Test
public void ambIterable() {
PublishProcessor<Integer> pp1 = PublishProcessor.create();
Expand All @@ -370,7 +362,6 @@ public void ambIterable() {
ts.assertComplete();
}

@SuppressWarnings("unchecked")
@Test
public void ambIterable2() {
PublishProcessor<Integer> pp1 = PublishProcessor.create();
Expand All @@ -393,19 +384,16 @@ public void ambIterable2() {
ts.assertComplete();
}

@SuppressWarnings("unchecked")
@Test
public void ambArrayEmpty() {
assertSame(Flowable.empty(), Flowable.ambArray());
}

@SuppressWarnings("unchecked")
@Test
public void ambArraySingleElement() {
assertSame(Flowable.never(), Flowable.ambArray(Flowable.never()));
}

@SuppressWarnings("unchecked")
@Test
public void disposed() {
TestHelper.checkDisposed(Flowable.ambArray(Flowable.never(), Flowable.never()));
Expand Down Expand Up @@ -442,7 +430,6 @@ public void onNextRace() {
final PublishProcessor<Integer> pp1 = PublishProcessor.create();
final PublishProcessor<Integer> pp2 = PublishProcessor.create();

@SuppressWarnings("unchecked")
TestSubscriberEx<Integer> ts = Flowable.ambArray(pp1, pp2).to(TestHelper.<Integer>testConsumer());

Runnable r1 = new Runnable() {
Expand Down Expand Up @@ -471,7 +458,6 @@ public void onCompleteRace() {
final PublishProcessor<Integer> pp1 = PublishProcessor.create();
final PublishProcessor<Integer> pp2 = PublishProcessor.create();

@SuppressWarnings("unchecked")
TestSubscriber<Integer> ts = Flowable.ambArray(pp1, pp2).test();

Runnable r1 = new Runnable() {
Expand Down Expand Up @@ -499,7 +485,6 @@ public void onErrorRace() {
final PublishProcessor<Integer> pp1 = PublishProcessor.create();
final PublishProcessor<Integer> pp2 = PublishProcessor.create();

@SuppressWarnings("unchecked")
TestSubscriber<Integer> ts = Flowable.ambArray(pp1, pp2).test();

final Throwable ex = new TestException();
Expand Down Expand Up @@ -531,7 +516,6 @@ public void run() {
}
}

@SuppressWarnings("unchecked")
@Test
public void nullIterableElement() {
Flowable.amb(Arrays.asList(Flowable.never(), null, Flowable.never()))
Expand Down Expand Up @@ -575,21 +559,18 @@ public void ambWithOrder() {
Flowable.just(1).ambWith(error).test().assertValue(1).assertComplete();
}

@SuppressWarnings("unchecked")
@Test
public void ambIterableOrder() {
Flowable<Integer> error = Flowable.error(new RuntimeException());
Flowable.amb(Arrays.asList(Flowable.just(1), error)).test().assertValue(1).assertComplete();
}

@SuppressWarnings("unchecked")
@Test
public void ambArrayOrder() {
Flowable<Integer> error = Flowable.error(new RuntimeException());
Flowable.ambArray(Flowable.just(1), error).test().assertValue(1).assertComplete();
}

@SuppressWarnings("unchecked")
@Test
public void noWinnerSuccessDispose() throws Exception {
for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) {
Expand All @@ -615,7 +596,6 @@ public void accept(Object v) throws Exception {
}
}

@SuppressWarnings("unchecked")
@Test
public void noWinnerErrorDispose() throws Exception {
final TestException ex = new TestException();
Expand All @@ -642,7 +622,6 @@ public void accept(Throwable e) throws Exception {
}
}

@SuppressWarnings("unchecked")
@Test
public void noWinnerCompleteDispose() throws Exception {
for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) {
Expand All @@ -668,7 +647,6 @@ public void run() throws Exception {
}
}

@SuppressWarnings("unchecked")
@Test
public void publishersInIterable() {
Publisher<Integer> source = new Publisher<Integer>() {
Expand Down
Loading