Skip to content

Chore: remove leftover Scala 2.12 immutable.Seq idioms - #1941

Merged
pjfanning merged 1 commit into
apache:mainfrom
pjfanning:remove-scala-212-idioms
Sep 13, 2026
Merged

pjfanning merged 1 commit into
apache:mainfrom
pjfanning:remove-scala-212-idioms

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Motivation

The codebase still qualified Seq as immutable.Seq throughout, a Scala 2.12-era habit. Since 2.13 (and on Scala 3) scala.Seq is an alias for scala.collection.immutable.Seq, so the qualifier and the supporting scala.collection.immutable imports are redundant. This mirrors apache/pekko#3539 for the connectors repo.

Of the other idioms that PR removed (WrappedArray, filterKeys, Either projections, .toIterator, Stream), none remain here, and the three mapValues calls already go through .view, so immutable.Seq is the whole change.

Modification

  • Replace immutable.Seq with Seq across 120 Scala files.
  • Drop the now-unused scala.collection.immutable (76) and scala.collection.immutable.Seq (31) imports; reduce scala.collection.{ immutable, mutable } to scala.collection.mutable in the 5 JMS/Jakarta specs where only mutable remains in use.
  • Keep scala.collection.immutable in the 11 files that still use immutable.Iterable, immutable.Map, etc. immutable.Iterable is deliberately left unchanged because bare Iterable is scala.collection.Iterable, not the immutable one.
  • csv.md prose updated from immutable.Seq[String] to Seq[String]. The contributor-advice.md Scala/Java type table keeps the fully-qualified name on purpose.

Result

No remaining immutable.Seq qualifiers in main, test or doc sources. The types are identical (same erasure), so there is no API or binary change. Unlike the upstream PR, no MiMa filter was needed: there are no existential immutable.Seq[_] uses in this repo.

Tests

  • native scalafmt --mode diff-ref=origin/main run on all changed files
  • sbt Test/compile on Scala 2.13.18 and sbt "++3.3.8" Test/compile both pass with no unused-import warnings
  • sbt mimaReportBinaryIssues (all modules, Scala 2.13) passes
  • sbt csv/test xml/test file/test text/test simple-codecs/test reference/test pass (the Docker-backed modules are left to CI)
  • sbt docs/paradox builds

References

None - follows apache/pekko#3539

Motivation:
The codebase still qualified Seq as immutable.Seq throughout, a Scala
2.12-era habit. Since 2.13 (and on Scala 3) scala.Seq is an alias for
scala.collection.immutable.Seq, so the qualifier and the supporting
scala.collection.immutable imports are redundant. Mirrors apache/pekko#3539.

Modification:
- Replace immutable.Seq with Seq across 120 Scala files.
- Drop the now-unused scala.collection.immutable and
  scala.collection.immutable.Seq imports; reduce
  scala.collection.{ immutable, mutable } to scala.collection.mutable
  where only mutable remains in use.
- Keep scala.collection.immutable in files that still use
  immutable.Iterable, immutable.Map etc. immutable.Iterable is left
  unchanged because bare Iterable is scala.collection.Iterable.
- csv.md prose updated from immutable.Seq[String] to Seq[String].

Result:
No remaining immutable.Seq qualifiers in main, test or doc sources.
Types are identical (same erasure), so no API or binary change.

Tests:
- native scalafmt --mode diff-ref=origin/main
- sbt Test/compile (Scala 2.13.18) and sbt "++3.3.8" Test/compile
- sbt mimaReportBinaryIssues (all modules) passes, no filters needed
- sbt csv/test xml/test file/test text/test simple-codecs/test reference/test
- sbt docs/paradox

References:
None - follows apache/pekko#3539
@pjfanning
pjfanning merged commit 2c2837b into apache:main Sep 13, 2026
161 of 164 checks passed
@pjfanning
pjfanning deleted the remove-scala-212-idioms branch September 13, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants