This is an automated email from the ASF dual-hosted git repository.

He-Pin pushed a commit to branch add-future-lazy-vals
in repository https://gitbox.apache.org/repos/asf/pekko-management.git

commit 5a03adbec938407032dda30f88c28eb3656fde8a
Author: 虎鸣 <[email protected]>
AuthorDate: Sun Jun 14 18:25:49 2026 +0800

    feat: Add -Yfuture-lazy-vals for Scala 3.3.x builds
    
    Motivation:
    The Scala 3.3.8 compiler introduced the -Yfuture-lazy-vals flag to
    optionally use VarHandle instead of sun.misc.Unsafe for lazy val
    implementation. This prepares libraries for upcoming JDK releases
    that restrict sun.misc.Unsafe access.
    
    Modification:
    Add -Yfuture-lazy-vals to scalacOptions, conditionally applied only
    for Scala 3.3.x via CrossVersion.partialVersion or scalaBinaryVersion.
    
    Result:
    Scala 3.3.x build uses the future-proof VarHandle-based lazy val
    implementation, compatible with all JDK 9+ versions including future
    releases that restrict sun.misc.Unsafe.
    
    References:
    Refs scala/scala3-lts#637
    Refs apache/pekko#3059
---
 project/Common.scala | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/project/Common.scala b/project/Common.scala
index 25f19f55..a5cacbfe 100644
--- a/project/Common.scala
+++ b/project/Common.scala
@@ -55,7 +55,8 @@ object Common extends AutoPlugin {
             "-Wdead-code")
         else if (scalaVersion.value == Dependencies.scala3Version)
           scalacOptionsBase ++: Seq(
-            "-Werror")
+            "-Werror",
+            "-Yfuture-lazy-vals")
         else
           scalacOptionsBase
       },


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

Reply via email to