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

   ### Motivation
   Several Java API methods take `java.util.List` or invariant generic 
collections, so Java callers have to copy or up-cast their collections. For 
example, `GrpcServiceException.create` rejects a `List<LocalizedMessage>`, and 
our own rich error docs snippet works around it by declaring 
`ArrayList<scalapb.GeneratedMessage>`. 2.0.0 is a good point to fix these.
   
   ### Modification
   - `GrpcServiceException.create` takes `Iterable<? extends GeneratedMessage>` 
(was `List<GeneratedMessage>`).
   - `WebHandler.grpcWebHandler` (both overloads) takes an `Iterable` of 
handlers (was `List`).
   - `MetadataBuilder.fromHeaders` takes `Iterable<? extends HttpHeader>`.
   - `ServerReflection.create` takes `Iterable<? extends ServiceDescription>` 
(was `Collection<ServiceDescription>`).
   - `ServiceHandler.handler` and `concatOrNotFound` gain `Iterable` overloads 
next to the varargs ones. Java callers can then avoid the unchecked generic 
array warning, and the API matches `WebHandler`.
   - `GrpcClientSettings` gains `withResolveTimeout(java.time.Duration)`, 
matching `withDeadline`.
   - The rich error model Java docs snippet now uses 
`List.of(LocalizedMessage.of(...))`.
   - MiMa excludes for the changed signatures. `GrpcServiceException.create` is 
new since 1.0.2, so it needs none.
   
   ### Result
   Java callers can pass any `Iterable`, and collections of subtypes, without 
copying or casting. Existing call sites that pass a `List` still compile. 
Generated code is unchanged.
   
   ### Tests
   - `sbt "runtime/testOnly org.apache.pekko.grpc.javadsl.*"`: passed. The new 
`JavaApiParameterTypesTest` fails to compile against the old API.
   - `sbt "+runtime/Test/compile"`: passed (2.13, 3.3)
   - `sbt "interop-tests/testOnly *RichErrorModel*"`: passed
   - `sbt "runtime/mimaReportBinaryIssues"`: passed
   - `runtime/scalafmtCheckAll`, `runtime/javafmtAll`, 
`interop-tests/javafmtAll`: run
   
   ### References
   None - Java API cleanup for 2.0.0
   
   🤖 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