This is an automated email from the ASF dual-hosted git repository.
He-Pin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-persistence-jdbc.git
The following commit(s) were added to refs/heads/main by this push:
new e06f2d31 chore: Fix Scala 3.8+ compilation warnings for forward
compatibility (#528)
e06f2d31 is described below
commit e06f2d31b93dd05eee2f55717bb6324093874747
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Mon Jun 15 02:03:26 2026 +0800
chore: Fix Scala 3.8+ compilation warnings for forward compatibility (#528)
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
---
project/ProjectAutoPlugin.scala | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/project/ProjectAutoPlugin.scala b/project/ProjectAutoPlugin.scala
index dc530b9f..48f85700 100644
--- a/project/ProjectAutoPlugin.scala
+++ b/project/ProjectAutoPlugin.scala
@@ -46,20 +46,25 @@ object ProjectAutoPlugin extends AutoPlugin {
"-encoding",
"UTF-8",
"-unchecked",
- "-Xlog-reflective-calls",
"-language:higherKinds",
"-language:implicitConversions",
"-release:17"),
Compile / scalacOptions ++=
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) =>
- disciplineScalacOptions
+ disciplineScalacOptions ++ Set("-Xlog-reflective-calls")
case Some((3, _)) =>
- Set("-Yfuture-lazy-vals")
+ Set(
+ "-Yfuture-lazy-vals",
+ "-Wconf:msg=Implicit parameters should be provided with a `using`
clause:s",
+ "-Wconf:msg=is deprecated for wildcard arguments of types:s",
+ "-Wconf:msg=The trailing ` _` for eta-expansion is unnecessary:s",
+ "-Wconf:msg=with as a type operator has been deprecated:s",
+ "-Wconf:msg=Unreachable case except for null:s",
+ "-Wconf:msg=bad option.*-Yfuture-lazy-vals:s")
case _ =>
Nil
}).toSeq,
- scalacOptions += "-Ydelambdafy:method",
Compile / javacOptions ++= Seq(
"-encoding",
"UTF-8",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]