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


The following commit(s) were added to refs/heads/main by this push:
     new 96e7e934 Add -Yfuture-lazy-vals for Scala 3.3.x builds (#825)
96e7e934 is described below

commit 96e7e934f69f3607c426350d0634f8ad2c4b1fa4
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Sun Jun 14 19:16:45 2026 +0800

    Add -Yfuture-lazy-vals for Scala 3.3.x builds (#825)
    
    * 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
    
    * fix: Add MiMa filter for HttpBootstrapJsonProtocol <clinit>
    
    -Yfuture-lazy-vals changes the generated bytecode for companion
    objects containing lazy vals: the static <clinit> initializer
    is no longer emitted. Add MiMa filter to exclude this expected
    binary compatibility change.
---
 .../future-lazy-vals.excludes                       | 21 +++++++++++++++++++++
 project/Common.scala                                |  3 ++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git 
a/management-cluster-bootstrap/src/main/mima-filters/2.0.x.backwards.excludes/future-lazy-vals.excludes
 
b/management-cluster-bootstrap/src/main/mima-filters/2.0.x.backwards.excludes/future-lazy-vals.excludes
new file mode 100644
index 00000000..40e7617d
--- /dev/null
+++ 
b/management-cluster-bootstrap/src/main/mima-filters/2.0.x.backwards.excludes/future-lazy-vals.excludes
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# -Yfuture-lazy-vals changes the generated bytecode for companion objects
+# containing lazy vals: the static <clinit> initializer that was produced
+# by the old sun.misc.Unsafe-based implementation is no longer emitted.
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.management.cluster.bootstrap.contactpoint.HttpBootstrapJsonProtocol.<clinit>")
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