pjfanning opened a new pull request, #1377:
URL: https://github.com/apache/pekko-http/pull/1377

   ### Motivation
   The Java DSL `ConnectionPoolSettings.withHostOverrides` takes a 
`java.util.List<scala.Tuple2<String, ConnectionPoolSettings>>`, so Java users 
have to construct Scala tuples to configure per-host pool overrides.
   
   ### Modification
   - Change the parameter to `java.util.List<org.apache.pekko.japi.Pair<String, 
ConnectionPoolSettings>>`.
   - An overload isn't possible: both versions erase to 
`withHostOverrides(java.util.List)`. The method is `@ApiMayChange` (and listed 
as such in `compatibility-guidelines.md`), so it is changed in place for 2.0.0.
   - List order is kept, so when several patterns match a host the first one 
still wins; this is now stated in the Scaladoc.
   - Add `connection-pool-host-overrides-java-pair.excludes` for the 
`IncompatibleSignatureProblem`. Only the generic signature changes; the erased 
signature is the same, so code compiled against the old signature that passes 
`Tuple2`s would fail at runtime with a `ClassCastException` rather than a 
`NoSuchMethodError`. sbt-header does not cover `.excludes` files, so the ASF 
header was copied verbatim from the sibling 
`javadsl-change-duration-return-types.excludes`.
   
   `appendHostOverride(String, ConnectionPoolSettings)` and the scaladsl 
`withHostOverrides(Seq[(String, ConnectionPoolSettings)])` are unchanged.
   
   ### Result
   ```java
   settings.withHostOverrides(List.of(
       Pair.create("*.example.com", settings.withMaxConnections(7)),
       Pair.create("other.org", settings.withMaxConnections(11))));
   ```
   
   ### Tests
   - `sbt "http-core/Test/testOnly 
org.apache.pekko.http.javadsl.settings.ConnectionPoolSettingsTest"` - passed on 
Scala 2.13 (new Java test: first matching pattern wins, a later pattern applies 
to its host, unmatched hosts use the defaults)
   - `sbt "++3.3.8" "http-core/Test/testOnly 
org.apache.pekko.http.javadsl.settings.ConnectionPoolSettingsTest 
org.apache.pekko.http.scaladsl.settings.ConnectionPoolSettingsSpec"` - passed
   - `sbt http-core/mimaReportBinaryIssues` - passed with the new exclude
   - `sbt http-core/scalafmt http-core/Test/javafmt` - no changes
   
   ### References
   None - Java DSL cleanup of Scala types in public API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to