Skip to content

Commit 0b92c6f

Browse files
authored
3.x: Remove now unnecessary unchecked warning suppressions (#6790)
1 parent 0bd2a01 commit 0b92c6f

File tree

73 files changed

+12
-388
lines changed

Some content is hidden

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

73 files changed

+12
-388
lines changed

src/jmh/java/io/reactivex/rxjava3/core/MemoryPerf.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public Object call() throws Exception {
184184
checkMemory(new Callable<Object>() {
185185
@Override
186186
public Object call() throws Exception {
187-
return new io.reactivex.rxjava3.observers.TestObserver<Object>();
187+
return new io.reactivex.rxjava3.observers.TestObserver<>();
188188
}
189189
}, "test-consumer", "Rx2Observable");
190190

@@ -374,7 +374,7 @@ public Object call() throws Exception {
374374
checkMemory(new Callable<Object>() {
375375
@Override
376376
public Object call() throws Exception {
377-
return new io.reactivex.rxjava3.observers.TestObserver<Object>();
377+
return new io.reactivex.rxjava3.observers.TestObserver<>();
378378
}
379379
}, "test-consumer", "Rx2Flowable");
380380

src/jmh/java/io/reactivex/rxjava3/core/OperatorMergePerf.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public static class InputForMergeN {
134134
@Setup
135135
public void setup(final Blackhole bh) {
136136
this.bh = bh;
137-
observables = new ArrayList<Flowable<Integer>>();
137+
observables = new ArrayList<>();
138138
for (int i = 0; i < size; i++) {
139139
observables.add(Flowable.just(i));
140140
}

src/test/java/io/reactivex/rxjava3/flowable/FlowableCollectTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ public void accept(Object o, Integer t) {
167167
assertFalse(added.get());
168168
}
169169

170-
@SuppressWarnings("unchecked")
171170
@Test
172171
public void collectIntoFlowable() {
173172
Flowable.just(1, 1, 1, 1, 2)
@@ -316,7 +315,6 @@ public void accept(Object o, Integer t) {
316315
assertFalse(added.get());
317316
}
318317

319-
@SuppressWarnings("unchecked")
320318
@Test
321319
public void collectInto() {
322320
Flowable.just(1, 1, 1, 1, 2)

src/test/java/io/reactivex/rxjava3/flowable/FlowableConcatTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public void concatWithIterableOfFlowable() {
6161
Flowable<String> f2 = Flowable.just("three", "four");
6262
Flowable<String> f3 = Flowable.just("five", "six");
6363

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

6766
List<String> values = Flowable.concat(Flowable.fromIterable(is)).toList().blockingGet();

src/test/java/io/reactivex/rxjava3/flowable/FlowableNullTests.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public void ambVarargsNull() {
4747
Flowable.ambArray((Publisher<Object>[])null);
4848
}
4949

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

71-
@SuppressWarnings("unchecked")
7270
@Test
7371
public void ambIterableOneIsNull() {
7472
Flowable.amb(Arrays.asList(Flowable.never(), null))
@@ -101,7 +99,6 @@ public Object apply(Object[] v) {
10199
}).blockingLast();
102100
}
103101

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

115-
@SuppressWarnings("unchecked")
116112
@Test(expected = NullPointerException.class)
117113
public void combineLatestIterableFunctionNull() {
118114
Flowable.combineLatestDelayError(Arrays.asList(just1), null);
119115
}
120116

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

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

164-
@SuppressWarnings("unchecked")
165158
@Test(expected = NullPointerException.class)
166159
public void concatArrayOneIsNull() {
167160
Flowable.concatArray(just1, null).blockingLast();
@@ -480,7 +473,6 @@ public Iterator<Publisher<Object>> iterator() {
480473
}, 128, 128).blockingLast();
481474
}
482475

483-
@SuppressWarnings("unchecked")
484476
@Test(expected = NullPointerException.class)
485477
public void mergeIterableOneIsNull() {
486478
Flowable.merge(Arrays.asList(just1, null), 128, 128).blockingLast();
@@ -512,7 +504,6 @@ public Iterator<Publisher<Object>> iterator() {
512504
}, 128, 128).blockingLast();
513505
}
514506

515-
@SuppressWarnings("unchecked")
516507
@Test(expected = NullPointerException.class)
517508
public void mergeDelayErrorIterableOneIsNull() {
518509
Flowable.mergeDelayError(Arrays.asList(just1, null), 128, 128).blockingLast();
@@ -634,13 +625,11 @@ public Object apply(Object[] v) {
634625
}).blockingLast();
635626
}
636627

637-
@SuppressWarnings("unchecked")
638628
@Test(expected = NullPointerException.class)
639629
public void zipIterableFunctionNull() {
640630
Flowable.zip(Arrays.asList(just1, just1), null);
641631
}
642632

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

679-
@SuppressWarnings("unchecked")
680668
@Test(expected = NullPointerException.class)
681669
public void zipIterable2FunctionNull() {
682670
Flowable.zip(Arrays.asList(just1, just1), null, true, 128);
683671
}
684672

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

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

2693-
@SuppressWarnings("unchecked")
26942679
@Test(expected = NullPointerException.class)
26952680
public void combineLatestDelayErrorIterableFunctionNull() {
26962681
Flowable.combineLatestDelayError(Arrays.asList(just1), null, 128);
@@ -2731,7 +2716,6 @@ public void doOnDisposeNull() {
27312716
just1.doOnCancel(null);
27322717
}
27332718

2734-
@SuppressWarnings("unchecked")
27352719
@Test(expected = NullPointerException.class)
27362720
public void combineLatestDelayErrorIterableOneIsNull() {
27372721
Flowable.combineLatestDelayError(Arrays.asList(Flowable.never(), null), new Function<Object[], Object>() {

src/test/java/io/reactivex/rxjava3/flowable/FlowableTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,6 @@ public void toObservableError() {
10741074

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

10911090
@Test
10921091
public void combineLatestObject() {
1093-
@SuppressWarnings("unchecked")
10941092
final List<Flowable<Integer>> flowables = Arrays.asList(Flowable.just(1, 2, 3), Flowable.just(1, 2, 3));
10951093
Flowable.combineLatest(flowables, new Function<Object[], Object>() {
10961094
@Override

src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterializeTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
public class CompletableMaterializeTest extends RxJavaTest {
2525

2626
@Test
27-
@SuppressWarnings("unchecked")
2827
public void error() {
2928
TestException ex = new TestException();
3029
Completable.error(ex)
@@ -34,7 +33,6 @@ public void error() {
3433
}
3534

3635
@Test
37-
@SuppressWarnings("unchecked")
3836
public void empty() {
3937
Completable.complete()
4038
.materialize()

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmbTest.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public void amb() {
102102
Flowable<String> flowable3 = createFlowable(new String[] {
103103
"3", "33", "333", "3333" }, 3000, null);
104104

105-
@SuppressWarnings("unchecked")
106105
Flowable<String> f = Flowable.ambArray(flowable1,
107106
flowable2, flowable3);
108107

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

134-
@SuppressWarnings("unchecked")
135133
Flowable<String> f = Flowable.ambArray(flowable1,
136134
flowable2, flowable3);
137135

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

161-
@SuppressWarnings("unchecked")
162159
Flowable<String> f = Flowable.ambArray(flowable1,
163160
flowable2, flowable3);
164161

@@ -171,7 +168,6 @@ public void amb3() {
171168
inOrder.verifyNoMoreInteractions();
172169
}
173170

174-
@SuppressWarnings("unchecked")
175171
@Test
176172
public void producerRequestThroughAmb() {
177173
TestSubscriber<Integer> ts = new TestSubscriber<>(0L);
@@ -237,7 +233,6 @@ public void backpressure() {
237233
assertEquals(Flowable.bufferSize() * 2, ts.values().size());
238234
}
239235

240-
@SuppressWarnings("unchecked")
241236
@Test
242237
public void subscriptionOnlyHappensOnce() throws InterruptedException {
243238
final AtomicLong count = new AtomicLong();
@@ -262,7 +257,6 @@ public void accept(Subscription s) {
262257
assertEquals(2, count.get());
263258
}
264259

265-
@SuppressWarnings("unchecked")
266260
@Test
267261
public void secondaryRequestsPropagatedToChildren() throws InterruptedException {
268262
//this aync stream should emit first
@@ -302,7 +296,6 @@ public void accept(Integer t) {
302296
assertEquals(1, result);
303297
}
304298

305-
@SuppressWarnings("unchecked")
306299
@Test
307300
public void ambCancelsOthers() {
308301
PublishProcessor<Integer> source1 = PublishProcessor.create();
@@ -347,7 +340,6 @@ public void multipleUse() {
347340
ts2.assertNoErrors();
348341
}
349342

350-
@SuppressWarnings("unchecked")
351343
@Test
352344
public void ambIterable() {
353345
PublishProcessor<Integer> pp1 = PublishProcessor.create();
@@ -370,7 +362,6 @@ public void ambIterable() {
370362
ts.assertComplete();
371363
}
372364

373-
@SuppressWarnings("unchecked")
374365
@Test
375366
public void ambIterable2() {
376367
PublishProcessor<Integer> pp1 = PublishProcessor.create();
@@ -393,19 +384,16 @@ public void ambIterable2() {
393384
ts.assertComplete();
394385
}
395386

396-
@SuppressWarnings("unchecked")
397387
@Test
398388
public void ambArrayEmpty() {
399389
assertSame(Flowable.empty(), Flowable.ambArray());
400390
}
401391

402-
@SuppressWarnings("unchecked")
403392
@Test
404393
public void ambArraySingleElement() {
405394
assertSame(Flowable.never(), Flowable.ambArray(Flowable.never()));
406395
}
407396

408-
@SuppressWarnings("unchecked")
409397
@Test
410398
public void disposed() {
411399
TestHelper.checkDisposed(Flowable.ambArray(Flowable.never(), Flowable.never()));
@@ -442,7 +430,6 @@ public void onNextRace() {
442430
final PublishProcessor<Integer> pp1 = PublishProcessor.create();
443431
final PublishProcessor<Integer> pp2 = PublishProcessor.create();
444432

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

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

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

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

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

505490
final Throwable ex = new TestException();
@@ -531,7 +516,6 @@ public void run() {
531516
}
532517
}
533518

534-
@SuppressWarnings("unchecked")
535519
@Test
536520
public void nullIterableElement() {
537521
Flowable.amb(Arrays.asList(Flowable.never(), null, Flowable.never()))
@@ -575,21 +559,18 @@ public void ambWithOrder() {
575559
Flowable.just(1).ambWith(error).test().assertValue(1).assertComplete();
576560
}
577561

578-
@SuppressWarnings("unchecked")
579562
@Test
580563
public void ambIterableOrder() {
581564
Flowable<Integer> error = Flowable.error(new RuntimeException());
582565
Flowable.amb(Arrays.asList(Flowable.just(1), error)).test().assertValue(1).assertComplete();
583566
}
584567

585-
@SuppressWarnings("unchecked")
586568
@Test
587569
public void ambArrayOrder() {
588570
Flowable<Integer> error = Flowable.error(new RuntimeException());
589571
Flowable.ambArray(Flowable.just(1), error).test().assertValue(1).assertComplete();
590572
}
591573

592-
@SuppressWarnings("unchecked")
593574
@Test
594575
public void noWinnerSuccessDispose() throws Exception {
595576
for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) {
@@ -615,7 +596,6 @@ public void accept(Object v) throws Exception {
615596
}
616597
}
617598

618-
@SuppressWarnings("unchecked")
619599
@Test
620600
public void noWinnerErrorDispose() throws Exception {
621601
final TestException ex = new TestException();
@@ -642,7 +622,6 @@ public void accept(Throwable e) throws Exception {
642622
}
643623
}
644624

645-
@SuppressWarnings("unchecked")
646625
@Test
647626
public void noWinnerCompleteDispose() throws Exception {
648627
for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) {
@@ -668,7 +647,6 @@ public void run() throws Exception {
668647
}
669648
}
670649

671-
@SuppressWarnings("unchecked")
672650
@Test
673651
public void publishersInIterable() {
674652
Publisher<Integer> source = new Publisher<Integer>() {

0 commit comments

Comments
 (0)