Scala upgrade brings closer alignment with Java 8

Scala upgrade brings closer alignment with Java 8

Scala, a trendy object-oriented and functional language for the Java Virtual Machine, is now aligned with Java 8, the latest release of the standard Java platform.

Version 2.12.0, released Wednesday, features a complete overhaul of its compiler to take advantage of VM features in the Java upgrade, according to With Scala 2.12.0, a trait compiles directly to an interface with default methods, to improve binary compatibility and Java interoperability. And with Java 8 allowing concrete methods in interfaces, Scala 2.12.0 is able to compile a trait to a single interface classfile.

“Before, a trait was represented as an interface and a class that held the method implementations,” said. “Scala 2.12 is all about making optimal use of Java 8’s new features—and thus generates code that requires a Java 8 runtime.”

Additionally, Scala and Java 8 interop has been improved for functional code, with methods that take functions easily called in each direction via lambda syntax. “The FunctionN classes in Scala’s standard library are now SAM (Single Abstract Method) types and all SAM types are treated uniformly—from type-checking until code generation—no class file is generated for lambdas, and invokedynamic is used instead.”

The new version also features a new bytecode optimizer. “The optimizer is configured using the -opt compiler option. By default it only removes unreachable code within a method.” Dead code elimination and a number of cleanup optimizations are included as well.

Version 2.12.0 standardizes on the GenBCode back end to emit code more quickly, and the interactive shell in Scala has been improved. It also has an upgraded type inference for Scala.js, which generates JavaScript from Scala.

Scala 2.12.1, which will rectify some issues with release 2.12.0, is coming later this month; says it will clean up code and offer front-end fixes. A future release of Scala 2.12.x will address an issue in which parallel collections are prone to deadlock in the REPL and object initializers. From here on out, Scala 2.12.x releases will be fully binary compatible.

IDG Insider


«Basketball without cable: A cord-cutter's guide to the NBA


How to speed up Windows 7 Update scans—forever»
IDG Connect

IDG Connect tackles the tech stories that matter to you

Our Case Studies

IDG Connect delivers full creative solutions to meet all your demand generatlon needs. These cover the full scope of options, from customized content and lead delivery through to fully integrated campaigns.


Our Marketing Research

Our in-house analyst and editorial team create a range of insights for the global marketing community. These look at IT buying preferences, the latest soclal media trends and other zeitgeist topics.



Should the government regulate Artificial Intelligence?