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

2.x: Add dematerialize(selector), deprecate old #6281

Merged
merged 3 commits into from
Nov 6, 2018

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Nov 1, 2018

This PR adds the dematerialize(Function<T, Notification<R>> selector) overload to allow type-safe dematerialization of Notification signals. The pre-existing dematerialize() forced the return type and assumed the items of the source are Notification objects, which could not be enforced via the type system. This selector variant establishes the type link from T to Notification<R> to R (where R == T is allowed).

The intended use is

Observable<Notification<T>> source = ...

Observable<T> result = source.dematerialize(notification -> notification);

aka identity mapping.

The pre-existing dematerialize() methods are marked as deprecated now.

(Also the actual operator were missing from the examples in the respective Javadocs).

@codecov
Copy link

codecov bot commented Nov 1, 2018

Codecov Report

Merging #6281 into 2.x will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6281      +/-   ##
============================================
+ Coverage     98.25%   98.28%   +0.02%     
- Complexity     6259     6262       +3     
============================================
  Files           667      667              
  Lines         44887    44911      +24     
  Branches       6213     6215       +2     
============================================
+ Hits          44104    44141      +37     
+ Misses          247      237      -10     
+ Partials        536      533       -3
Impacted Files Coverage Δ Complexity Δ
src/main/java/io/reactivex/Flowable.java 100% <100%> (ø) 567 <2> (+1) ⬆️
src/main/java/io/reactivex/Observable.java 100% <100%> (ø) 542 <2> (+1) ⬆️
...rnal/operators/flowable/FlowableDematerialize.java 100% <100%> (ø) 2 <1> (ø) ⬇️
.../operators/observable/ObservableDematerialize.java 100% <100%> (ø) 2 <1> (ø) ⬇️
...activex/internal/observers/QueueDrainObserver.java 97.43% <0%> (-2.57%) 21% <0%> (-1%)
...rnal/operators/observable/ObservableSwitchMap.java 93.08% <0%> (-2.13%) 3% <0%> (ø)
...rnal/operators/flowable/FlowableSkipLastTimed.java 95.91% <0%> (-2.05%) 2% <0%> (ø)
...l/operators/observable/ObservableFlatMapMaybe.java 90.84% <0%> (-1.97%) 2% <0%> (ø)
...tivex/internal/operators/single/SingleTimeout.java 98.33% <0%> (-1.67%) 2% <0%> (ø)
...l/operators/observable/ObservableTimeoutTimed.java 99.15% <0%> (-0.85%) 3% <0%> (ø)
... and 25 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 c3cfb5a...43a5a36. Read the comment docs.

@akarnokd akarnokd merged commit acd5466 into ReactiveX:2.x Nov 6, 2018
@akarnokd akarnokd deleted the DematerializeSelector branch November 6, 2018 08:17
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.

2 participants