Java 12 is here!
Java SE 12 is here and even though it’s not an LTS release, it definitely brings some important features to the table. Let’s have a look at the highlights of this new release.
Java 11 may have been the first LTS release in Oracle’s new six-month cycle but Java 12 has its share of excitement!
This new release brings eight new features.
Java 12 highlights
Before we have a look at the new features, let’s clarify once again what it means when a version does not have long-term support. As a short-term support release, Java 12 will receive commercial support from Oracle only until the release of the next Java version, in this case, Java 13.
You should keep in mind, however, that although Java 12 is not a major release, in the sense that it does not come with long-term support, it is not a minor release either since it brings eight new features.
Here is an overview:
189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental) – Add a new garbage collection (GC) algorithm named Shenandoah which reduces GC pause times by doing evacuation work concurrently with the running Java threads. Pause times with Shenandoah are independent of heap size, meaning you will have the same consistent pause times whether your heap is 200 MB or 200 GB.
230: Microbenchmark Suite – Add a basic suite of microbenchmarks to the JDK source code, and make it easy for developers to run existing microbenchmarks and create new ones.
325: Switch Expressions (Preview) – Extend the switch statement so that it can be used as either a statement or an expression, and that both forms can use either a “traditional” or “simplified” scoping and control flow behavior. These changes will simplify everyday coding, and also prepare the way for the use of pattern matching (JEP 305) in switch. This will be a preview language feature.
334: JVM Constants API – Introduce an API to model nominal descriptions of key class-file and run-time artifacts, in particular constants that are loadable from the constant pool.
340: One AArch64 Port, Not Two – Remove all of the sources related to the arm64 port while retaining the 32-bit ARM port and the 64-bit aarch64 port.
341: Default CDS Archives – Enhance the JDK build process to generate a class data-sharing (CDS) archive, using the default class list, on 64-bit platforms.
344: Abortable Mixed Collections for G1 – Make G1 mixed collections abortable if they might exceed the pause target.
346: Promptly Return Unused Committed Memory from G1 – Enhance the G1 garbage collector to automatically return Java heap memory to the operating system when idle.
No Raw String Literals for Java 12
It should be noted that the Raw String Literals feature was pulled back from Java 12.
Nonetheless, the conversation on the feature and its function continues. Just a couple of months ago, Brian Goetz reignited the discussion on raw string literals with a new message to the mailing list, touching upon a number of topics including process errors made, how other languages deal with raw strings what should be the next steps.
Make sure to check out the message to get all the details.
The Preview Feature mechanism is intended for features for which there is a high confidence that the feature is “done”, and the likelihood that significant changes would be made before making the feature permanent is low. At this time, and after extensive consideration, Jim and I no longer believe this to be the case, and we think letting it preview in its current state would be to the detriment of the language. We’re of course disappointed that this means it will take slightly longer for this feature to make it into the language, but we think that’s the best choice.
– Brian Goetz, Java Language Architect at Oracle
A chat with Oracle
In light of the new release, we caught up with Donald Smith, Senior Director, Product Management for Java at Oracle to talk about Java 12, how the new release cadence has affected the workflow for the team behind Java, the new feature that he is most excited about, and more!
Here is a small taste of what we talked about:
JAXenter: What kind of advantages and disadvantages does the continuous delivery cycle bring to the developing experience?
Donald Smith: There are still some misconceptions around the new version numbering and what it means. After twenty years and eight “major” version numbers, we understand it can be jarring to have four more in rapid succession. The new release cadence means six-month releases aren’t “major”, but they’re not quite “minor releases” either. We’ve noticed more and more that toolchains and parts of the ecosystem are getting accustomed to the cadence, what it means, and adapting very well. For example, seeing IntelliJ support Java 12 language changes well before GA is very welcomed.
Stay tuned for the full interview!