Skip to content

Use -Yfuture-lazy-vals for Scala 3 on the JVM - #5529

Merged
adamw merged 3 commits into
masterfrom
use-future-lazy-vals
Sep 17, 2026
Merged

adamw merged 3 commits into
masterfrom
use-future-lazy-vals

Conversation

@adamw

@adamw adamw commented Sep 17, 2026

Copy link
Copy Markdown
Member

Adds -Yfuture-lazy-vals to Scala 3 on the JVM, so that JVM 25 no longer warns about a terminally deprecated API. Same change as softwaremill/sttp#2996.

The flag needs the VarHandle API, so it comes with -java-output-version. That option also decides which JDK APIs the compiler sees, not just the class file version, so the number has to match what a module actually requires:

  • 11 by default. Scala 3 artifacts now need Java 11; Scala 2 artifacts are unchanged and still target Java 8.
  • 21 for nettyServerSync and nimaServer, which need JDK 21 anyway — the first through ox, the second through Helidon Nima.

The Scala 2.13 row of nimaServer is untouched and still targets Java 8, as before.

The flag only exists in the 3.3 LTS line, so it's tied to scala3 rather than to "any Scala 3". That leaves out openapiCodegenSbt, which builds with 3.7.4 and would fail on an unknown option. From 3.8 on the same lazy val encoding is the default, so the flag can go once the main Scala 3 version moves there.

Checked: compileScoped 3 JVM passes, with and without ONLY_LOOM, core3/test passes, and emitted class files are version 55 and 65 as expected.

@adamw
adamw merged commit d15eb59 into master Sep 17, 2026
22 checks passed
@adamw
adamw deleted the use-future-lazy-vals branch September 17, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant