Java 14 Continues.. new APIs of JDK14 and JVM Changes

If you haven't check my previous blog then visit it link else continue this blog In the previous blog we have discussed some highlighted features of Java14. In this blog we will discuss new APIs of JDK14 and JVM Changes


There are 69 new API elements in the core class libraries of JDK 14.
Here are the highlights:

There is a new annotation type, Serial. This is intended to be used for compiler checks on Serialization. Specifically, annotations of this type should be applied to serialization-related methods and fields in classes declared to be Serializable. (It is similar in some ways to the Override annotation.)


The Class class has two methods for the new Record feature,isRecord() and getRecordComponents().The getRecordComponents() method returns an array of RecordComponent objects. RecordComponent is a new class in the java.lang.reflect package with eleven methods for retrieving things, such as the details of annotations and the generic type of each component in the record. Record is a new class that is the implicit supertype of all records and overrides the equals, hashCode, and toString methods of Object.NullPointerException now overrides the getMessage method from Throwable as part of the helpful NullPointerExceptions feature.The StrictMath class has six new methods that supplement the existing exact methods used when overflow errors need to be detected. The new methods are decrementExact, incrementExact,and negateExact (all with two overloaded versions for int and long).


The ElementType enumeration has a new constant for Records,RECORD_TYPE.


This is a new package in JDK 14 that has a single class,ObjectMethods. This is a low-level part of the records feature having a single method, bootstrap, which generates the equals, hashCode,and toString methods.


The CompactNumberFormat class has a new constructor that adds an argument for pluralRules, which designates rules for associating a count keyword, such as "one", and the integer number. Its form isdefined by the Unicode Consortium's Plural rules syntax.


The HashSet class has one new method, toArray, which returns an array, whose runtime component type is Object, containing all of the elements in this collection.


The LockSupport class has one new method, setCurrentBlocker.LockSupport provides the ability to park and unpark a thread (which does not suffer from the same problems as the deprecated Thread.suspend and Thread.resume methods).
It is now possible to set the object that will be returned by getBlocker.This can be useful when calling the no-argument park method from a non-public object.


The ElementKind enumeration has three new constants for the records and pattern matching for instanceOf features, namely BINDING_VARIABLE, RECORD, and RECORD_COMPONENT.


This is being introduced as an incubator module to allow testing by the broader Java community and feedback to be integrated before it becomes part of the Java SE standard.

It is intended as a valid alternative to both sun.misc.Unsafe and

The foreign-memory access API introduces three main abstractions:
  • MemorySegment: This provides access to a contiguous memory region with given bounds.
  • MemoryAddress: This provides an offset into a MemorySegment (basically, a pointer).
  • MemoryLayout: This provides a way to describe the layout of a memory segment that greatly simplifies accessing a MemorySegment with a var handle
    It is not necessary to calculate the offset based on the way the memory is being used. For example, an array of int or long types will offset differently but will be handled transparently using a MemoryLayout


In JDK 14, there are no functional changes to the JVM, but it does include JEPs that affect non-functional parts of the JVM.
  • JEP 345: NUMA-Aware Memory Allocation for G1 — This improves performance on large machines that use nonuniform memory architecture (NUMA).
  • JEP 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector — Since JDK 9, G1 has been the default collector and is considered by most to be a superior collector to the CMS.
    Given the resources required to maintain two similar profile collectors, Oracle decided to deprecate CMS (also in JDK 9),and now, it has been deleted.
  • JEP 349: JFR Event Streaming — This allows more realtime monitoring of a JVM by enabling tools to subscribe asynchronously to Java Flight Recorder events.
  • JEP 364: ZGC on macOS and JEP 365: ZGC on Windows — ZGC is an experimental low-latency collector that was initially only supported on Linux.
    This has now been extended to the macOS and Windows operating systems.
  • JEP 366: Deprecate the ParallelScavenge and SerialOld GC combination — Oracle states that very few people use this combination and the maintenance overhead is considerable
Expect this combination to be removed at some point in the not-too-distant future.


There are a number of JEPs that relate to different parts of the OpenJDK:
  • JEP 343: Packaging Tool — This is a simple packaging tool,based on the JavaFX javapackager tool that was removed from the Oracle JDK in JDK 11.This is also an incubator feature.
  • JEP 352: Non-volatile Mapped Byte Buffers — This adds new JDK-specific file mapping mode so that the FileChannel API can be used to create MappedByteBuffer instances that refer to non-volatile memory.
    A new module, jdk.nio.mapmode, has been added to allow MapMode to be set to READ_ONLY_SYNC or WRITE_ONLY_SYNC.
  • JEP 361: Switch Expressions Standard — Switch expressions were the first preview feature added to OpenJDK in JDK 12. In JDK 13, feedback resulted in the break value syntax being changed to yield value.
    In JDK 14, switch expressions are no longer a preview feature and have been included in the Java SE standard.
  • JEP 362: Deprecate the Solaris and SPARC ports — Since Oracle is no longer developing either the Solaris operating system or SPARC chip architecture, they do not want to have to continue the maintenance of these ports.
    This might be picked up by others in the Java community.
  • JEP 367: Remove the Pack 200 Tools and API — Another feature that was deprecated in JDK 11 and now removed from JDK 14. The primary use of this compression format was for jar files used by applets.
    Given the browser plugin was removed from Oracle JDK 11,this seems a reasonable idea.
  • JEP 368: Text Blocks — These were included in JDK 13 as a preview feature, and they continue with a second iteration (still in preview) in JDK 14. Text blocks provide support for multi-line string literals. The changes are the addition of two new escape sequences.
    The first suppresses the inclusion of a newline character by putting a \ at the end of the line (this is common in many other places in software development).
    The second is \s, which represents a single space. This can be useful to prevent the stripping of whitespace from the end of a line within a text block.
As you can see, JDK 14 has packed in a lot of new features that will make the lives of developers much easier. That's it from my side. Hope you like the efforts



Popular posts from this blog

Gorm 2.0 Released!!

Headlines are Zoom e2e encryption,Amazon's face recognition incorrectly matches,Android 11,Go 1.15 and What’s new is Angular 10 & Vue.Js 3.0

Wow!!! ECMASCRIPT 2020 is here