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-persistence-cassandra.git
The following commit(s) were added to refs/heads/main by this push:
new aff7d5b Add -Yfuture-lazy-vals for Scala 3.3.x builds (#418)
aff7d5b is described below
commit aff7d5bdac37b882ff4adb5b9877d2589c5cf1fe
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Sun Jun 14 19:15:38 2026 +0800
Add -Yfuture-lazy-vals for Scala 3.3.x builds (#418)
* 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/Common.scala | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/project/Common.scala b/project/Common.scala
index fc77d33..18c2330 100644
--- a/project/Common.scala
+++ b/project/Common.scala
@@ -44,6 +44,10 @@ object Common extends AutoPlugin {
crossScalaVersions := Dependencies.scalaVersions,
scalaVersion := Dependencies.scala213Version,
scalacOptions ++= Seq("-encoding", "UTF-8", "-feature", "-unchecked",
"-Xlint", "-Ywarn-dead-code", "-deprecation"),
+ scalacOptions ++= {
+ if (scalaBinaryVersion.value == "3") Seq("-Yfuture-lazy-vals",
"-release:17")
+ else Seq.empty
+ },
Compile / console / scalacOptions --= Seq("-deprecation",
"-Xfatal-warnings", "-Xlint", "-Ywarn-unused:imports"),
Compile / doc / scalacOptions := scalacOptions.value ++ Seq(
"-doc-title",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]