pjfanning opened a new pull request, #3714: URL: https://github.com/apache/pekko/pull/3714
> **Built on #3713.** This branch contains #3713's commits; only the last commit (`Widen more Java DSL parameters with wildcard bounds`) is new here. Review #3713 first; this PR will be rebased once it merges. ### Motivation Follow-up to #3713, covering the lower-priority candidates listed in https://github.com/apache/pekko/issues/3712#issuecomment-6421792710. These javadsl factories still reject arguments a Java user would reasonably pass: - a `List<Integer>` / `Optional<Integer>` / `CompletionStage<Integer>` when the target is a `Source<Number, NotUsed>` - a `Graph` (or a value typed as one) where a concrete javadsl `Source` / `Flow` / `Sink` is required - a `Creator<Source<Out, NotUsed>>` in the class-based `recoverWith` / `recoverWithRetries` - a failure function over a supertype of `Throwable` in `Sink.actorRefWithBackpressure` ### Modification - `Source.from`, `fromOption`, `completionStage`: accept `? <: T` element types. - `Source.completionStageSource`, `Flow.completionStageFlow`, `Sink.completionStageSink`, `Sink.eagerCompletionStageSink`: accept `CompletionStage[? <: Graph[...]]`. - `Source` / `Flow` / `Sink` `fromMaterializer`: the factory may return any matching `Graph`. - `Source` / `Flow` `recoverWith(clazz, creator)` and `recoverWithRetries(attempts, clazz, creator)`: accept `Creator[? <: Graph[...]]`. - `Sink.actorRefWithBackpressure` (both overloads): accept `Function[? >: Throwable, ?]` for `onFailureMessage`. The issue comment named `Sink.actorRef`, but these are the methods that take this function. - Add MiMa excludes for the generic signature changes. ### Result Java callers can pass these values without casts or re-typing. Erasure is unchanged for every method, so this PR is binary compatible; only `IncompatibleSignatureProblem` excludes are needed. ### Tests - New Java tests in `SourceTest`, `FlowTest` and `SinkTest` that pass values the old signatures rejected. - `sbt "stream-tests/testOnly org.apache.pekko.stream.javadsl.SourceTest org.apache.pekko.stream.javadsl.SinkTest org.apache.pekko.stream.javadsl.FlowTest org.apache.pekko.stream.DslFactoriesConsistencySpec"`: 256 passed - `sbt "stream/mimaReportBinaryIssues"`: passed with the added excludes - `sbt "++3.3.8" stream/compile`: passed - `scalafmt` and `javafmtAll` (JDK 17) run on the changed files ### References Refs #3712. Builds on #3713. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
