Scala 3.10.1 is now available!

Wojciech Mazur, VirtusLab

RELEASE

Scala 3.10.1, the first patch release in the Scala 3.10 series, is now available.

Release highlights

JDK 28 support (#27347)

The compiler now supports JDK 28, including target version 28 for -release and -java-output-version. The target version cannot exceed the JDK version running the compiler. ASM has also been updated to 9.11.1 (#27363), enabling support for JDK 28 class files.

The compiler now warns when synchronized is called on an instance of a Java value-based class (#27128). JDK 28 rejects such calls. Use a dedicated lock object instead.

Upgrade to Scala CLI 1.18.0 (#27255)

The bundled Scala CLI has been upgraded from 1.17.1 to 1.18.0. Highlights include:

  • The JVM launcher no longer starts on JDK 11–16 by downloading JDK 17 and relaunching. Start it on Java 17 or newer. Your code can still be compiled and run on older JVMs, for example with --jvm 8 or --jvm 11.
  • scala fix removes deprecated comma separators from //> using directives.
  • Java snippets, Java source read from standard input, and Java blocks in Markdown now support enums, records, package-private classes, and JEP 512 compact source files.

See the Scala CLI 1.18.0 release notes for the full list of changes.

Experimental SIP-77: method block end markers (#24251)

Method block end markers make it easier to see where nested argument blocks end. Experimental SIP-77 lets you close an argument block introduced by : with a named end marker. The marker must name the method as it is written at the call site, so a mismatched name is an error.

This feature is experimental and may change or be removed depending on the SIP Committee’s decision. We welcome feedback from users who try it. Enable it with import scala.language.experimental.methodBlockEndMarkers or -language:experimental.methodBlockEndMarkers.

//> using scala 3.10.1
//> using options -language:experimental.methodBlockEndMarkers

def test(name: String)(body: => Unit): Unit =
  println(s"Running test: $name")
  body

def repeat(times: Int)(body: => Unit): Unit =
  for _ <- 1 to times do body

test("repeated greeting"):
  repeat(3):
    println("Hello!")
  end repeat
end test

For an implicit apply call, the end marker uses the name at the call site (Foo: … end Foo). For an explicit apply call, use end apply (Foo.apply: … end apply). See the reference for details on nested calls and invalid end markers.

Other notable changes

  • -Wunreasonable-catch (also enabled by -Wall) warns when a catch clause catches Throwable, Error, or a subclass of Error, or uses a catch-all pattern such as case _. Catching Exception or NonFatal does not trigger this warning (#26794).
  • @deprecatedName accepts a Symbol as well as a string: @deprecatedName(Symbol("x")) (#27048).
  • @throws is rejected on members that are neither methods nor constructors (#27064).
  • The REPL accepts //> using resource and a :resource command. Adding dependencies with :jar or :dep no longer resets the REPL session (#27073, #27072).
  • Generic signatures for tuples with more than 22 elements are restored (#27120).
  • Under language.experimental.modularity, derives works for type classes with a Self member (#26719).
  • Pattern matching on a sealed Java class no longer fails when a member type cannot be loaded (#27069).

The release also includes fixes for inlining and macros, the presentation compiler, Scaladoc, and the sbt compiler bridge.


As always, the full changelog is available in the release notes on GitHub.

Credits

This release was made possible by the joint work of EPFL, VirtusLab and the Scala Center, together with the wider Scala community. Thank you to everyone who contributed.

VirtusLab

About VirtusLab

VirtusLab is a software engineering company and a long-term core contributor to the Scala ecosystem. Its engineers help maintain the Scala 2 and Scala 3 compilers, manage their releases, and build key tools including Scala CLI, the Metals language server and the Open Community Build. Learn more at virtuslab.com/expertise/scala.

EPFLScala Center

About EPFL and the Scala Center

Scala was created at EPFL in Lausanne, Switzerland, by Martin Odersky’s research group, LAMP. LAMP still leads much of the language’s design and compiler research. The Scala Center, a not-for-profit centre at EPFL, supports Scala’s open-source ecosystem, tooling and education. Learn more at scala.epfl.ch.