Difference between revisions of "New Features in Java 12 through 15"

From p0f
Jump to: navigation, search
(Placeholders with links and metadata.)
(No difference)

Revision as of 11:25, 18 January 2021

Introduction

JDK versions just keep coming, and since my last article about new features in Java v10 and v11, there have been three new major Java releases with a number of interesting (and useful) new features.

What I assume

I assume that you are:

  • fluent in the Java language (according to v11 language specification)
  • aware of how Java garbage collectors work and why we need them
  • familiar with what software profiling and auditing are and how they work
  • have a clue about Linux scripting

Language

Switch Expressions (v12)

Lifecycle phases:

  • v12: preview
  • v13: preview
  • v14: standard

Text Blocks (v13)

Lifecycle phases:

  • v13: preview
  • v14: second preview
  • v15: standard

Pattern Matching for instanceof (v14)

Lifecycle phases:

  • v14: preview
  • v15: second preview

Records (v14)

Lifecycle phases:

  • v14: preview
  • v15: second preview

Sealed Classes (v15)

Lifecycle phases:

  • v15: preview

Virtual Machine

Shenandoah Garbage Collector (v12)

Lifecycle phases:

  • v12: experimental
  • v15: GA

Abortable Mixed Collections for G1 (v12)

https://openjdk.java.net/jeps/344

Make G1 mixed collections abortable if they might exceed the pause target.

Promptly Return Unused Committed Memory from G1 (v12)

https://openjdk.java.net/jeps/346

G1 only returns memory from the Java heap at either a full GC or during a concurrent cycle. Since G1 tries hard to completely avoid full GCs, and only triggers a concurrent cycle based on Java heap occupancy and allocation activity, it will not return Java heap memory in many cases unless forced to do so externally.

This feature enhances the G1 garbage collector to automatically return Java heap memory to the operating system when idle.

Return Unused Memory to OS from ZGC (v13)

Bye-bye, CMS (v14)

Hidden Classes (v15)

Tools

New OS-Native Packaging Tool for Self-Contained Apps (v14)

Lifecycle phases:

  • v14: incubator

Better NullPointerException Messages (v14)