Remove redundant Scala 2.12-era immutable.Seq imports - #617
Merged
Merged
Conversation
Motivation: Since Scala 2.13, `scala.Seq` is a type alias for `scala.collection.immutable.Seq`, and `Set`, `Vector`, `Nil` and friends in the `scala` package already refer to the immutable collections. The `scala.collection.immutable` imports and `immutable.Seq` qualifiers carried over from the Scala 2.12 days are therefore redundant now that this project only builds on 2.13 and 3. This is the pekko-persistence-jdbc counterpart of apache/pekko#3539. Modification: - Drop the now-unused `scala.collection.immutable` imports (`immutable._`, `immutable.Seq`, `immutable.Set`, `immutable.{ Nil, Seq }`, `immutable.{ Seq, Vector }`). - Replace `immutable.Seq` / `scala.collection.immutable.Seq` with plain `Seq`. - `MissingElements` keeps its `immutable.NumericRange` import since `NumericRange` is not aliased in `scala._`. `scala.Seq` erases to the same class, so the binary shape is unchanged. Result: No remaining Scala 2.12 collection idioms in main or test sources. Tests: - native `scalafmt --mode diff-ref=upstream/main` - `sbt "+core/Test/compile"` on Scala 2.13.18, 3.3.8 and 3.9.0 - `sbt core/mimaReportBinaryIssues` passes (signature problems enabled) - `sbt "core/Test/testOnly ...TrySeqTest ...BaseDaoSpec ...H2LimitWindowingStreamTest ...JdbcAsyncWriteJournalShutdownTest ...H2ScalaCurrentPersistenceIdsTest ...ByteArrayJournalSerializerTest"`: 16 tests, all passed (H2) - `git diff --check` clean References: Refs apache/pekko#3539
Philippus
approved these changes
Sep 13, 2026
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
Since Scala 2.13,
scala.Seqis a type alias forscala.collection.immutable.Seq, andSet,Vector,Niland friends in thescalapackage already refer to the immutable collections. Thescala.collection.immutableimports andimmutable.Seqqualifiers carried over from the Scala 2.12 days are therefore redundant now that this project only builds on 2.13 and 3.This is the pekko-persistence-jdbc counterpart of apache/pekko#3539. Of the idioms cleaned up there, only the
immutable.Seqone exists in this repo — there are noWrappedArray,filterKeys/mapValues,Eitherprojection,Streamor.toIteratoruses to touch.Modification
scala.collection.immutableimports (immutable._,immutable.Seq,immutable.Set,immutable.{ Nil, Seq },immutable.{ Seq, Vector }) across 23 files.immutable.Seq/scala.collection.immutable.Seqwith plainSeq.MissingElementskeeps itsimmutable.NumericRangeimport sinceNumericRangeis not aliased inscala._.scala.Seqerases to the same class, so the binary shape is unchanged. The one place where droppingimmutable._changes a resolved type is a localdef next(id: String): Iterable[String]insideJdbcReadJournal.persistenceIds(nowcollection.Iterableinstead ofimmutable.Iterable), which is a closure-local helper passed tostatefulMapConcatand not part of any API.Result
No remaining Scala 2.12 collection idioms in main or test sources.
Tests
scalafmt --mode diff-ref=upstream/mainsbt "+core/Test/compile"on Scala 2.13.18, 3.3.8 and 3.9.0sbt core/mimaReportBinaryIssuespasses (withmimaReportSignatureProblems := true)sbt "core/Test/testOnly ...TrySeqTest ...BaseDaoSpec ...H2LimitWindowingStreamTest ...JdbcAsyncWriteJournalShutdownTest ...H2ScalaCurrentPersistenceIdsTest ...ByteArrayJournalSerializerTest": 16 tests, all passed against H2git diff --checkcleanReferences
Refs apache/pekko#3539