WatersWorks

Blog archive

Java SE 8 Is Almost Here, and Lambda Is the Star

The delays are over, the final approvals are in, and the general availability release of the Java Platform, Standard Edition, 8 (Java SE 8) is right around the corner. What has been called a revolutionary upgrade of one of the world's leading software development platforms is due on March 18. Mark Reinhold, chief architect in Oracle's platform group, has described Java SE 8 as the largest ever upgrade in the history of Java, covering the programming model, as well as a "carefully coordinated co-evolution" of the virtual machine, the language, and the libraries.

This release incorporates several high-profile Java Specification Requests (JSRs), the most talked about of which is JSR 335, Project Lambda. Originally planned for the Java SE 7 release, but pushed back, Project Lambda extends support in the Java language and core libraries to enable the Java SE APIs to use lambda expressions (closures), which are anonymous functions.

Reinhold has called the support for lambda expressions in this release the single largest upgrade to the programming model, ever. Mike Milinkovich, executive director of the Eclipse Foundation, calls it a massive change of the Java language, libraries, and JVM.

"Without a doubt the most important new feature in Java 8 is lambdas," Milinkovich told ADTmag. "This is a sweeping change that modernizes the language, allows for a much more readable syntax, allows for better code generation, and helps the JVM make much better use of multicore processors. Inner classes were always a hack, and having proper closures in the Java language has been a missing feature for a very long time."

The Foundation is releasing Java 8 language support as an add-on to the Eclipse IDE at next week's EclipseCon. That add-on includes a formatter, a code completion feature, code navigation, search and indexing, a reconciler, incremental builder support, and "quick assist" support for migrating anonymous classes to lambda expressions. "I think [that feature] will be particularly popular with Java developers as they migrate their code," Milinkovich said.

Using lambda expressions will, among other things, make it easier for developers to write code for multicore processors. But on a more fundamental level, lambda expressions introduce the idea of functions from lambda calculus into the Java language, making the Java SE 8 release look like a step toward functional programming. The functional paradigm, which emphasizes the evaluation of expressions, rather than the execution of commands, and essentially eliminates the need for program state by expressing all computations in the form of functions that take arguments and return values, is used by such modern JVM languages as Groovy, Scala, and Clojure.

The lambda support in Java SE 8 alone makes it an important milestone for the language and platform, said IDC analyst Al Hilwa, but it's one of several changes that represents significant new functionality in this release.

"There are a variety of interesting things in SE 8, like the Streams API focused on parallel processing large data sets, Project Nashorn's faster JavaScript engine, and of course implementing Lambda expressions," Hilwa said. "These are significant changes to the language that will have a long-term impact as we shift into a highly parallel world populated with multi-core devices and big data. To see the team do this while simultaneously investing heavily in securing the platform in the face of escalating malware attacks everywhere is a huge achievement."

The list of new features in this also includes the new Date/Time API (JSR 310), Type Annotations (JSR 308), and a set of Compact Profiles, which allow Java SE 8 implementations to scale down easily.

One prominent Java initiative, Project Jigsaw, hasn't been included in this release. The Java-native module system is expected in Java SE 9.

"Generally, programming languages evolve slowly and with great focus on stability," Hilwa observed, "because the code has to continue to run for decades. Meanwhile, new innovations have to be accommodated, and so Java's governance model allows it to be evolved and adapt to new innovation, and this is what we are seeing here."

Oracle is hosting a live Java 8 Launch Webcast on March 25.

Posted by John K. Waters on March 12, 2014