Repository: ReactiveX/RxJava

Issue #6776: 3.x: [Java 8] Add operators supporting the newer platform [tracking issue]
Created: 2019-12-18T13:57:20Z
This issue tracks the new, Java 8-related operators to be implemented.

 Flowable.fromOptional
 Flowable.fromStream
 Flowable.fromCompletionStage
 Flowable.mapOptional
 Flowable.collect(Collector)
 Flowable.firstStage
 Flowable.singleStage
 Flowable.lastStage
 Flowable.firstOrErrorStage
 Flowable.singleOrErrorStage
 Flowable.lastOrErrorStage
 Flowable.blockingStream + 1
 Flowable.flatMapStream + 1
 Flowable.concatMapStream + 1



 Observable.fromOptional
 Observable.fromStream
 Observable.fromCompletionStage
 Observable.mapOptional
 Observable.collect(Collector)
 Observable.firstStage
 Observable.singleStage
 Observable.lastStage
 Observable.firstOrErrorStage
 Observable.singleOrErrorStage
 Observable.lastOrErrorStage
 Observable.blockingStream + 1
 Observable.flatMapStream
 Observable.concatMapStream



 Maybe.fromOptional
 Maybe.fromCompletionStage
 Maybe.mapOptional
 Maybe.toCompletionStage() + 1
 Maybe.flattenStreamAsFlowable
 Maybe.flattenStreamAsObservable



 Single.fromCompletionStage
 Single.mapOptional returns Maybe<T>
 Single.toCompletionStage()
 Single.flattenStreamAsFlowable
 Single.flattenStreamAsObservable



 Completable.fromCompletionStage
 Completable.toCompletionStage



 ParallelFlowable.mapOptional
 ParallelFlowable.flatMapStream
 ParallelFlowable.collect(Collector) returns Flowable

Duplicate issue #6695: 3.x release vs. Java 8 support on Android 
Created: 2019-10-30T23:21:00Z
Recently, the news came that Android Studio 4 will support a so-called "desugaring" of Java 8 APIs (i.e., some kind of auto-backport for target devices not supporting newer API levels as I understand). This would allow RxJava 3 to increase the baseline support to Java 8 on its surface API:

Stream support
Stream Collectors support
Optional support
CompletableFuture support
Use site non-null annotations

Some features won't be supported:

java.time.Duration: allocates, we'll stick to time+unit
java.util.function: these can't throw Throwables, overloads would create bloat and/or ambiguity

The main issue with Android's Java 8 support is timing related to the pledged release schedule of RxJava 3.x, end of December 2019. AGP 4 may not release for months, inclining us to:

Wait for AGP's release, effectively parking RxJava 3 for months as release candidate. Drawback: AGP may slip a lot.
Release on schedule with Java 6 baseline. Drawback: AGP may release shortly after and thus

we'd be stuck on 3.x for years;
we'd have to start working on 4.x undermining 3.x in a sense, also adding more maintenance burden;
we release 3.1 with baseline 8, abandoning 3.0 and possibly violating some pledge;


Release on schedule with Java 8 baseline. Drawback: 3.x improvements won't be available to many at release.
Release on schedule with Java 8 bytecode output but no 8 API use, add those in 3.1. Drawback: despite best efforts, this could cause problems with existing desugaring/tooling.

The same issue is likely to arise with the next step, Java 9 support on Android. From our perspective, support for the Flow.* interfaces would be just enough as none of the other 9 features would work (VarHandles - field reflection anomalies?, Cleaner - portable?, Modules?). Beyond 9, the next major change to RxJava would have to come due to value types (no version ETA yet). Loom/Fibers is likely simply an API expansion, not a fundamental change.
Suggestions, ideas welcome.

Closing comment (2019-12-18T13:57:35Z): Progress tracked in #6776.