Fix Scala 3.8+ compilation warnings for forward compatibility#528
Merged
Conversation
Motivation: Scala 3.8+ introduces new deprecation warnings for patterns like implicit parameter passing without `using`, wildcard type arguments with `_`, trailing ` _` for eta-expansion, and `with` as a type operator. These warnings need to be addressed for forward compatibility with Scala 3.9.x while maintaining cross-build support for Scala 2.13.x and 3.3.x. Modification: - Move Scala 2-only compiler options (-Xlog-reflective-calls, -Ydelambdafy:method) out of shared scalacOptions into the Scala 2 conditional block - Add -Wconf suppressions for Scala 3.8+ warnings that cannot be fixed with cross-version compatible syntax (implicit using clause, wildcard type arguments, eta-expansion trailing underscore, with type operator, unreachable case except for null) Result: All 74 compiler warnings eliminated when compiling with Scala 3.8.4. Scala 2.13.18 compilation remains unaffected. No behavioral changes. Tests: - sbt "++3.8.4" "core / compile" — 0 warnings (previously 74) - sbt "++2.13.18" "core / compile" — success, no new warnings References: Refs apache/pekko#3065
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
Scala 3.8+ introduces new deprecation warnings that prevent clean compilation under forward-looking Scala versions (3.8.x / 3.9.x). These warnings need to be addressed for forward compatibility with Scala 3.9.x while maintaining cross-build support for Scala 2.13.x and 3.3.x.
Modification
-Xlog-reflective-calls,-Ydelambdafy:method) out of sharedscalacOptionsinto the Scala 2 conditional block to eliminate "bad option" warnings in Scala 3-Wconfsuppressions for Scala 3.8+ warnings that cannot be fixed with cross-version compatible syntax:usingclause (requiresusingkeyword, Scala 3 only)_deprecated for wildcard type arguments (?is Scala 3.4+ only)_for eta-expansion (removal requires Scala 3-only syntax in some contexts)withas type operator deprecated (&intersection type operator)-Yfuture-lazy-valson Scala 3.8+Result
All 74 compiler warnings eliminated when compiling with Scala 3.8.4. Scala 2.13.18 compilation remains unaffected. Production Scala versions unchanged (2.13.18 / 3.3.8). No behavioral changes to the runtime.
Tests
sbt "++3.8.4" "core / compile"— 0 warnings (previously 74)sbt "++2.13.18" "core / compile"— success, no new warningsReferences
Refs apache/pekko#3065 - None - Forward compatibility for Scala 3.8+/3.9.x