chore: make code compiles with 3.8.4#3061
Closed
He-Pin wants to merge 2 commits into
Closed
Conversation
… 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
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
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:
scala3Versionfrom3.3.8to3.8.4PersistencePlugin refactor:
[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 theusingkeyword (cross-compatible with Scala 2.13 and 3.3.x)ClassTag context bound fixes:
ClassTagpassingmethod(ClassTag(clazz))withimplicit val ct = ClassTag(clazz); methodpattern throughout the codebase (context bounds becomeusingclauses in Scala 3.8, making positional passing an error)Behavior,EventStream,Topic,ShardingProducerController,ShardedDaemonProcessImpl,StreamTestKit,EventSourcedBehaviorTestKit,ActorContextSpecSortedSet/TreeSet ordering fixes:
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:
-java-output-versionfor Scala 3.8+ instead of deprecated-release/-XtargetMisc fixes:
@uncheckedto type-test patterns that cannot be checked at runtime (Reachability.scala,AskPattern.scala)_wildcard type argument to?in scala-3-only source filesLogSourceresolution inMultiNodeSpec(classOfinstead ofthis.getClass)FixedBufferSpecstructural type callsSuccess) inSnapshotStorage-Wconfsuppression rules for Scala 3.8 deprecation and syntax warnings inPekkoDisciplinePlugin= _with= null/= None/= false(deprecated in Scala 3.4+)private[this]/protected[this]withprivate/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
usingkeyword is used in shared source files — all changes use cross-compatible patterns.Tests
sbt "++3.8.4" "compile" "Test / compile"— successsbt "compile" "Test / compile"(Scala 2.13) — success (docs module has pre-existing unused warnings)sbt "persistence / mimaReportBinaryIssues"— successscalafmt --mode diff-ref=origin/main— successsbt headerCreateAll— successReferences
None - proactive Scala 3 forward compatibility