Skip to content

Remove leftover Scala 2.12 collection idioms - #886

Open
pjfanning wants to merge 1 commit into
apache:mainfrom
pjfanning:remove-scala-212-idioms
Open

pjfanning wants to merge 1 commit into
apache:mainfrom
pjfanning:remove-scala-212-idioms

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Motivation

The 2.13/3-only modules still carried Scala 2.12-era idioms: immutable.Seq qualifiers (scala.Seq has been immutable.Seq since 2.13) and .toIterator in the scripted interop test.

This is the pekko-grpc equivalent of apache/pekko#3539.

Modification

  • Replace immutable.Seq with Seq in runtime, interop-tests, benchmarks and the gen-scala-server/00-interop scripted test (all built for 2.13/3 only) and drop the now-unused scala.collection.immutable imports.
  • requests.toIterator -> requests.iterator in PekkoGrpcClientTester (scripted test).
  • codegen, maven-plugin, sbt-plugin main sources and scalapb-protoc-plugin still cross-build for Scala 2.12, where scala.Seq is collection.Seq, so they are intentionally left unchanged (same reasoning as project/ in the pekko PR).

The other idioms covered by the pekko PR (WrappedArray, filterKeys/mapValues, Either projections, Stream) have no occurrences in this repo.

Result

No remaining Scala 2.12 collection idioms in the 2.13/3-only modules. Source and binary compatible: scala.Seq is a type alias for scala.collection.immutable.Seq on 2.13 and 3, so erasure and Java generic signatures are unchanged; no MiMa filters needed.

Tests

  • native scalafmt on all changed files
  • sbt runtime/mimaReportBinaryIssues on 2.13.18 and 3.3.8: passes (compared against 1.0.2)
  • sbt runtime/test on 2.13.18: 178 passed
  • sbt runtime/Test/compile interop-tests/Test/compile benchmarks/compile on 2.13.18 and 3.3.8
  • sbt "sbt-plugin/scripted gen-scala-server/00-interop": passes

References

None - equivalent of apache/pekko#3539

Motivation:
The 2.13/3-only modules still carried Scala 2.12-era idioms:
`immutable.Seq` qualifiers (`scala.Seq` has been `immutable.Seq`
since 2.13) and `.toIterator` in the scripted interop test.
Equivalent of apache/pekko#3539.

Modification:
- Replace `immutable.Seq` with `Seq` in runtime, interop-tests,
  benchmarks and the `gen-scala-server/00-interop` scripted test
  (all built for 2.13/3 only) and drop the now-unused
  `scala.collection.immutable` imports.
- `requests.toIterator` -> `requests.iterator` in
  `PekkoGrpcClientTester` (scripted test).
- `codegen`, `maven-plugin`, `sbt-plugin` main sources and
  `scalapb-protoc-plugin` still cross-build for 2.12 where
  `scala.Seq` is `collection.Seq`, so they are left unchanged.

Result:
No remaining Scala 2.12 collection idioms in the 2.13/3-only modules.
Source and binary compatible: `scala.Seq` is a type alias for
`scala.collection.immutable.Seq` on 2.13 and 3, so the erasure and
generic signatures are unchanged.

Tests:
- native scalafmt on all changed files
- sbt runtime/mimaReportBinaryIssues on 2.13.18 and 3.3.8: passes
- sbt runtime/test on 2.13.18: 178 passed
- sbt runtime/Test/compile interop-tests/Test/compile benchmarks/compile
  on 2.13.18 and 3.3.8
- sbt "sbt-plugin/scripted gen-scala-server/00-interop": passes

References:
None - equivalent of apache/pekko#3539
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.

1 participant