A quick introduction to Java 14

The new version was released on 18th March 2020 with some major bug fixes and enhancement. We will have a quick introduction to the changes.

The most important fixes/enhancements are: —

Helpful NullPointerExceptions

According to JEP 358 , The goal was -
1. Offer helpful information to developers and support staff is about the premature termination of a program.
2. Improve program understanding associating a dynamic exception with static program code more clearly.
3. Reduce the confusion and concern that new developers often have about NullPointerExceptions .

Ultimately this enhancement is going to tell you, which variable actually generated NPE. As I am a developer; it is literally going to help me a lot while debugging the code, what do you think???

Pattern Matching for instanceof (Preview)

According to JEP 305 , The motivation behind the enhancement is to remove boilerplate code while using instanceof. Let’s understand the feature : —

All Java programmers are familiar with the instanceof-and-cast idiom:

There are three things going on here: —
1. A test (is obj a Long?)
2. A conversion (casting obj to Long),
3. And the declaration of a new local variable (l) so we can use the long value.

This pattern is straightforward and understood by all Java programmers, but is suboptimal for several reasons. It is tedious; doing both the type test and cast should be unnecessary (what else would you do after an instanceof test?).

This boilerplate -- in particular, the three occurrences of the type Long --- is unnecessary, but most importantly, the repetition provides opportunities for errors to creep unnoticed into programs.

So what is the enhancement???

Well, the enhancement is that you don’t need to write Long thrice you can use the variable l directly.

Apart from above mentioned two features there are many enhancement & deprecation in Garbage Collection Tuning such as : —
1. Remove the Concurrent Mark Sweep (CMS) Garbage Collector
2. Deprecate the ParallelScavenge + SerialOld GC Combination
3. NUMA-Aware Memory Allocation for G1

There are many enhancements in Packaging Tool (Incubator) and Tooling Support : —
1. IntelliJ IDEA
2. Apache NetBeans
3. Eclipse IDE

To know more, put your eyes on: —
1. https://docs.oracle.com/en/java/javase/14/index.html
2. https://t.co/PA5jibv7o1?amp=1

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Govinda Raj

Govinda Raj

Senior Software Developer. Tech Enthusiast and love coding. My portfolio: https://govinda-raj.github.io/