Fix Scala 3.8.4 compilation compatibility while preserving 2.13 and 3.3.x cross-build#3060
Draft
He-Pin wants to merge 1 commit into
Draft
Fix Scala 3.8.4 compilation compatibility while preserving 2.13 and 3.3.x cross-build#3060He-Pin wants to merge 1 commit into
He-Pin wants to merge 1 commit into
Conversation
812a6d1 to
913415e
Compare
… 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
913415e to
462dff8
Compare
He-Pin
added a commit
that referenced
this pull request
Jun 13, 2026
…ations Motivation: The initial Scala 3.8 compatibility changes had some code duplication, unnecessary type casts, and could be simplified in several places. Modification: - Extract shared isScala3_8Plus method in JdkOptions to eliminate duplication with Jdk9.scala - Re-add Scala 3.8 -Wconf suppressions in PekkoDisciplinePlugin with deduplication using shared scala3Suppressions/scala3DocSuppressions - Simplify BehaviorTestKitSpec messageAdapter by removing unnecessary asInstanceOf and using proper ClassTag[U] type parameter - Simplify ActorContextSpec ClassTag.Null passing by using explicit parameter instead of implicit val with @nowarn Result: Cleaner, more maintainable Scala 3.8 compatibility code with less duplication and unnecessary type casts. Tests: Not run - code simplifications only, no behavior changes References: Refs #3060
He-Pin
added a commit
that referenced
this pull request
Jun 13, 2026
…estKit Motivation: PR #3060 CI was failing with two categories of errors on Scala 2.13: 1. ~100 fatal warnings in docs/Test/compile from unused imports, locals, and pattern variables that were not suppressed 2. "not found: type U" in BehaviorTestKitSpec due to type erasure in pattern matching Modification: - PekkoDisciplinePlugin: add docsScala2Suppressions with explicit -Wconf rules for each unused subcategory (unused-imports, unused-locals, unused-pat-vars, etc.) because Scala 2.13's -Wconf uses exact string matching, so cat=unused:s does not match subcategories - BehaviorTestKitSpec: revert ClassTag[U] change back to explicit ClassTag(messageClass) passing since U is not in scope during pattern matching of CreateMessageAdapter Result: docs/Test/compile and actor-testkit-typed/Test/compile pass on both Scala 2.13.18 and 3.3.8 Tests: - sbt "++ 2.13.18 docs/Test/compile" — success (30 compilation units) - sbt "++ 3.3.8 docs/Test/compile" — success - sbt "++ 2.13.18 actor-testkit-typed/Test/compile" — success - sbt "++ 3.3.8 actor-testkit-typed/Test/compile" — success References: Fixes CI failures on PR #3060
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
The codebase needs to compile with both Scala 3.3.x (current production) and Scala 3.8.4 (forward compatibility for the upcoming 3.9 LTS). Several patterns in the codebase break under Scala 3.8 due to changes in how context bounds are desugared (they become
usingclauses), stricter deprecation warnings, and syntax changes.Modification
171 files changed across the codebase:
ClassTag context bound fixes: In Scala 3.8,
[T: ClassTag]desugars to ausingclause, making explicitClassTagpassing positional-incompatible. Fixed by usingimplicit val ct: ClassTag[T] = ClassTag(clazz)in scope and relying on implicit resolution instead of explicit passing. Key files:PersistencePlugin.scala,EventSourcedBehaviorTestKit.scala,ActorContextSpec.scala,BehaviorTestKitSpec.scala,Behavior.scala,EventStream.scala,Topic.scala,ShardingProducerController.scala,ShardedDaemonProcessImpl.scala,StreamTestKit.scala.PersistencePlugin implicit parameter merge: Merged
[T: ClassTag]context bound and(implicit ev: PluginProvider[...])into a singleimplicitparameter list(implicit ct: ClassTag[T], ev: PluginProvider[T, ScalaDsl, JavaDsl])to avoid context bound + separate implicit parameter mismatch in Scala 3.8..apply()trick: Useddecoration[T].apply(behavior)instead ofdecoration[T](behavior)to separate implicit resolution from function application (Scala 2.13 interprets(behavior)as the implicit ClassTag argument).private[this]→private: Scala 3.8 deprecatesprivate[this]in favor ofprivate.= _initializers → explicit defaults: Replaced= _with= null,= None,= 0, etc. as Scala 3.8 deprecates uninitialized vars.SortedSet.empty(ordering)fix: Bound ordering asimplicit val ordbefore calling.empty[Member]to avoid implicit resolution issues.@uncheckedannotations: Added for type-test patterns that can't be checked at runtime under Scala 3.@nowarnfilters: Used message-based@nowarn("msg=never used")instead of category-based filters for cross-version compatibility.PekkoDisciplinePlugin.scala: Added-Wconfsuppression rules for Scala 3.8 deprecation/syntax warnings in both main and test scopes.No
usingkeyword in shared sources: All changes use cross-compatible patterns (implicit val,.apply()trick). Theusingkeyword only appears inscala-3/directories.Result
All modules compile with both Scala 2.13.18 and Scala 3.8.4. Production Scala 3 version remains at 3.3.8 — this change only ensures forward compatibility. No behavioral changes to the runtime.
Tests
sbt "++3.8.4" "Test / compile"— success across all modulessbt "Test / compile"(Scala 2.13.18) — success across all modulesReferences
None - proactive Scala 3.8 forward compatibility