You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2026/06/13 08:44:07 UTC

[PR] Add -Yfuture-lazy-vals for Scala 3.3.x builds [pekko]

He-Pin opened a new pull request, #3059:
URL: https://github.com/apache/pekko/pull/3059

   ### Motivation
   
   The Scala 3.3.8 compiler introduced the `-Yfuture-lazy-vals` flag ([scala/scala3-lts#637](https://github.com/scala/scala3-lts/pull/637)) 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 `DefaultScalacOptions` in `project/PekkoBuild.scala`, conditionally applied only for Scala 3.3.x via `CrossVersion.partialVersion`:
   
   ```scala
   (CrossVersion.partialVersion(scalaVersion.value) match {
     case Some((3, 3)) => Seq("-Yfuture-lazy-vals")
     case _            => Nil
   })
   ```
   
   ### Result
   
   Pekko's 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`.
   
   ### Tests
   
   - `sbt "++3.3.8; actor/compile"` — passed (exit 0, only pre-existing `@SerialVersionUID` and Java unchecked warnings)
   
   ### References
   
   Refs scala/scala3-lts#637


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Add -Yfuture-lazy-vals for Scala 3.3.x builds [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin merged PR #3059:
URL: https://github.com/apache/pekko/pull/3059


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Add -Yfuture-lazy-vals for Scala 3.3.x builds [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #3059:
URL: https://github.com/apache/pekko/pull/3059#discussion_r3407922047


##########
project/PekkoBuild.scala:
##########
@@ -97,7 +97,11 @@ object PekkoBuild {
         "-feature",
         "-unchecked",
         // 'blessed' since 2.13.1
-        "-language:higherKinds")
+        "-language:higherKinds") ++
+      (CrossVersion.partialVersion(scalaVersion.value) match {
+        case Some((3, 3)) => Seq("-Yfuture-lazy-vals")

Review Comment:
   we don't need this to be so complicated - just add it the Seq starting on line 94



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Add -Yfuture-lazy-vals for Scala 3.3.x builds [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #3059:
URL: https://github.com/apache/pekko/pull/3059#discussion_r3408162841


##########
project/PekkoBuild.scala:
##########
@@ -97,7 +97,11 @@ object PekkoBuild {
         "-feature",
         "-unchecked",
         // 'blessed' since 2.13.1
-        "-language:higherKinds")
+        "-language:higherKinds") ++
+      (CrossVersion.partialVersion(scalaVersion.value) match {
+        case Some((3, 3)) => Seq("-Yfuture-lazy-vals")

Review Comment:
   Yes! will do it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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