Scala 3.8.0-RC1 is now available for public tests!
Highlights of the release
- Require JDK 17+ #24146
- Scala Standard Library is now compiled and published using Scala 3
- Add explicit null checks to Scala 3 Standard Library #23566
- Add capture-checking to Scala 3 Standard Library #23688
- Add capture-checking to Scala 2 collections #23769
- Extract REPL to be its own artifact #24243
- SIP-57: Make
runtimeCheckeda standard feature #23262 - SIP-62: Make
better-forsa stable feature #23630 - Preview SIP-71: Make
intopreview feature #24090 - Experimental SIP-67: Strict equality pattern matching #23803
- Experimental SIP-70: Allow multiple spreads in function arguments #23855
- Experimental SIP-75: Allow single-line lambdas after
:#23821 - Experimental: Match if sub cases #23786
Capture checking and explicit nulls additions to the standard library are available only under
-language:experimental.captureChecking/-Yexplicit-nullsrespectively, or other means enabling these features.
These changes would not affect users who are not using any of these features.
Be aware that when inspecting sources, Scala Standard Library sources, as support for their syntax, might not be yet fully supported by the IDE of your choice.
Tooling
Changes to how the Scala Standard Library is published do, however, affect tooling, and upgrading to the latest versions is recommended.
- sbt 1.11.5 is minimal version supporting Scala 3.8, sbt 1.12.0-M1 is required to use REPL
- mill 1.0.5 / mill 0.12.16 is minimal version supporting Scala 3.8 mill 1.1.0-RC2 is required to use REPL
- scala-cli 1.9.0 is minimal version supporting Scala 3.8, scala-cli 1.10.1 is required to use REPL
- IntelliJ IDEA Scala Plugin should already support most of the Scala 3.8 changes in the latest versions, current progress can be tracked in a dedicated thread
- scalameta 4.14.1 (used by Metals, scalafmt, scalafix, and more) is required to support new Scala 3.8 syntax
- Metals 1.6.4 will be released in the upcoming days, containing full Scala 3.8 support. We recommend using the latest snapshot version until that time
Lazy Vals and JDK 24+ support
Scala 3.8 changes the implementation of Lazy Vals to make it compatible with JDK 25+.
Starting with Scala 3.0, the runtime required sun.misc.Unsafe to implement lazy vals; however, access to this functionality emits warnings starting with JDK 24 and is expected to throw exceptions in JDK 26 or later versions.
Scala 3.8.0 introduces a new implementation that is free of this problem by using java.lang.invoke.VarHandle instead. Itās also going to be backported to Scala 3.3 LTS and used optionally under a dedicated flag.
However, all existing Scala 3 dependencies using lazy vals would still contain references to sun.misc.Unsafe and would trigger its deprecation mechanism.
Weāre working on a dedicated tool that would be able to resolve this problem by post-processing existing bytecode to replace usages of sun.misc.Unsafe emitted by the compiler.
Next steps
Weāve already identified issues that need to be resolved before a stable release. The subsequent RC versions can be expected to be released in the following days.
The compiler codebase itself has switched into a feature freeze mode in preparation for Scala 3.9 LTS - no new language features would be accepted (development and improvement of existing features is allowed). It allows us to focus on fixing existing bugs in both tooling and compiler to ensure a smooth transition into the Scala 3.9 LTS. The freeze would be lifted with the start of the Scala 3.10 development cycle.
Effectively, Scala 3.9 LTS would contain the same feature set as Scala 3.8 (we reserve the right to promote preview features into stable ones, but no new experimental or preview features would be introduced). As a result, any codebase using Scala 3.8 should not require any additional changes to use Scala 3.9 LTS.
Stable release
Stable release 3.8.0 would be published no earlier than 18th December; however, we reserve the right to delay the release in case of critical issues.