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 f015ee1f Add -Yfuture-lazy-vals for Scala 3.3.x builds (#518)
f015ee1f is described below
commit f015ee1fc4f41c707ae3000bf1b68e523f9a6c04
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Sun Jun 14 19:15:00 2026 +0800
Add -Yfuture-lazy-vals for Scala 3.3.x builds (#518)
* 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 -release:17 required by -Yfuture-lazy-vals
The -Yfuture-lazy-vals flag requires explicit -java-output-version
set to minimum version 9 or higher. Add -release:17 to satisfy
this requirement for Scala 3.3.x builds.
---
project/PekkoDisciplinePlugin.scala | 2 ++
1 file changed, 2 insertions(+)
diff --git a/project/PekkoDisciplinePlugin.scala
b/project/PekkoDisciplinePlugin.scala
index 76cb4b5e..5a650b53 100644
--- a/project/PekkoDisciplinePlugin.scala
+++ b/project/PekkoDisciplinePlugin.scala
@@ -44,6 +44,8 @@ object PekkoDisciplinePlugin extends AutoPlugin {
"-Xlint:-strict-unsealed-patmat",
// scala/bug#7014 is a false positive compiler warning
affecting r2dbc-spi jar loading
"-Wconf:msg=scala/bug#7014:s")
+ case Some((3, _)) =>
+ Set("-Yfuture-lazy-vals", "-release:17")
case _ =>
Nil
}).toSeq,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]