Skip to content

chore: remove leftover Scala 2.12 idioms - #970

Merged
pjfanning merged 1 commit into
apache:mainfrom
pjfanning:remove-scala212-idioms
Sep 12, 2026
Merged

pjfanning merged 1 commit into
apache:mainfrom
pjfanning:remove-scala212-idioms

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Motivation

The codebase still carried the Scala 2.12-era immutable.Seq qualifier (and its scala.collection.immutable / scala.collection.immutable.Seq imports). On Scala 2.13 and 3, scala.Seq is already an alias for scala.collection.immutable.Seq, so the qualifier is redundant. This is the pekko-management equivalent of apache/pekko#3539.

Unlike the core repo, there were no other 2.12 idioms to clean up here: no WrappedArray, filterKeys/mapValues, .toIterator, Stream, or Either projections, and no paradox anchors referencing immutable.Seq.

Modification

  • Replace immutable.Seq with Seq across 24 files and drop the now-unused scala.collection.immutable, scala.collection.immutable.Seq and scala.collection.{ immutable => im } imports.
  • Files that still use other immutable.* types (Set, Iterable, SortedSet) keep the scala.collection.immutable import (ClusterHttpManagementProtocol, BootstrapCoordinator, PodDeletionCostAnnotator).
  • ClusterHttpManagementRoutesSpec: swap the scala.collection.immutable._ wildcard for an explicit SortedSet import.
  • ConsulServiceDiscovery: drop the redundant scala.collection.immutable.Seq(targets: _*) copy, since targets is already an immutable Seq.

Result

No remaining Scala 2.12 collection idioms in main or test sources. Source- and binary-compatible: Seq has the same erasure, so MiMa passes without new filters.

Tests

  • native scalafmt --mode diff-ref=upstream/main
  • sbt +Test/compile passes on Scala 2.13, 3.3 and 3-next
  • sbt <module>/mimaReportBinaryIssues passes for all touched modules (management, management-cluster-http, management-cluster-bootstrap, discovery-kubernetes-api, discovery-marathon-api, discovery-aws-api, discovery-aws-api-async, discovery-consul, lease-kubernetes, rolling-update-kubernetes)
  • sbt <module>/test passes for all touched modules; ConsulDiscoverySpec not run locally as it requires Docker/testcontainers (relying on CI)

References

None - equivalent of apache/pekko#3539

Motivation:
The codebase still carried the Scala 2.12-era immutable.Seq qualifier
(and its scala.collection.immutable / immutable.Seq imports). On Scala
2.13 and 3, scala.Seq is already an alias for
scala.collection.immutable.Seq, so the qualifier is redundant.

Modification:
Replace immutable.Seq with Seq across 24 files and drop the now-unused
scala.collection.immutable, scala.collection.immutable.Seq and
scala.collection.{ immutable => im } imports. Files that still use other
immutable.* types (Set, Iterable, SortedSet) keep the import.
ClusterHttpManagementRoutesSpec swaps its scala.collection.immutable._
wildcard for an explicit SortedSet import. ConsulServiceDiscovery drops
a redundant scala.collection.immutable.Seq(targets: _*) copy since
targets is already an immutable Seq.

Result:
No remaining Scala 2.12 collection idioms in main or test sources.
Source- and binary-compatible: same erasure, MiMa passes unchanged.

Tests:
- native scalafmt --mode diff-ref=upstream/main
- sbt +Test/compile (Scala 2.13, 3.3, 3.next) passes
- sbt mimaReportBinaryIssues on all touched modules passes
- sbt test on all touched modules passes (ConsulDiscoverySpec not run:
  requires Docker/testcontainers locally)

References:
None - equivalent of apache/pekko#3539
@pjfanning
pjfanning merged commit 44e6270 into apache:main Sep 12, 2026
13 checks passed
@pjfanning
pjfanning deleted the remove-scala212-idioms branch September 12, 2026 11:16
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