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: [Java 8] Add AutoCloseable <-> Disposable conversions, nicen docs #6780

Merged
merged 1 commit into from
Dec 19, 2019

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Dec 19, 2019

Add Disposables.fromAutoCloseable and Disposables.toAutoCloseable methods. Improve JavaDocs styling.

Resolves #6772
Resolves #6777

@akarnokd akarnokd added Enhancement 3.x Java 8 Issues and PRs related to Java 8 support labels Dec 19, 2019
@akarnokd akarnokd added this to the 3.0 milestone Dec 19, 2019
@JakeWharton
Copy link
Member

You could also do

interface Disposable extends AutoCloseable {
  boolean isDisposed();
  void dispose();

  default void close() {
    dispose();
  }
}

@codecov
Copy link

codecov bot commented Dec 19, 2019

Codecov Report

Merging #6780 into 3.x will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##                3.x    #6780      +/-   ##
============================================
+ Coverage     98.22%   98.26%   +0.03%     
- Complexity     6236     6241       +5     
============================================
  Files           688      689       +1     
  Lines         45041    45053      +12     
  Branches       6193     6193              
============================================
+ Hits          44243    44270      +27     
+ Misses          280      273       -7     
+ Partials        518      510       -8
Impacted Files Coverage Δ Complexity Δ
...ctivex/rxjava3/disposables/RunnableDisposable.java 100% <ø> (ø) 3 <0> (ø) ⬇️
...eactivex/rxjava3/disposables/FutureDisposable.java 100% <ø> (ø) 6 <0> (ø) ⬇️
...x/rxjava3/disposables/AutoCloseableDisposable.java 100% <100%> (ø) 3 <3> (?)
...eactivex/rxjava3/disposables/ActionDisposable.java 100% <100%> (ø) 3 <1> (+1) ⬆️
.../io/reactivex/rxjava3/disposables/Disposables.java 100% <100%> (ø) 10 <2> (+2) ⬆️
...perators/single/SingleFlatMapIterableFlowable.java 94.16% <0%> (-2.5%) 2% <0%> (ø)
.../internal/disposables/ListCompositeDisposable.java 98% <0%> (-2%) 34% <0%> (-1%)
...tivex/rxjava3/disposables/CompositeDisposable.java 98.14% <0%> (-1.86%) 39% <0%> (-1%)
...nternal/operators/observable/ObservableWindow.java 98.18% <0%> (-1.82%) 3% <0%> (ø)
...ava3/internal/operators/parallel/ParallelJoin.java 92.04% <0%> (-1.14%) 3% <0%> (ø)
... and 17 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 8d41cc5...b5e6b61. Read the comment docs.

@akarnokd
Copy link
Member Author

I've tried Disposable extends AutoCloseable before and ended up with hundreds of warnings about unclosed resources. I'd rather keep them separate.

@akarnokd akarnokd merged commit 3d25617 into ReactiveX:3.x Dec 19, 2019
@akarnokd akarnokd deleted the DisposableAutoCloseable3x branch December 19, 2019 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Enhancement Java 8 Issues and PRs related to Java 8 support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3.x: [Java 8] Add Disposables.toAutoCloseable 3.x: [Java 8] Add Disposables.fromAutoCloseable
3 participants