-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
JDK9 Flow integration #1783
JDK9 Flow integration #1783
Conversation
Even though the |
3f15dba
to
5d0ba5e
Compare
8c1addf
to
339a367
Compare
eb7ffed
to
dbe3e2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job
This was accomplished by copying `kotlinx-coroutines-reactive`. Judging by the fact that https://github.com/reactive-streams/reactive-streams-jvm/blob/master/api/src/main/java9/org/reactivestreams/FlowAdapters.java defines converters between Java9 Flow and Reactive Streams as thin wrappers that simply redirect methods, this should be enough. Divergences from `kotlinx-coroutines-reactive` are as follows: * The target bytecode is set to JDK9. * JDK11 is required to build the module. * Automated change of all occurrences `org.reactivestreams` to `java.util.concurrent.Flow`. * Removal of `RangePublisherTest`, `RangePublisherBufferdTest`, and `UnboundedIntegerIncrementPublisherTest`. They all are heavily based on the examples provided for the Reactive Streams, and to use them for testing this integration would only be possible with heavy use of `FlowAdapters`, which seems redundant as the integration with the examples themselves is already tested in `kotlinx-coroutines-reactive`, and the correctness of the wrappers is probably a given. * Use of `FlowAdapters` where needed to make everything valid code.
The `kotlinx-coroutines-jdk9` module, being a copy of `kotlinx-coroutines-reactive`, has its share of legacy APIs defined. As this is a new module, there is no reason to preserve them. The changes include: * `Migration.kt`, being a file completely dedicated to warnings about old API usage, has been removed. * `IntegrationTest.kt` changed slightly so that it no longer uses the subscription channel API, which is deprecated. * `Channel.kt` is now just an implementation detail. It does not expose any public methods. * In particular, `Publisher<T>.collect` has been moved to `ReactiveFlow.kt` and is no longer inline, as it would expose `openSubscription`, which is deprecated. * `PublisherSubscriptionSelectTest`, which tests use of `select` with the subscription channel API, is not included anymore. * `Convert.kt` also has been removed altogether, having no non-deprecated methods.
Since the JDK9 Flow integration is now implemented as thin wrappers around the Reactive Streams integration, there is no need for such thorough testing, and additional tests would only cause the overhead of needing to fix two copies at once when changing the Reactive Streams integration.
2cfd20c
to
2a383c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code would be easier to
4a49830
to
aff8202
Compare
Since this subproject outright requires to be built under JDK 9+, calling |
It is already mentioned in top-level readme:
|
Solves #162, #1727