Oracle Talks to Architects and Partners About Java 8 in Launch Webinar
Almost three years after the release of Java 7, Oracle last week released Java 8, touted as the most revolutionary Java release ever. This week Oracle presented a one-hour public webinar on the release, hosted by Chief of Architecture Mark Reinhold and featuring Oracle architects, partners, and end-users.
Reinhold called the release “a giant leap forward for Java” adding, “The introduction of Lambda expressions, and the related Java streams API to the Java Standard Edition platform is the largest upgrade to the Java programming model ever done. By making it convenient to express code as data we have enabled the creation of more powerful APIs, which in turn can improve your productivity by reducing boilerplate code and providing a simpler model for leveraging today’s multi-core processors.
He also mentioned the new “compact profiles” feature, providing the ability to run Java on a wider range of hardware configurations including embedded devices. For even smaller devices and the pervasive Internet Of Things, the Java Micro-Edition 8 was simultaneously released, bringing Java 8 features to Java ME, while fitting into just a few hundred kilobytes.
Following that introduction, Reinhold conducted a panel discussion / community Q&A with some of the principle architects of the new Java 8 feature-set.
Brian Goetz, Java Language Architect, opened the panel by saying he has been working for the last four years on the core language and library features for Java 8, Lambda expressions, default methods, and the new Streams API. Goetz said that not only do these help us write better more concise code, but they are also more fun to use. He said “once you tried you won’t go back”.
When asked if lambdas were just syntactic sugar for inner classes, Goetz responded, “It could have been, and in a certain sense that would have been an easier way to do it, but that would have been taking the easy way out. If we said Lambdas are just going to be sugar for inner classes, then we would have inherited all of the complexity of inner classes, and we didn’t need all of that complexity. So instead of modeling functions with Objects, we are going to treat them as first class functions without identity. It turns out that not only does that make it simpler to program with, but it also opens the doors to VM optimizations”.
When asked if we should be nervous about any performance impact from using the new Streams API, (given that a for-loop is already a known quantity), Goetz responded, that with the usual caveats of this complicated subject “we have been looking at performance, and most of the time the performance is comparable and sometimes better. So that supports the advice that we have been giving people for years, and that is write code that’s simple, clean, maintainable, correct, and the performance just very often takes care of itself, and if it doesn’t then take care of it later.”
Bob Vandette, technical lead of the embedded product team has been driving the implementation of the compact profiles into JDK 8 in order to allow embedded developers to target smaller devices using SE 8. When asked how compact profiles are related to Project Jigsaw (the Java modularization initiative that has been postponed to Java 9), he said the three new profiles currently provided “could be considered a poor-man’s Jigsaw", in that they provide a few canned flavors for developers to choose from. He added that “The javac compiler has been enhanced to flag packages that are not in a specific profile. There is also a tool called JDeps that reports the dependencies in a jar file and helps target smaller profiles, and there is also IDE support for determining an appropriate profile.”
Roger Riggs, consulting member, worked with Stephen Colebourn and the JSR-310 expert group to integrate the new Date and Time APIs into Java 8. They produced an extensible “comprehensive API” replacing the older more rigid implementation that he branded a “long, sad story.”
Riggs was also one of the specification leads for Java ME 8. He said the main elements of Java ME 8 are an upgraded CLDC which is a subset of Java SE 8, to fit into a smaller footprint, the ME embedded profile which adds a number of APIs on top of that to handle application provisioning, power management, some device access, and “other sort of software nitty-gritty things.” He said there is also, a third component, a device API that gives you access to the lowest level of hardware connected devices on an embedded module. He added, “The only features we were not able to get into this revision were related to invokedynamic and Lambda. Unfortunately because of a tradeoff of timing and footprint, we’re going to work on that for the next revision.”
Rich Bair Java client architect, mentioned his team’s work which included client performance, a new modernized theme, the integration of Java FX 8 into the normal Java launcher allowing seamless execution of Java FX apps, and a wealth of new 3-D features and UI controls. When asked why one should choose Java FX, Bair responded, “For a rich client app, Java FX is perfect. Running on Java, taking advantage of the JVM, and the toolset has been designed around performance”. He added that particularly for embedded applications “this is a natural choice.”
The webinar also featured Twitter CTO Adam Messinger (former VP of development at Oracle) who said “Twitter has made a big investment in the JVM; we’ve moved almost all of our server side infrastructure onto the JVM, and we do it with both Java and Scala internally. So the work that we started in Java 7 with invokedynamic and now you’ve continued in Java 8 to make the JVM really a true multi-language platform, and that is really important to us at Twitter. So I think the work you’ve done with putting Lambdas into the language continues its long tradition of Java cherry picking great, powerful features, and doing it sort of parsimoniously so the language stays clean and putting them into the core language, I think that’s great; we’ve seen a lot of power with that in Scala, and I think what you’ve done with Nashorn, getting a pretty different language to run on top of the JVM, undoubtedly makes the VM better as a multi-language platform for all languages.” He added “One of the reasons we moved to Java in the first instance was for performance, and we saw performance uplifts in some cases of 8x, with reduced standard deviations of pause times. So that’s been an unqualified win for us. But one thing we didn’t know at the time that we would also get would be continued improvements. I was looking at your SPECjbb results and I saw like for like results 50% uplift with Java 8, so that’s like a gift that keeps giving. And we don’t have to do anything and we get that for free.”
Mark Reinhold invited viewers to download a large collection of related screencasts and additional resources (including a replay of the webinar) at www.oracle.com/JAVA8LAUNCH. He added that the best way to learn the new features is to go write some actual code. The new language features are supported by Netbeans, Eclipse, and IntelliJ. You can download Java 8 directly from J.MP/GETJAVA
Benchmarks referenced can be seen at www.oracle.com/us/solutions/performance-scalability/sparc-t5-2-specjbb2013-2147159.html