Why Java 17 is the most important release since Java 11

You may not have noticed but something important happened in September; a new Java release from Oracle. This was the release of Java 17 on the 14th of September 2021 and may be more significant than you realise.

Bcorp Logo

Why Java 17 is the most important release since Java 11

You may not have noticed it but something important happened in September; a new Java release from Oracle. This was the release of Java 17 on the 14th of September 2021.

At first glance the release of Java 17 might seem a little underwhelming when considered in isolation. It is not a particularly big release in terms of the number of features nor in terms of the potential impact of those features. It comprises a dozen or so changes but that is less than some previous recent releases.

However, this release may be more significant than you realise.

Java 17 is an LTS Release

Probably the most significant aspect of the release is that it is a LTS release. This means that it is a release with Long Term Support provided by Oracle. Here “Long Term” means that it will have “at least 8 years product support” provided for it.

The last LTS release was Java 11, and although it might sound like there is a very long time between Java 11 and Java 17, it is actually only 3 years. In fact, there have only ben two LTS versions of Java since this policy was adopted. These versions are Java 8 (released in 2014) and Java 11 (released in 2018).

So, Java 17 is a LTS version and the reason that this is particularly significant is that most Java development organisations have chosen to stick with one of the last two LTS versions of Java. We discussed this in an earlier blog entitled Why is Java 8 more popular than Java 14?. It is also echoed by research carried out by New Relic who found that in 2020 about 11% of users were using Java 11 with around 84% were still primarily using Java 8 (see The State of Java: Trends and Data for One of the World’s Most Popular Programming Languages). To some extent this reticence to move to more recent versions of Java is due to other version of Java only have 6 months support which is a significant issue for most organisations.

This means that all the new features and improvements in Java 12 through to 16 have not been available to most Java programmers. Thus Java 17 will open all these goodies to a whole host of developers who work for organisations who will quiet reasonably only use an LTS version of Java.

What is in Java 17

Of course, Java 17 does have a set of changes of its own. These changes can be categorized as being new features, preview / incubator features and deprecated / removed features, these features include:

New Features

  • Sealed Classes Sealed class restricts which other classes may extend or implement them. A class is declared sealed using the modifier sealed. The classes that are allowed to extend a sealed class are declared with the modifier permits. A class that extends a sealed class must use one of the three modifiers: sealed, non-sealed, and final. As well as classes interfaces can be sealed. As an example of a sealed class see Vehicle below:
public abstract sealed class Vehicle
    permits Car, Lorry {...}

public final class Car extends Vehicle {...} // OK
public final class Lorry extends Vehicle {...} // OK
public final class Boat extends Vehicle {...} // Error
  • Enhanced Pseudo-Random Number Generators This release provides new interfaces and implementations for pseudorandom number generators.
  • Restore Always-Strict Floating-Point Semantics Since Java 1.2 the strict semantics associated with floating point numbers have been relaxed. Java 17 puts those strict semantics back in place.
Why Java 17 is the most important release since Java 11

  • Strongly Encapsulate JDK Internals Thanks to this feature, it will no longer be possible to relax the strong encapsulation of internal elements via a single command-line option.

Preview / Incubator Features

  • Pattern matching for switch (Preview) This feature previews the syntax to be used to allow an expression to be tested against several different patterns rather than the limited approach in previous versions of Java. For example:
String s = switch (obj) {
    case Double d -> "It's a double"
    case Integer i && i < 10 -> "It's a small integer"
    case Integer i -> "Its an int"
    case String s -> "It's a string"
    default -> "its something else"
  • Foreign Function and Memory API (Incubator) This improves incubating APIs introduced in JDK 14 and JDK 15 that enable Java programs to interoperate with code and data outside of the Java runtime.
  • Vector API (Second Incubator) The Vector API allows expressing vector computations that reliably compile at runtime to optimized vector instructions on supported CPU architectures.

Deprecated / Removed Features

  • Applet API is Deprecated for Removal As this API is no longer used; it is being marked for removal (having previously just been deprecated).
  • RMI (Remove Method Invocation) Activation Removed The RMI activation mechanism has been removed, although the rest of the RMI features remain.
  • Removal of the Experimental AOT and JIT Compiler The experimental Java-based ahead-of-time (AOT) and just-in-time (JIT) compilers were experimental features that did not see much adoption and so are now being removed.
  • Security Manager is Deprecated for Removal The original Java Security manager (which was part of Java 1.0) is deprecated and marked for removal as it has not been the main way to secure Java code for a long time.

Java 17 provides access to previous non-LTS features

The key to this LTS release, and why it is significant, it that it means that developers may now have a chance to explore the most significant changes made to the language since Java 11. They will therefore be able to use:

Records (Released in 16) Provides a terse syntax used to define immutable value type classes. For example:

record Point(int
x, int y) { }
var point = new Point(1, 2);
point.x(); // returns 1
point.y(); // returns 2

Text Blocks (Released in Java 15) These allow the use of triple quotes to provide for multiple line strings.

Enhanced Instanceof (Released in Java 16) This features eliminates the need to perform an explicit cast after a type check, for example:

if (obj instanceof Person p) {
    System.out.println("obj is a Person: " + p.getName());

Change in frequency of LTS releases

Another significant feature brought in as part of the Java 17 release is a change to the frequency of the LTS releases. Previously, an LTS release only came along every three years. However, going forward this will change to an LTS release every two years. This should hopefully encourage organisations to move to newer LTS versions of Java more quickly, thus allowing new language features to be more easily adopted.

Licensing Change

Finally, this release also brings in a change to Oracle licensing terms for Java. As of this release “Oracle JDK 17 and future JDK releases are provided under a free-to-use license until a full year after the next LTS release”.

Would you like to know more?

If you found this article interesting you might be interested in our Java training courses

Share this post on:

We would love to hear from you

Get in touch

or call us on 020 3137 3920

Get in touch