You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by he...@apache.org on 2026/06/14 10:26:16 UTC

(pekko-connectors-kafka) 01/01: feat: Add -Yfuture-lazy-vals for Scala 3.3.x builds

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-connectors-kafka.git

commit 6974a7315a228828a856d0657e416645a7759de9
Author: 虎鸣 <he...@alibaba-inc.com>
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/ProjectSettings.scala | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/project/ProjectSettings.scala b/project/ProjectSettings.scala
index 6c20373b..b1ab6431 100644
--- a/project/ProjectSettings.scala
+++ b/project/ProjectSettings.scala
@@ -93,6 +93,10 @@ object ProjectSettings extends AutoPlugin {
       if (insideCI.value && !Nightly && scalaVersion.value.startsWith("2.")) Seq("-Werror")
       else Seq.empty
     },
+    scalacOptions ++= {
+      if (scalaBinaryVersion.value == "3") Seq("-Yfuture-lazy-vals")
+      else Seq.empty
+    },
     Compile / doc / scalacOptions := scalacOptions.value ++ Seq(
       "-Wconf:cat=scaladoc:i",
       "-doc-title",


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org