From 76340d91be2ac0c8028321afdbdc28cb4050c187 Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Mon, 21 Aug 2023 11:04:40 -0400 Subject: [PATCH] Remove `@NonNull` annotation from `Collector` container type parameter. `collect` delegates to `FlowableCollectWithCollectorSingle`, which does is not annotated to require a non-nullable type for its corresponding type parameter and whose implementation works fine with a null container. This PR lets Kotlin code pass a `Collector`, where `A` is declared as ``. --- src/main/java/io/reactivex/rxjava3/core/Flowable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/reactivex/rxjava3/core/Flowable.java b/src/main/java/io/reactivex/rxjava3/core/Flowable.java index 4d277ab08b..8bb6156659 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Flowable.java +++ b/src/main/java/io/reactivex/rxjava3/core/Flowable.java @@ -20394,7 +20394,7 @@ public final TestSubscriber test(long initialRequest, boolean cancel) { // No @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final <@NonNull R, @NonNull A> Single collect(@NonNull Collector collector) { + public final <@NonNull R, @Nullable A> Single collect(@NonNull Collector collector) { Objects.requireNonNull(collector, "collector is null"); return RxJavaPlugins.onAssembly(new FlowableCollectWithCollectorSingle<>(this, collector)); }