This is an automated email from the ASF dual-hosted git repository.

pjfanning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git


The following commit(s) were added to refs/heads/main by this push:
     new 3a601fa751 refactor: replace immutable.Traversable in the public io 
and stream APIs (#3468)
3a601fa751 is described below

commit 3a601fa7514be53e2c341c53dd90c8e2d6a88bac
Author: PJ Fanning <[email protected]>
AuthorDate: Tue Aug 25 13:16:22 2026 +0100

    refactor: replace immutable.Traversable in the public io and stream APIs 
(#3468)
    
    `immutable.Traversable` is a deprecated alias for `immutable.Iterable`,
    retained for the 2.12 migration. It remains in the `options` parameter of
    several public messages and methods:
    
      - Tcp.Connect, Tcp.Bind
      - Udp.Bind, Udp.SimpleSender
      - UdpConnected.Connect
      - stream's Tcp.bind, bindWithTls and outgoingConnection
      - TcpConnection.completeConnect and the TcpIncomingConnection
        constructor, which are private[io] but share the same signature
    
    Use `immutable.Iterable` and drop the now stale suppressions: five
    `@nowarn("msg=deprecated")` in the actor io sources and three
    `@nowarn // Traversable deprecated in 2.13` in stream's Tcp. Each was
    verified stale by removing it and recompiling. This matters beyond
    tidiness, because `@nowarn("msg=deprecated")` on a class or method
    silences every deprecation warning in its scope.
    
    No MiMa exclusions are needed. `immutable.Traversable` is a type alias,
    so it is already both erased and written as `immutable.Iterable` in the
    bytecode and in the generic signature; `javap` on Tcp$Connect shows
    `options()` returning `scala.collection.immutable.Iterable` before this
    change. `actor/mimaReportBinaryIssues` and `stream/mimaReportBinaryIssues`
    pass unchanged against the 1.0.0 baseline.
    
    Source compatibility is unaffected for callers passing a `Seq`, `List`,
    `Nil` or `immutable.Iterable`. A caller that has explicitly written
    `immutable.Traversable` at a call site still compiles, since the alias
    itself is not removed.
---
 actor/src/main/scala/org/apache/pekko/io/Tcp.scala               | 7 ++-----
 actor/src/main/scala/org/apache/pekko/io/TcpConnection.scala     | 4 +---
 .../main/scala/org/apache/pekko/io/TcpIncomingConnection.scala   | 4 +---
 actor/src/main/scala/org/apache/pekko/io/Udp.scala               | 7 ++-----
 actor/src/main/scala/org/apache/pekko/io/UdpConnected.scala      | 4 +---
 stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala | 9 +++------
 6 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/actor/src/main/scala/org/apache/pekko/io/Tcp.scala 
b/actor/src/main/scala/org/apache/pekko/io/Tcp.scala
index 77ea5a2ad2..9cef120ef3 100644
--- a/actor/src/main/scala/org/apache/pekko/io/Tcp.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/Tcp.scala
@@ -18,7 +18,6 @@ import java.net.InetSocketAddress
 import java.net.Socket
 import java.nio.file.{ Path, Paths }
 
-import scala.annotation.nowarn
 import scala.collection.immutable
 import scala.concurrent.duration._
 import scala.jdk.CollectionConverters._
@@ -131,11 +130,10 @@ object Tcp extends ExtensionId[TcpExt] with 
ExtensionIdProvider {
    * @param localAddress optionally specifies a specific address to bind to
    * @param options Please refer to the `Tcp.SO` object for a list of all 
supported options.
    */
-  @nowarn("msg=deprecated")
   final case class Connect(
       remoteAddress: InetSocketAddress,
       localAddress: Option[InetSocketAddress] = None,
-      options: immutable.Traversable[SocketOption] = Nil,
+      options: immutable.Iterable[SocketOption] = Nil,
       timeout: Option[FiniteDuration] = None,
       pullMode: Boolean = false)
       extends Command
@@ -159,12 +157,11 @@ object Tcp extends ExtensionId[TcpExt] with 
ExtensionIdProvider {
    *
    * @param options Please refer to the `Tcp.SO` object for a list of all 
supported options.
    */
-  @nowarn("msg=deprecated")
   final case class Bind(
       handler: ActorRef,
       localAddress: InetSocketAddress,
       backlog: Int = 100,
-      options: immutable.Traversable[SocketOption] = Nil,
+      options: immutable.Iterable[SocketOption] = Nil,
       pullMode: Boolean = false)
       extends Command
 
diff --git a/actor/src/main/scala/org/apache/pekko/io/TcpConnection.scala 
b/actor/src/main/scala/org/apache/pekko/io/TcpConnection.scala
index 3ae1366e13..337c56c7af 100644
--- a/actor/src/main/scala/org/apache/pekko/io/TcpConnection.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/TcpConnection.scala
@@ -20,7 +20,6 @@ import java.nio.channels.{ FileChannel, SocketChannel }
 import java.nio.channels.SelectionKey._
 import java.nio.file.Path
 
-import scala.annotation.nowarn
 import scala.annotation.tailrec
 import scala.collection.immutable
 import scala.concurrent.duration._
@@ -219,11 +218,10 @@ private[io] abstract class TcpConnection(val tcp: TcpExt, 
val channel: SocketCha
   // AUXILIARIES and IMPLEMENTATION
 
   /** used in subclasses to start the common machinery above once a channel is 
connected */
-  @nowarn("msg=deprecated")
   def completeConnect(
       registration: ChannelRegistration,
       commander: ActorRef,
-      options: immutable.Traversable[SocketOption]): Unit = {
+      options: immutable.Iterable[SocketOption]): Unit = {
     this.registration = Some(registration)
 
     // Turn off Nagle's algorithm by default
diff --git 
a/actor/src/main/scala/org/apache/pekko/io/TcpIncomingConnection.scala 
b/actor/src/main/scala/org/apache/pekko/io/TcpIncomingConnection.scala
index 5adb59024a..9eda971340 100644
--- a/actor/src/main/scala/org/apache/pekko/io/TcpIncomingConnection.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/TcpIncomingConnection.scala
@@ -15,7 +15,6 @@ package org.apache.pekko.io
 
 import java.nio.channels.SocketChannel
 
-import scala.annotation.nowarn
 import scala.collection.immutable
 
 import org.apache.pekko
@@ -28,13 +27,12 @@ import pekko.io.Inet.SocketOption
  *
  * INTERNAL API
  */
-@nowarn("msg=deprecated")
 private[io] class TcpIncomingConnection(
     _tcp: TcpExt,
     _channel: SocketChannel,
     registry: ChannelRegistry,
     bindHandler: ActorRef,
-    options: immutable.Traversable[SocketOption],
+    options: immutable.Iterable[SocketOption],
     readThrottling: Boolean)
     extends TcpConnection(_tcp, _channel, readThrottling) {
 
diff --git a/actor/src/main/scala/org/apache/pekko/io/Udp.scala 
b/actor/src/main/scala/org/apache/pekko/io/Udp.scala
index d54d4fe505..704984ef1f 100644
--- a/actor/src/main/scala/org/apache/pekko/io/Udp.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/Udp.scala
@@ -16,7 +16,6 @@ package org.apache.pekko.io
 import java.net.DatagramSocket
 import java.net.InetSocketAddress
 
-import scala.annotation.nowarn
 import scala.collection.immutable
 
 import org.apache.pekko
@@ -111,11 +110,10 @@ object Udp extends ExtensionId[UdpExt] with 
ExtensionIdProvider {
    * The listener actor for the newly bound port will reply with a [[Bound]]
    * message, or the manager will reply with a [[CommandFailed]] message.
    */
-  @nowarn("msg=deprecated")
   final case class Bind(
       handler: ActorRef,
       localAddress: InetSocketAddress,
-      options: immutable.Traversable[SocketOption] = Nil)
+      options: immutable.Iterable[SocketOption] = Nil)
       extends Command
 
   /**
@@ -135,8 +133,7 @@ object Udp extends ExtensionId[UdpExt] with 
ExtensionIdProvider {
    * The “simple sender” will not stop itself, you will have to send it a 
[[pekko.actor.PoisonPill]]
    * when you want to close the socket.
    */
-  @nowarn("msg=deprecated")
-  case class SimpleSender(options: immutable.Traversable[SocketOption] = Nil) 
extends Command
+  case class SimpleSender(options: immutable.Iterable[SocketOption] = Nil) 
extends Command
   object SimpleSender extends SimpleSender(Nil)
 
   /**
diff --git a/actor/src/main/scala/org/apache/pekko/io/UdpConnected.scala 
b/actor/src/main/scala/org/apache/pekko/io/UdpConnected.scala
index acf31e173c..474c33c8f8 100644
--- a/actor/src/main/scala/org/apache/pekko/io/UdpConnected.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/UdpConnected.scala
@@ -16,7 +16,6 @@ package org.apache.pekko.io
 import java.lang.{ Iterable => JIterable }
 import java.net.InetSocketAddress
 
-import scala.annotation.nowarn
 import scala.collection.immutable
 
 import org.apache.pekko
@@ -104,12 +103,11 @@ object UdpConnected extends ExtensionId[UdpConnectedExt] 
with ExtensionIdProvide
    * which is restricted to sending to and receiving from the given 
`remoteAddress`.
    * All received datagrams will be sent to the designated `handler` actor.
    */
-  @nowarn("msg=deprecated")
   final case class Connect(
       handler: ActorRef,
       remoteAddress: InetSocketAddress,
       localAddress: Option[InetSocketAddress] = None,
-      options: immutable.Traversable[SocketOption] = Nil)
+      options: immutable.Iterable[SocketOption] = Nil)
       extends Command
 
   /**
diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala 
b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala
index f0ea8dc996..24bcd7ed25 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala
@@ -140,8 +140,7 @@ final class Tcp(system: ExtendedActorSystem) extends 
pekko.actor.Extension {
       interface: String,
       port: Int,
       backlog: Int = defaultBacklog,
-      @nowarn // Traversable deprecated in 2.13
-      options: immutable.Traversable[SocketOption] = Nil,
+      options: immutable.Iterable[SocketOption] = Nil,
       halfClose: Boolean = false,
       idleTimeout: Duration = Duration.Inf): Source[IncomingConnection, 
Future[ServerBinding]] =
     Source.fromGraph(
@@ -182,8 +181,7 @@ final class Tcp(system: ExtendedActorSystem) extends 
pekko.actor.Extension {
       interface: String,
       port: Int,
       backlog: Int = defaultBacklog,
-      @nowarn // Traversable deprecated in 2.13
-      options: immutable.Traversable[SocketOption] = Nil,
+      options: immutable.Iterable[SocketOption] = Nil,
       halfClose: Boolean = false,
       idleTimeout: Duration = Duration.Inf)(implicit m: Materializer): 
Future[ServerBinding] = {
     bind(interface, port, backlog, options, halfClose, idleTimeout)
@@ -216,8 +214,7 @@ final class Tcp(system: ExtendedActorSystem) extends 
pekko.actor.Extension {
   def outgoingConnection(
       remoteAddress: InetSocketAddress,
       localAddress: Option[InetSocketAddress] = None,
-      @nowarn // Traversable deprecated in 2.13
-      options: immutable.Traversable[SocketOption] = Nil,
+      options: immutable.Iterable[SocketOption] = Nil,
       halfClose: Boolean = true,
       connectTimeout: Duration = Duration.Inf,
       idleTimeout: Duration = Duration.Inf): Flow[ByteString, ByteString, 
Future[OutgoingConnection]] = {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to