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: Widen functional interface throws, replace Callable with Supplier #6511

Merged
merged 3 commits into from
Jun 19, 2019

Conversation

akarnokd
Copy link
Member

This PR widens the throws Exception into throws Throwable in the functional interfaces and adjusts catch (Exception to catch(Throwable where needed.

The major change is the replacement of java.util.concurrent.Callable in almost all API with io.reactivex.functions.Supplier which is defined with throws Throwable. Since subinterfaces can't widen the throws clause, only narrow it, Supplier can't extend Callable.

fromCallable remained in all base classes and a separate PR will introduce fromSupplier.

The single-valued fusion now works with Supplier and ScalarSupplier types instead of Callable and ScalarCallable (removed).

@codecov
Copy link

codecov bot commented Jun 17, 2019

Codecov Report

Merging #6511 into 3.x will decrease coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##                3.x    #6511      +/-   ##
============================================
- Coverage     98.22%   98.17%   -0.06%     
+ Complexity     6294     6293       -1     
============================================
  Files           675      675              
  Lines         45165    45170       +5     
  Branches       6246     6246              
============================================
- Hits          44363    44344      -19     
- Misses          250      288      +38     
+ Partials        552      538      -14
Impacted Files Coverage Δ Complexity Δ
...internal/operators/flowable/FlowableObserveOn.java 97.21% <ø> (+0.55%) 3 <0> (ø) ⬇️
...ternal/operators/flowable/FlowableDoAfterNext.java 100% <ø> (ø) 3 <0> (ø) ⬇️
...rnal/operators/observable/ObservableDoFinally.java 97.91% <ø> (ø) 2 <0> (ø) ⬇️
...vex/internal/operators/maybe/MaybeZipIterable.java 100% <ø> (ø) 9 <0> (ø) ⬇️
src/main/java/io/reactivex/Completable.java 100% <ø> (ø) 120 <0> (ø) ⬇️
...ex/internal/operators/maybe/MaybeFromCallable.java 95% <ø> (ø) 6 <0> (ø) ⬇️
...nternal/operators/observable/ObservableFilter.java 100% <ø> (ø) 2 <0> (ø) ⬇️
...ctivex/internal/operators/maybe/MaybeZipArray.java 97.36% <ø> (ø) 6 <0> (ø) ⬇️
...erators/flowable/FlowableDistinctUntilChanged.java 100% <ø> (ø) 3 <0> (ø) ⬇️
.../internal/operators/flowable/FlowableDoOnEach.java 95.34% <ø> (ø) 3 <0> (ø) ⬇️
... and 127 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 2bed8c1...89087d7. Read the comment docs.

* A functional interface (callback) that provides a single value or
* throws an exception.
* <p>
* Thins interface was added to allow throwing any subclass of {@link Throwable}s,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: This

@@ -22,16 +22,16 @@
* <p>
* Implementors of {@link #call()} should not throw any exception.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link should now point to get().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Posted an update with additional cleanups.

@akarnokd akarnokd merged commit cb03724 into ReactiveX:3.x Jun 19, 2019
@akarnokd akarnokd deleted the WidenFunctionalInterfaceThrows3x branch June 19, 2019 07:19
ikhoon added a commit to ikhoon/armeria that referenced this pull request Feb 17, 2020
Motivation:
Recently RxJava 3 has been released.
https://github.com/ReactiveX/RxJava/releases/tag/v3.0.0
Armeria supports RxJava2 integration with `armeria-rxjava`.
This PR migrates `RequestContextAssembly` from RxJava2 to RxJava3.
RxJava 3 being based on Java 8 also supports seamless conversions between CompletionStage and Single, Maybe, Observable.

Modifications:
* Rename original `armeria-rxjava` to `armeria-rxjava2`
* Make armeria-rxjava support RxJava 3
* Use built-in converter methods for ObservableResponseConverterFunction
* Change `*Callable` to `*Supplier`
  ReactiveX/RxJava#6511
* Don't migrate `RequestContextScalarCallableCompletable` and `RequestContextCallableCompletable`
  There is no subclasses of `Completable` that implement `Supplier`
* Delegate `reset()` in `ConnectableFlowable`
  https://github.com/ReactiveX/RxJava/wiki/What's-different-in-3.0#connectable-source-reset

Result:
You can now use RxJava 3 with Armeria.
Fixes: line#2378
trustin pushed a commit to line/armeria that referenced this pull request Feb 27, 2020
Motivation:
Recently RxJava 3 has been released.
https://github.com/ReactiveX/RxJava/releases/tag/v3.0.0
Armeria supports RxJava2 integration with `armeria-rxjava`.
This PR migrates `RequestContextAssembly` from RxJava2 to RxJava3.
RxJava 3 being based on Java 8 also supports seamless conversions between CompletionStage and Single, Maybe, Observable.

Modifications:
* Rename original `armeria-rxjava` to `armeria-rxjava2`
* Make `armeria-rxjava` support RxJava 3
* Use built-in converter methods for ObservableResponseConverterFunction
* Change `*Callable` to `*Supplier`
  ReactiveX/RxJava#6511
* Remove `assemblyContext.push()` in `RequestContextScalarCallable*.get()`
  * Don't need to push `RequestContext` for scalar type such as `Maybe.just(T)`
* Delegate `reset()` method to `RequestContextConnectableFlowable`, `RequestContextConnectableObservable`
  https://github.com/ReactiveX/RxJava/wiki/What's-different-in-3.0#connectable-source-reset
* Migrate `examples/context-propagation/rxjava` to RxJava 3

Result:
You can now use RxJava 3 with Armeria.
Fixes: #2378
fmguerreiro pushed a commit to fmguerreiro/armeria that referenced this pull request Sep 19, 2020
Motivation:
Recently RxJava 3 has been released.
https://github.com/ReactiveX/RxJava/releases/tag/v3.0.0
Armeria supports RxJava2 integration with `armeria-rxjava`.
This PR migrates `RequestContextAssembly` from RxJava2 to RxJava3.
RxJava 3 being based on Java 8 also supports seamless conversions between CompletionStage and Single, Maybe, Observable.

Modifications:
* Rename original `armeria-rxjava` to `armeria-rxjava2`
* Make `armeria-rxjava` support RxJava 3
* Use built-in converter methods for ObservableResponseConverterFunction
* Change `*Callable` to `*Supplier`
  ReactiveX/RxJava#6511
* Remove `assemblyContext.push()` in `RequestContextScalarCallable*.get()`
  * Don't need to push `RequestContext` for scalar type such as `Maybe.just(T)`
* Delegate `reset()` method to `RequestContextConnectableFlowable`, `RequestContextConnectableObservable`
  https://github.com/ReactiveX/RxJava/wiki/What's-different-in-3.0#connectable-source-reset
* Migrate `examples/context-propagation/rxjava` to RxJava 3

Result:
You can now use RxJava 3 with Armeria.
Fixes: line#2378
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