2.x: Fix Generics T[] in Zip & CombineLatest#4525
2.x: Fix Generics T[] in Zip & CombineLatest#4525akarnokd merged 5 commits intoReactiveX:2.xfrom vanniktech:2.x_generics_object_fix
Conversation
| @Test | ||
| public void zipIterableObject() { | ||
| final List<Flowable<Integer>> flowables = Arrays.asList(Flowable.just(1, 2, 3), Flowable.just(1, 2, 3)); | ||
| Flowable.zip(flowables, new Function<Object[], Object>() { |
There was a problem hiding this comment.
Yeah, this always passes because it is compatible with both ? super T[] and ? super Object[]. I have no idea how to test with Function<Integer[], Object> because it doesn't even compile with the latter signature. Leave this as is.
There was a problem hiding this comment.
Yup Function<Integer[], Object> didn't work for me so I didn't add a test case.
| @SchedulerSupport(SchedulerSupport.NONE) | ||
| @BackpressureSupport(BackpressureKind.FULL) | ||
| public static <T, R> Flowable<R> combineLatest(Function<? super T[], ? extends R> combiner, Publisher<? extends T>... sources) { | ||
| public static <T, R> Flowable<R> combineLatest(Function<? super Object[], ? extends R> combiner, Publisher<? extends T>... sources) { |
There was a problem hiding this comment.
this one does not seem necessary to be honest. It just has switched arguments with the one above. Or do I oversee anything?
There was a problem hiding this comment.
This and other overloads of operators let's you use varargs to specify any number of sources at the expense that varargs has to be the last argument.
There was a problem hiding this comment.
Ups right didn't see those little dots there too many overloads ...
Current coverage is 78.71% (diff: 100%)@@ 2.x #4525 diff @@
==========================================
Files 515 515
Lines 34643 34644 +1
Methods 0 0
Messages 0 0
Branches 5431 5431
==========================================
+ Hits 27268 27269 +1
+ Misses 5409 5408 -1
- Partials 1966 1967 +1
|
|
This should be it now |
|
Single has exactly 1 and Maybe at most 1 item, so there is only 1 latest that can happen thus there is no difference between combineLatest and zip for these sources. |
|
👍 |
|
Yup I immediately noticed it after I wrote my comment :D that's also why I deleted it |
Fixes #4524
Test for combineLatest fill follow