refactor: replace immutable.Traversable in the public io and stream APIs - #3468
Open
pjfanning wants to merge 1 commit into
Open
refactor: replace immutable.Traversable in the public io and stream APIs#3468pjfanning wants to merge 1 commit into
pjfanning wants to merge 1 commit into
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
immutable.Traversableis a deprecated alias forimmutable.Iterable, kept around for the 2.12 migration. It survives in theoptionsparameter of several public messages and methods:Tcp.scala:138,167Tcp.Connect,Tcp.BindUdp.scala:118,139Udp.Bind,Udp.SimpleSenderUdpConnected.scala:112UdpConnected.Connectstream/scaladsl/Tcp.scala:144,186,220bind,bindWithTls,outgoingConnectionTcpConnection.scala:226,TcpIncomingConnection.scala:37private[io], but share the signatureOn the MiMa exclusions
You asked for exclusions with this. None are needed, and I would rather not add empty ones.
I had previously told you this change would move the Scala pickle signature and need filtering. That was wrong, and checking it is what changed the shape of this PR.
immutable.Traversableis a type alias, so it is already erased and written asimmutable.Iterablein the bytecode.javapon the pre-change build:The generic signature already said
Iterable, socopyandunapplyare unchanged too — the case-class concern I raised earlier does not apply.actor/mimaReportBinaryIssuesandstream/mimaReportBinaryIssuesboth pass unmodified against thepekko-actor:1.0.0baseline that MiMa resolves.If a reviewer would still like a
.excludesfile added defensively, say so and I will add one — but it would exclude nothing, and I did not want to imply a compatibility risk that the bytecode says is not there.Also removed: eight stale suppressions
Five
@nowarn("msg=deprecated")in the actor io sources and three@nowarn // Traversable deprecated in 2.13in stream'sTcp. I verified each was stale by deleting it and recompiling.This is the part with real value.
@nowarn("msg=deprecated")on a class or method silences every deprecation warning in its scope, not just the one it was added for — onUdp.BindandTcp.Connectit sits on the whole case class. Left in, they would keep hiding unrelated deprecations indefinitely. Thenowarnimport is kept in stream'sTcponly because line 402 still uses it for something else.Compatibility
Seq,List,Nilorimmutable.Iterable. A caller that has explicitly spelledimmutable.Traversableat a call site still compiles, since the alias itself is not being removed.Tests
No new tests — this is a type-alias substitution with no behaviour change and no signature change.
actor/compile,stream/compile,actor/mimaReportBinaryIssuesandstream/mimaReportBinaryIssuesall pass locally, andscalafmthas been run on both modules. I have not run the full test suites locally and am relying on CI for those.Scope
Deliberately limited to
immutable.Traversable. TheGenTraversableOnceuse inDnsMessageis in #3467 and is not touched here.