Skip to content

chore: make code compiles with 3.8.4#3061

Closed
He-Pin wants to merge 2 commits into
mainfrom
scala3-upgrade-fix-warnings
Closed

chore: make code compiles with 3.8.4#3061
He-Pin wants to merge 2 commits into
mainfrom
scala3-upgrade-fix-warnings

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 13, 2026

Copy link
Copy Markdown
Member

Motivation

Upgrade Pekko's Scala 3 version from 3.3.8 to 3.8.4 for forward compatibility with the upcoming Scala 3.9 LTS. Several patterns valid in 3.3.x produce errors or warnings in 3.8.4 that must be addressed while preserving cross-compilation with Scala 2.13.

Modification

Scala version:

  • Bump scala3Version from 3.3.8 to 3.8.4

PersistencePlugin refactor:

  • Merge [T: ClassTag] context bound and (implicit ev: PluginProvider) into a single (implicit ct: ClassTag[T], ev: PluginProvider) parameter list, enabling subclasses to pass both arguments without the using keyword (cross-compatible with Scala 2.13 and 3.3.x)

ClassTag context bound fixes:

  • Replace explicit ClassTag passing method(ClassTag(clazz)) with implicit val ct = ClassTag(clazz); method pattern throughout the codebase (context bounds become using clauses in Scala 3.8, making positional passing an error)
  • Affects: Behavior, EventStream, Topic, ShardingProducerController, ShardedDaemonProcessImpl, StreamTestKit, EventSourcedBehaviorTestKit, ActorContextSpec

SortedSet/TreeSet ordering fixes:

  • Fix SortedSet.empty(ordering) / TreeSet.empty(ordering) across cluster, cluster-tools, cluster-sharding, distributed-data modules by binding the Ordering as an implicit val before calling .empty[Member]

JDK targeting:

  • Use -java-output-version for Scala 3.8+ instead of deprecated -release / -Xtarget

Misc fixes:

  • Add @unchecked to type-test patterns that cannot be checked at runtime (Reachability.scala, AskPattern.scala)
  • Fix _ wildcard type argument to ? in scala-3-only source files
  • Fix LogSource resolution in MultiNodeSpec (classOf instead of this.getClass)
  • Fix "pure expression does nothing" in FixedBufferSpec structural type calls
  • Remove discarded non-Unit value (unused Success) in SnapshotStorage
  • Add -Wconf suppression rules for Scala 3.8 deprecation and syntax warnings in PekkoDisciplinePlugin
  • Replace = _ with = null / = None / = false (deprecated in Scala 3.4+)
  • Replace private[this] / protected[this] with private / protected (deprecated in Scala 3.4+)

Result

All modules compile successfully with both Scala 2.13.18 and Scala 3.8.4. Cross-compilation with Scala 2.13 is preserved. No using keyword is used in shared source files — all changes use cross-compatible patterns.

Tests

  • sbt "++3.8.4" "compile" "Test / compile" — success
  • sbt "compile" "Test / compile" (Scala 2.13) — success (docs module has pre-existing unused warnings)
  • sbt "persistence / mimaReportBinaryIssues" — success
  • scalafmt --mode diff-ref=origin/main — success
  • sbt headerCreateAll — success

References

None - proactive Scala 3 forward compatibility

He-Pin added 2 commits June 14, 2026 01:06
… cross-build

Motivation:
The codebase needs to compile with both Scala 3.3.x (current production) and
Scala 3.8.4 (forward compatibility for upcoming 3.9 LTS). Several patterns
valid in 3.3.x are errors or warnings in 3.8.4.

Modification:
- Merge PersistencePlugin [T: ClassTag] context bound and (implicit ev:
  PluginProvider) into a single implicit parameter list so subclasses can
  pass both arguments without the `using` keyword (cross-compatible with
  Scala 2.13 and 3.3.x)
- Replace explicit ClassTag passing `method(arg)(ClassTag(clazz))` with
  `implicit val ct = ClassTag(clazz); method(arg)` pattern throughout the
  codebase (context bounds become `using` clauses in Scala 3.8, making
  positional passing an error)
- Fix SortedSet.empty(ordering) / TreeSet.empty(ordering) across cluster,
  cluster-tools, cluster-sharding, distributed-data modules by binding the
  Ordering as an implicit val before calling .empty[Member]
- Add @unchecked to type-test patterns that cannot be checked at runtime
  (Reachability.scala, AskPattern.scala)
- Fix `_` wildcard type argument to `?` in scala-3-only source files
- Fix LogSource resolution in MultiNodeSpec (classOf instead of this.getClass)
- Fix "pure expression does nothing" in FixedBufferSpec structural type calls
- Remove discarded non-Unit value (unused Success) in SnapshotStorage
- Add -Wconf suppression rules for Scala 3.8 deprecation and syntax warnings
  in PekkoDisciplinePlugin (both main and test scopes)

Result:
All modules compile successfully with both Scala 2.13.18 and Scala 3.8.4.
Cross-compilation with Scala 2.13 is preserved. No `using` keyword is used
in shared source files.

Tests:
- sbt "++3.8.4" "Test / compile" — success
- sbt "Test / compile" (2.13) — success (docs module has pre-existing unused warnings)

References:
None - proactive Scala 3.8 forward compatibility
Motivation:
Forward compatibility with upcoming Scala 3.9 LTS requires upgrading
from the current 3.3.8 to 3.8.4.

Modification:
Bump scala3Version in Dependencies.scala to 3.8.4.

Result:
Build now targets Scala 2.13.18 and 3.8.4 for cross-compilation.

Tests:
- sbt "++3.8.4" "compile" "Test / compile" — success
- sbt "compile" "Test / compile" (2.13) — success

References:
None - proactive Scala 3 forward compatibility
@He-Pin He-Pin marked this pull request as draft June 13, 2026 17:40
@He-Pin He-Pin changed the title Upgrade Scala 3 to 3.8.4 and fix all compilation warnings WIP: Try make code compiles with 3.8.4 Jun 13, 2026
@He-Pin He-Pin marked this pull request as ready for review June 13, 2026 18:12
@He-Pin He-Pin requested a review from pjfanning June 13, 2026 18:12
@He-Pin He-Pin changed the title WIP: Try make code compiles with 3.8.4 chore: make code compiles with 3.8.4 Jun 13, 2026
@He-Pin He-Pin closed this Jun 13, 2026
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