He-Pin opened a new pull request, #3139: URL: https://github.com/apache/pekko/pull/3139
### Motivation JDK 9 changed `ByteBuffer.clear()`, `limit(int)`, `flip()`, `rewind()` to return `ByteBuffer` instead of `Buffer`, enabling fluent method chaining. Previously these returned `Buffer`, requiring either explicit casts or separate statements. ### Modification Consolidate separate `buffer.clear()` + `buffer.limit(n)` statements into single expressions passed directly to `channel.read()`/`channel.receive()`. Chain `buffer.clear().flip()` in `TlsEngineHelpers.emptyReadBuffer`. | File | Before | After | |------|--------|-------| | `TcpConnection.innerRead` | 4 statements | 3 statements | | `UdpConnection.innerRead` | 3 statements | 1 statement | | `UdpListener.innerReceive` | 3 statements | 1 statement | | `TlsEngineHelpers.emptyReadBuffer` | 2 statements | 1 statement | ### Result More concise I/O code leveraging JDK 9+ ByteBuffer covariant returns. Semantically identical — clear/limit/flip execution order unchanged. ### Tests - `sbt "actor-tests / Test / testOnly org.apache.pekko.io.TcpConnectionSpec"` — 34/34 passed - `sbt "actor-tests / Test / testOnly org.apache.pekko.io.UdpIntegrationSpec"` — 7/7 passed ### References Refs #3136 -- 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]
