News

Java 8 Arrives

It's official: the Java Platform Standard Edition 8 (Java SE 8) and the latest Java SE Development Kit (JDK 8) are now generally available.

This is a blockbuster release of Java SE 8, which was defined by JSR 337 in the Java Community Process (JCP). Both the language and the platform were extended and enhanced with such features as support for lambda expressions and virtual extension methods, a new Date/Time API, Type Annotations, a Stream API integrated into the Collections API, compact profiles, the Nashorn JavaScript engine, and many security fixes.

Mark Reinhold, chief architect in Oracle's Java Platform Group, announced the availability of production-ready builds of JDK 8 on his blog today (March 18).

The most talked-about enhancement in this release is its support for lambda expressions. Martijn Verburg, CTO at jClarity, who co-leads the London Java Community (LJC) () (with LJC founder Barry Cranford), said the reason for this excitement is that support for lambdas will allow Java developers to deal "elegantly" with manipulations such as filter, map, and reduce on collections in a thread-safe manner, while taking advantage of the new multi-core processor CPU architectures. "Although some developers initially feared that Java would lose some of its readability with the introduction of Lambdas," he told ADTmag in an e-mail, "there's been plenty of sample code with the new APIs that make it clear that the new style is eminently readable, and in many cases more so than the previous way of doing things."

Support for lambdas also adds the ability to reduce drastically the amount of boiler-plate code involving things like callbacks, handlers ("think asynchronous messaging as just one example"), and JavaFX/Swing UI components, among others, Verburg added.

"At jClarity we were already using Groovy for this purpose and can now happily do the same using core Java!" he said.

Charles Humble, head of editorial at InfoQ.com, agrees: "[Lambda support] is such a significant change in terms of improving our ability to make better use of the hardware our programs run on," he said via email, "by giving us a cleaner way to write genuinely parallel code. I'll admit that I was somewhat concerned when the idea of adding lambda expressions to Java was first discussed that we would end up with something that felt like a hack and added a whole lot of complexity to the language for minimal gain. That risk has been avoided quite spectacularly I think. Java 8 still feels like Java to me, but it has this extra set of features that have been deeply and carefully integrated into the language."

Humble credits Brian Goetz, Oracle's rock star Java language architect, and his team for dealing with "all sorts of gnarly problems" to accomplish this integration, including things like the interactions between method overloading and type inference. They deserve a huge amount of credit for the end result, he said.

But lambda support isn't the only enhancement likely to be immediately popular among developers in this release, Humble points out.

"[T]here is a lot of other good stuff in Java 8," he said. "In my day-to-day programming with Java, the various date APIs have been repeatedly painful, and it's fantastic to see that finally get fixed...I also think Nashorn has the potential to be a big deal."

Verburg also likes the new date-and-time API (JSR-310). "This is Java's 3rd attempt at getting this right, and thanks to the expertise of Stephen Colebourne (author of the famous Joda Time library) we have a thread-safe, accurate, timezone-aware date-and-time API for the modern age." He also credited LJC member Roger Riggs, Principal Member of Technical Staff at Oracle, for his contribution to JSR-310. "[W]e're very confident that this is a great API, already battle tested by developers in the field," he said.

Java User Groups (JUGs) from around the world contributed to this release through the JCP's Adopt-a-JSR program. Their chief contribution was as testers and validators of Java 8, Verburg said. For JSR 335 (lambdas), for example, the LJC held a series of hack days to try out early prototypes of builds and to code against early APIs. "This allowed Brian Goetz and the other OpenJDK/Oracle folk behind lambdas to validate their ideas against day-to-day developers," Verburg explained. "It's probably fair to say that this sort of collaboration hadn't always happened in the past for past versions of Java." The LJC also held hack days for the date-and-time API.

Participants in the Adopt-a-JSR and Oracle's Adopt OpenJDK programs are already looking ahead to Java 9, Verburg said. "Most outsiders don't realize the massive amount of time and effort that, primarily Oracle, but also other large vendors (such as IBM and Red Hat), other technology vendors (such as Twitter and Google), academics (such as Remi Forax and Doug Lea), and individuals put into making OpenJDK and Java releases. The Java developer community can do more to give back to the ecosystem, and we're proud to say that there's been a lot of support from folks to do just that."

"[I]t has been terrific to see the Java community -- particularly the various JUGs -- involved in reviewing and working with early access builds and offering feedback," Humble added. "In other words I think this is a release that the whole wider Java community can also feel kind of proud of."

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

About the Author

John K. Waters is the editor in chief of a number of Converge360.com sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS.  He can be reached at [email protected].