Java 14 generally available with a bagful of new features

By on
Java 14 generally available with a bagful of new features

How usable are they for developers?

Oracle has released the Java Development Kit version 14, arguably the world’s most popular coding language and application deployment platform, after more than two years of six-monthly feature releases, weekly builds and community reviews.

A large number of Java Enhancement Proposals (JEPs) made it into version 14.

Oracle has included three previews, pattern matching for the instanceof operator, Records for declaring classes that hold shallowly immutable data, and Text Blocks, which make it easier to express strings spanning several lines of source code.

The two first JEPs are said to improve developer productivity by eliminating and reducing the need for common boilerplate code.

Switch Expressions that was in preview on JDK 12 and 13 is now a standard feature on version 14.

These let switches to be used either as statements or expressions, simplifying day to day coding tasks.

“Not only does JDK 14 have a number of enhancements that will improve developer productivity, but we’re also seeing the first major content to come from projects like Project Panama, with a Foreign-Memory Access API enhancement and continuing improvements from Project Amber, with Pattern Matching and Records, said Oracle’s head of Java platform development Georges Saab.

Foreign-Memory Access is an application programming interface that as the name implies allows Java programs to safely communicate with memory outside its virtual machine heap.

JDK 14 also brings the low-latency Z Garbage Collector from Linux-based environments.

Other notable JEPs included with JDK 14 are:

  • Packaging Tool: Provides a way for developers to package Java applications for distribution in platform-specific formats. 
  • NUMA-Aware Memory Allocation for G1 – Improves overall performance of the G1 garbage collector on non-uniform memory access (NUMA) systems.
  • Java Flight Recorder Event Streaming – Exposes JDK JFR data for continuous monitoring. 
  • Non-Volatile Mapped Byte Buffers – Adds a file mapping mode for the JDK when using non-volatile memory. 
  • Helpful NullPointerExceptions – Improves the usability of NullPointerExceptions by describing precisely which variable was null and other helpful information. 

How useful the features will be for developers remains to be seen however.

Mark Derricutt, senior developer at SMX and Java podcaster, said that while JDK 14 brings plenty of internal changes and improvements related to its virtual machine, there’s not that much in the way of coder-facing features that can be used in the wild. 

“Since moving Java's 6 monthly release cycle, these non-LTS (Long Term Support) releases include new preview features; also we have new/revised language features available as preview. 

There are few that can safely be used in production code and you need to enable preview specifically when compiling/running,” Derricutt said. 

While the features could be safe for application use and probably for unit testing, this would only work as long as developers know and agree that they're buying into code that may change, or even never ship.

One class of developers are likely to be less than welcoming of the new features.

"For library writers, it’s a pain in the neck as you can't safely use any new language features introduced after Java 8," Derricutt said. 

"Java has introduced the Multi-Release Jars which lets you have one artifact that supports multiple versions, but that's still complicated to work with from a build-tool, or testing scenario. 

Library writers now have to test against seven to eight different versions of Java, and run their code both on and off the new module system", Derricutt said.

“It's quite a challenge. Those hurdles also make building tool and library support difficult, and it all flows down from there,” he said.

As for quick JDK 14 adoption, that depends on where developers are currently.

“A large majority of people have yet to migrate beyond Java 8, largely in part of the hurdles introduced by the new module system, so adoption rates don't seem to be coming as quickly as they normally would,” Derricutt said.

“The language changes introduced don't yet provide a big enough incentive for a lot of people to upgrade,” he added. 

“This isn't to say people are not adopting it, those doing microservices/docker and non-traditional deployments have a far easier path to adoption than those who integrate with other legacy systems/platforms,” Derricutt said. 

Partly due to the rise of Clojure, Kotlin which is used by Google in Android, Jetbrains, now and other JVM languages filling their needs, it means many people don’t need to upgrade, even if they may gain in some areas like Unicode and Transport Layer Security (TLS) .

However, to stay ahead in the game, Derricutt pointed out that Java 17 is due to be the next LTS release from Oracle. 

Java 17  is due late next year in the August - September timeframe, so now would be a good start to investigate and plan migrations, Derricutt suggested.

For veteran geeks who remember the heady days of the mid-nineties and the now-defunct Sun Microsystems, JDK marks the end of an era.

Java first appeared in 1995 on Sun’s UNIX-based Solaris operating system, running on SPARC processors.

With JDK 14, the Java ports for Solaris and SPARC are now officially deprecated.

Got a news tip for our journalists? Share it with us anonymously here.
Copyright © iTnews.com.au . All rights reserved.
Tags:

Most Read Articles

Log In

Username / Email:
Password:
  |  Forgot your password?