Skip to content
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

3.x: Move nullness annotation to use sites of Supplier #7385

Merged
merged 1 commit into from
Feb 3, 2022

Conversation

akarnokd
Copy link
Member

Adds a nullability to Maybe.fromSupplier and Maybe.fromCallable to avoid warnings in Kotlin when returning nulls from the callbacks.

The previous attempt at fixing it in #7384 turned out to be not correct. Based on the responses in the Kotlin Issue report, the lack of warning was the bug and the approach was incorrect from the typesystem perspective.

Therefore, the workaround is to drop the non-null constraint from the Supplier declaration and have them at relevant use sites. (https://youtrack.jetbrains.com/issue/KT-50734#focus=Comments-27-5706908.0-0)

There was no need to add @NonNull everywhere where Supplier is used because such sites were already constrained by @NonNull in the type variable declaration.

Resolves #7376

@codecov
Copy link

codecov bot commented Jan 18, 2022

Codecov Report

Merging #7385 (d819ba2) into 3.x (3ed1bfb) will decrease coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##                3.x    #7385      +/-   ##
============================================
- Coverage     99.56%   99.52%   -0.05%     
+ Complexity     6781     6780       -1     
============================================
  Files           751      751              
  Lines         47482    47482              
  Branches       6378     6378              
============================================
- Hits          47276    47255      -21     
- Misses           91      105      +14     
- Partials        115      122       +7     
Impacted Files Coverage Δ
...in/java/io/reactivex/rxjava3/core/Completable.java 100.00% <ø> (ø)
.../main/java/io/reactivex/rxjava3/core/Flowable.java 100.00% <ø> (ø)
src/main/java/io/reactivex/rxjava3/core/Maybe.java 100.00% <ø> (ø)
...ain/java/io/reactivex/rxjava3/core/Observable.java 100.00% <ø> (ø)
...rc/main/java/io/reactivex/rxjava3/core/Single.java 100.00% <ø> (ø)
...a3/internal/operators/flowable/FlowableCreate.java 95.14% <0.00%> (-3.89%) ⬇️
...x/rxjava3/internal/operators/single/SingleAmb.java 96.61% <0.00%> (-3.39%) ⬇️
.../operators/observable/ObservableFlatMapSingle.java 94.44% <0.00%> (-2.39%) ⬇️
...va/io/reactivex/rxjava3/subjects/AsyncSubject.java 97.87% <0.00%> (-2.13%) ⬇️
...l/operators/observable/ObservableFlatMapMaybe.java 91.54% <0.00%> (-1.41%) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ed1bfb...d819ba2. Read the comment docs.

@akarnokd akarnokd merged commit 47189ac into ReactiveX:3.x Feb 3, 2022
@akarnokd akarnokd deleted the SupplierNullRelax branch August 8, 2022 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maybe#fromSupplier expects not null value from callable
3 participants