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-projection.git


The following commit(s) were added to refs/heads/main by this push:
     new 5c35221f fix: Scala 3.9 compatibility fixes (#529)
5c35221f is described below

commit 5c35221fce78276026fdbd7d93018e59b961a8d2
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Fri Jun 19 01:20:49 2026 +0800

    fix: Scala 3.9 compatibility fixes (#529)
    
    * fix: Scala 3.9 compatibility fixes
    
    Motivation:
    Scala 3.9.0-RC1 introduces stricter rules: type ascriptions after tuple
    destructuring patterns are no longer supported, and `-1.millis` is flagged
    as an illegal literal under -Werror.
    
    Modification:
    - SlickOffsetStore: remove type ascription from tuple destructuring pattern
    - R2dbcProjectionSettings: parenthesize negative literal to (-1).millis
    
    Result:
    pekko-projection compiles cleanly with Scala 3.9.0-RC1.
    
    Tests:
    - sbt "++3.9.0-RC1!; compile; Test/compile" passes
    
    References: None - Scala 3.9 forward compatibility
    
    * fix: make -Yfuture-lazy-vals conditional for Scala 3.9+
    
    Motivation:
    Scala 3.9 removed the -Yfuture-lazy-vals compiler option as the behavior
    is now the default. Passing this flag causes compilation errors on Scala 
3.9+.
    
    Modification:
    Conditionally add -Yfuture-lazy-vals only when Scala minor version < 9
    using CrossVersion.partialVersion check.
    
    Result:
    Project compiles on both Scala 3.3.x (which needs the flag) and
    Scala 3.9+ (which has the behavior by default).
    
    * fix: apply scalafmt and remove unused Dialect import
    
    Motivation:
    CI failed due to unformatted PekkoDisciplinePlugin.scala and unused import
    of Dialect in SlickOffsetStore.scala causing -Werror compilation failure.
    
    Modification:
    - Ran scalafmt on project/PekkoDisciplinePlugin.scala
    - Removed unused import pekko.projection.jdbc.internal.Dialect
    
    Result:
    scalafmtSbtCheck, Code is formatted, and compilation checks should pass.
    
    Tests:
    Not run - formatting and unused import removal
---
 project/PekkoDisciplinePlugin.scala                                | 7 ++++---
 .../apache/pekko/projection/r2dbc/R2dbcProjectionSettings.scala    | 2 +-
 .../apache/pekko/projection/slick/internal/SlickOffsetStore.scala  | 3 +--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/project/PekkoDisciplinePlugin.scala 
b/project/PekkoDisciplinePlugin.scala
index e9bb72bd..c2caaf89 100644
--- a/project/PekkoDisciplinePlugin.scala
+++ b/project/PekkoDisciplinePlugin.scala
@@ -46,7 +46,6 @@ object PekkoDisciplinePlugin extends AutoPlugin {
                 "-Wconf:msg=scala/bug#7014:s")
             case Some((3, _)) =>
               Set(
-                "-Yfuture-lazy-vals",
                 "-release:17",
                 "-Wconf:msg=Implicit parameters should be provided with a 
`using` clause:s",
                 "-Wconf:msg=is deprecated for wildcard arguments of types:s",
@@ -57,8 +56,10 @@ object PekkoDisciplinePlugin extends AutoPlugin {
                 "-Wconf:msg=is not declared infix:s",
                 "-Wconf:msg=Xfatal-warnings is a deprecated alias:s",
                 "-Wconf:msg=Ignoring \\[this\\] qualifier:s",
-                "-Wconf:msg=trait App in package scala is deprecated:s",
-                "-Wconf:msg=bad option.*-Yfuture-lazy-vals:s")
+                "-Wconf:msg=trait App in package scala is deprecated:s") ++
+              (if (CrossVersion.partialVersion(scalaVersion.value).exists(_._2 
< 9))
+                 Seq("-Yfuture-lazy-vals", "-Wconf:msg=bad 
option.*-Yfuture-lazy-vals:s")
+               else Seq.empty)
             case _ =>
               Nil
           }).toSeq,
diff --git 
a/r2dbc/src/main/scala/org/apache/pekko/projection/r2dbc/R2dbcProjectionSettings.scala
 
b/r2dbc/src/main/scala/org/apache/pekko/projection/r2dbc/R2dbcProjectionSettings.scala
index 8a3794b5..7330f554 100644
--- 
a/r2dbc/src/main/scala/org/apache/pekko/projection/r2dbc/R2dbcProjectionSettings.scala
+++ 
b/r2dbc/src/main/scala/org/apache/pekko/projection/r2dbc/R2dbcProjectionSettings.scala
@@ -32,7 +32,7 @@ object R2dbcProjectionSettings {
   def apply(config: Config): R2dbcProjectionSettings = {
     val logDbCallsExceeding: FiniteDuration =
       config.getString("log-db-calls-exceeding").toLowerCase(Locale.ROOT) 
match {
-        case "off" => -1.millis
+        case "off" => (-1).millis
         case _     => config.getDuration("log-db-calls-exceeding").toScala
       }
 
diff --git 
a/slick/src/main/scala/org/apache/pekko/projection/slick/internal/SlickOffsetStore.scala
 
b/slick/src/main/scala/org/apache/pekko/projection/slick/internal/SlickOffsetStore.scala
index 0e1ade78..dffc9c61 100644
--- 
a/slick/src/main/scala/org/apache/pekko/projection/slick/internal/SlickOffsetStore.scala
+++ 
b/slick/src/main/scala/org/apache/pekko/projection/slick/internal/SlickOffsetStore.scala
@@ -25,7 +25,6 @@ import pekko.projection.MergeableOffset
 import pekko.projection.ProjectionId
 import pekko.projection.internal.ManagementState
 import pekko.projection.internal.OffsetSerialization
-import pekko.projection.jdbc.internal.Dialect
 import pekko.projection.jdbc.internal.H2Dialect
 import pekko.projection.jdbc.internal.JdbcSessionUtil
 import pekko.projection.jdbc.internal.MSSQLServerDialect
@@ -54,7 +53,7 @@ import slick.jdbc.JdbcProfile
   import OffsetSerialization.MultipleOffsets
   import OffsetSerialization.SingleOffset
 
-  val (dialect, useLowerCase): (Dialect, Boolean) = {
+  val (dialect, useLowerCase) = {
 
     val useLowerCase = slickSettings.useLowerCase
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to