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.git
The following commit(s) were added to refs/heads/main by this push:
new bf54798054 Add -Yfuture-lazy-vals for Scala 3.3.x builds (#3059)
bf54798054 is described below
commit bf54798054542de57fc0348ad1c83c536698af82
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Sun Jun 14 17:41:16 2026 +0800
Add -Yfuture-lazy-vals for Scala 3.3.x builds (#3059)
* Add -Yfuture-lazy-vals for Scala 3.3.x builds
Motivation:
The Scala 3.3.8 compiler introduced the -Yfuture-lazy-vals flag
(scala/scala3-lts#637) to optionally use VarHandle instead of
sun.misc.Unsafe for lazy val implementation. This prepares libraries
for upcoming JDK releases that restrict Unsafe access.
Modification:
Add -Yfuture-lazy-vals to DefaultScalacOptions in PekkoBuild.scala,
conditionally applied only for Scala 3.3.x via CrossVersion.partialVersion.
Result:
Pekko's Scala 3.3.x build uses the future-proof VarHandle-based lazy
val implementation, compatible with all JDK 9+ versions.
Tests:
- sbt "++3.3.8; actor/compile" passed (exit 0, 54 pre-existing warnings)
References:
Refs scala/scala3-lts#637
* Add MiMa filter for -Yfuture-lazy-vals bytecode change
The -Yfuture-lazy-vals flag changes the generated bytecode for
companion objects containing lazy vals: the static <clinit>
initializer produced by the old sun.misc.Unsafe-based implementation
is no longer emitted. Add a MiMa filter to exclude this expected
binary incompatibility for RemoteWatcher#Stats.
Tests:
- sbt "++3.3.8; remote/mimaReportBinaryIssues" passed (exit 0)
* Simplify -Yfuture-lazy-vals flag addition per PR review
Motivation:
PR #3059 review feedback from pjfanning requested simplifying the
conditional CrossVersion.partialVersion match for -Yfuture-lazy-vals.
Modification:
Add -Yfuture-lazy-vals directly to the Scala 3 scalac options Seq
instead of using a CrossVersion.partialVersion conditional match.
Result:
Cleaner, simpler build configuration that still applies the flag
to all Scala 3.x builds.
Tests:
Not run - build config simplification only
References:
Refs apache/pekko#3059
---
project/PekkoBuild.scala | 3 ++-
.../future-lazy-vals.excludes | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/project/PekkoBuild.scala b/project/PekkoBuild.scala
index 2eab25cf4c..e9847132b4 100644
--- a/project/PekkoBuild.scala
+++ b/project/PekkoBuild.scala
@@ -97,7 +97,8 @@ object PekkoBuild {
"-feature",
"-unchecked",
// 'blessed' since 2.13.1
- "-language:higherKinds")
+ "-language:higherKinds",
+ "-Yfuture-lazy-vals")
} else {
Seq(
"-encoding",
diff --git
a/remote/src/main/mima-filters/2.0.x.backwards.excludes/future-lazy-vals.excludes
b/remote/src/main/mima-filters/2.0.x.backwards.excludes/future-lazy-vals.excludes
new file mode 100644
index 0000000000..113e1cfc66
--- /dev/null
+++
b/remote/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.remote.RemoteWatcher#Stats.<clinit>")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]