Skip to content

chore: remove leftover Scala 2.12 idioms - #366

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

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

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Motivation

Port of apache/pekko#3539 to this repo. The codebase still carried immutable.Seq qualifiers, a Scala 2.12-era idiom that is redundant on Scala 2.13/3, where scala.Seq is already a type alias for scala.collection.immutable.Seq.

Of the other idioms cleaned up in the pekko PR (WrappedArray, filterKeys/mapValues, Either left/right projections, .toIterator, Stream), none are present in this repo.

Modification

  • DynamoDBJournal.asyncWriteMessages: immutable.Seq[AtomicWrite] / Future[immutable.Seq[Try[Unit]]] -> Seq[...], dropping the now-unused scala.collection.immutable import.
  • PartitionKeys.partitionEventNums: immutable.Seq[Long] -> Seq[Long]. The immutable import in DynamoDBRecovery stays since immutable.Iterable / immutable.TreeMap still use it.
  • DynamoPartitionGroupedSpec: scala.collection.immutable.Seq(300L) -> Seq(300L).

Same erasure, so this is source- and binary-compatible.

Result

No remaining Scala 2.12 collection idioms in main or test sources.

Tests

  • scalafmt --list --mode diff-ref=upstream/main (clean)
  • sbt +Test/compile (Scala 2.13.18, 3.3.8, 3.9.0)
  • sbt "testOnly org.apache.pekko.persistence.dynamodb.journal.DynamoPartitionGroupedSpec" - 5/5 pass
  • sbt mimaReportBinaryIssues reports 2 problems on DynamoDBHelper.dynamoDB (result type AmazonDynamoDBAsyncClient -> AmazonDynamoDBAsync vs 1.0.0). These are pre-existing and fail identically on main without this change; nothing new is introduced here.

References

Refs apache/pekko#3539

Motivation:
The codebase still carried `immutable.Seq` qualifiers, a Scala 2.12-era
idiom that is redundant on Scala 2.13/3 where `scala.Seq` is already an
alias for `scala.collection.immutable.Seq`.

Modification:
Replace `immutable.Seq` with `Seq` in `DynamoDBJournal.asyncWriteMessages`,
`PartitionKeys` and `DynamoPartitionGroupedSpec`, dropping the now-unused
`scala.collection.immutable` import in `DynamoDBJournal`. The import in
`DynamoDBRecovery` stays since `immutable.Iterable`/`immutable.TreeMap`
still use it.

Result:
No remaining Scala 2.12 collection idioms in main or test sources. Same
erasure, so source- and binary-compatible.

Tests:
- scalafmt --list --mode diff-ref=upstream/main (clean)
- sbt +Test/compile
- sbt "testOnly org.apache.pekko.persistence.dynamodb.journal.DynamoPartitionGroupedSpec"
- sbt mimaReportBinaryIssues: reports 2 pre-existing DynamoDBHelper.dynamoDB
  problems that also fail on upstream/main; nothing new from this change

References:
Refs 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