Java 16 - What's new features in Java 16
The latest version of java is Java 16 (Java SE 16) and Java 16 Development Kit (JDK 16) has released on 16 March 2020. There will be no more JEPs for this release; developers can have a looking at Jave JDK 16 now to get a sense of what's new in Java 16.
Java 16 release date :
16 March 2021
Some of the new feature of JDK 16 includes concurrent thread-stack processing for garbage collection, support for C++ 14 language features, an "elastic metaspace" capability to more quickly return unused class metadata memory to the OS, procedural upgrades, new APIs and tooling, operating system ports, strongly encapsulating JDK internals by default, and many more..
Java Jdk 16 Download :
JDK 16 Release
Java 16 / JDK 16 has now been officially released, below are proposed features coming out as part of the jdk 16.
- JEP 397: Sealed Classes (Second Preview)
- JEP 396: Strongly Encapsulate JDK Internals by Default (Futureproofing)
- JEP 395: Records (New Language Features)
- JEP 394: Pattern Matching for instanceof (New Language Features)
- JEP 393: Foreign-Memory Access API (Third Incubator)
- JEP 392: Packaging Tool (New Tools and Libraries)
- JEP 390: Warnings for Value-Based Classes (Futureproofing)
- JEP 389: Foreign Linker API (Incubator)
- JEP 388: Windows/AArch64 Port (Improving Productivity)
- JEP 387: Elastic Metaspace (JVM Improvements)
- JEP 386: Alpine Linux Port (Improving Productivity)
- JEP 380 Unix-Domain Socket Channels (New Tools and Libraries)
- JEP 376: ZGC: Concurrent Thread-Stack Processing (JVM Improvements)
- JEP 369: Migrate to GitHub (Improving Productivity)
- JEP 357: Migrate from Mercurial to Git (Improving Productivity)
- JEP 347: Enable C++14 Language Features (Improving Productivity)
- JEP 338: Vector API (Incubator)
-
JEP 397: Sealed Classes (Second Preview)
Sealed Classes were proposed and delivered as a preview feature in JDK 15.
Enhance Java programming language with sealed classes and interfaces. Sealed classes and interfaces restrict which other classes or interfaces can extend or implement.
Goals:
- Enable the class or interface author to control which code to implement it.
- Provide a more declarative approach than access modifiers to limit the use of a superclass.
- Support future pattern matching directions with a basis to examine trends thoroughly.
Refinement:
- In the JLS, describe the definition of a contextual keyword, which replaces the previous definitions of restricted identifier and restricted keyword.
- Introduce sealed, non-sealed character sequences and allow them as contextual keywords.
- As with anonymous classes and lambda expressions, local classes may not be sealed class subclasses when deciding the implicitly declared allowed subclasses of a sealed class or sealed interface.
-
JEP 396: Strongly Encapsulate JDK Internals by Default
This is the next step in the journey to close access to JDK internals, enabling the OpenJDK development team to move faster.
Strongly encapsulate all internal elements of the JDK by default, except for critical internal APIs such as sun.misc.Unsafe. Allow end users to choose the relaxed strong encapsulation that has been the default since JDK 9.
Goals:
- Improving the security and maintainability of JDK, as part of Project Jigsaw, and encouraging developers to switch from using internal elements to using standard APIs so that both developers and end users can easily upgrade to future Java releases.
- This proposal carries the primary risk that the current Java code would fail to run. Developers are encouraged to use the jdeps tool to identify code that relies on the JDK's internal elements and, where available, switch to standard replacements.
- Developers may use an existing version, such as JDK 11, to test existing code by using-illegal-access=warn to identify internal elements accessed through reflection,-illegal-access=debug to locate errant code, and-illegal-access=deny testing.
-
JEP 395: Records
Record has been introduce in response to complaints that Java has been too verbose or has too much ceremony (boilerplate). Records was previewed in JDK 14 and JDK 15.
Enhance the Java programming language with records that are classes that act as transparent carriers of immutable data. Records could be thought of as nominal tuples.
Goals:
- Devise (Plan by careful thought) an object-oriented construct that expresses a simple aggregation of values.
- Help developers concentrate on modelling immutable data rather than extensible behaviour.
- Automatically implement data-driven methods such as equals and accessors.
- Preserve long-standing Java principles such as nominal typing and migration compatibility.
-
JEP 394: Pattern Matching for instanceof
Pattern matching the operator instance has been finalised in JDK 16, which was also previewed in both JDK 14 and JDK 15.
Popular logic in a programme, such as conditional extraction of components from objects, can be expressed more concisely and safely using pattern matching.
Refinement:
- Lift the restriction that pattern variables are implicitly final. Make it a compile-time error for a pattern instanceof expression to compare an expression of type S against a pattern of type T, where S is a subtype of T.
-
JEP 393: Foreign-Memory Access API (Third Incubator)
The foreign-memory access API, which was previously incubated in both JDK 14 and JDK 15, will be re-incubated in JDK 16, with refinements. The functions of the MemorySegment and MemoryAddresses interfaces have been distinguished more clearly.
A foreign-memory access API that enables Java programmes to access memory outside of the Java heap safely.
Many Java programs access foreign memory, such as Ignite, mapDB, memcached, Lucene, and Netty's ByteBuf API. Unfortunately, the Java API does not provide a satisfactory solution for accessing foreign memory.
This will help in :
- Avoid the expense and unpredictability of garbage collection (especially if you have a lot of caches)
- Multiple processes can share memory
- Serialize and deserialize memory content by mapping files into memory (via, e.g., mmap).
-
JEP 392: Packaging Tool
Jpackage was implemented as an incubating tool in JDK 14, and it was still incubating in JDK 15. With JDK 16, jpackage moves to production.
The jpackage tool is used to package self-contained Java programmes
Many Java programs access foreign memory, such as Ignite, mapDB, memcached, Lucene, and Netty's ByteBuf API. Unfortunately, the Java API does not provide a satisfactory solution for accessing foreign memory.
Build a packaging tool based on the JavaFX javapackager tool that does the following :
- Supports native packaging formats for a more natural installation experience for end users. On Windows, these formats are msi and exe, on macOS, pkg and dmg, and on Linux, deb and rpm.
- Allows launch-time parameters to be specified at packaging time.
- The ToolProvider API can be used to call it directly from the command line or programmatically.
-
JEP 390: Warnings for Value-Based Classes
Declare the primitive wrapper classes to be value-based, and deprecate their constructors for removal, which will result in new deprecation warnings. Provide warnings when improper synchronisation attempts are made on instances of any Java Platform value-based classes.
Know more.
-
JEP 389: Foreign Linker API (Incubator)
Foreign linker API, providing static, pure-Java access to native code.
This API will be in the incubator stage of JDK 16. Together with the proposed foreign memory access API, the foreign linker API would considerably simplify the otherwise error-prone method of binding to the native library.
Goal :
- Easy to use: Replace JNI with a superior pure-Java development model.
- C Support: The initial scope of this project is aimed at providing high-quality, completely integrated interoperability with C libraries on x64 and AArch64 platforms.
- Generality: The Foreign Linker API and its implementation should be versatile enough to accommodate other platforms (e.g. 32-bit x86) and foreign functions written in languages other than C (e.g. C++, Fortran) over time.
- Efficiency: The International Linker API should provide performance that is comparable to, or better than, JNI.
-
JEP 388: Windows/AArch64 Port
Port the JDK to the Windows / AArch64 platform.
Windows / AArch64 has become a significant demand-based platform with the introduction of a new server-class and consumer AArch64 (ARM64) hardware. The main aim of this proposal is to incorporate the port into the main JDK repository, although the porting itself remaining mostly complete.
Know more.
-
JEP 387: Elastic Metaspace
Return unused hotspot memory to the operating system more efficiently, lower the footprint metaspace and simplify the metaspace code to reduce maintenance costs.
There have been problems with high off-heap memory use in Metaspace. The proposal includes a Buddy-based allocation scheme to replace the current memory allocator and include an algorithm to divide the memory to partitions to meet memory requests.
In order to completely leverage the elasticity provided by the Buddy Allocation, the metaspace memory will be arranged into uniformly sized granules that can be committed and uncommitted independently of each other.
Know more.
-
386: Alpine Linux Port
Port of JDK to the x64 and AArch64 architectures on Alpine Linux and other Linux distributions that make use of the musl library.
Musl is an implementation, for Linux-based systems, of the standard library functionality described in the ISO C and POSIX standards. Several Linux distributions including Alpine Linux and OpenWrt are based on musl
Because of its small image size, Alpine Linux is widely adopted in cloud deployments, microservices, and container environments. A Docker picture is smaller than 6 MB for Linux. In such environments, letting Java run out-of-the-box will allow Tomcat, Jetty, Spring, and other common frameworks to operate natively in these environments. A user can build an even smaller image optimized for running a particular application by using jlink to minimize the size of the Java runtime.
Know more.
-
JEP 376: ZGC: Concurrent Thread-Stack Processing
Shift ZGC thread-stack from safepoints to a concurrent phase.
Z Garbage Collector (ZGC) is designed to make GC pauses and scalability issues in HotSpot a thing of the past. To date, GC operations that scale the size of the heap and the size of the metaspace have been transferred out of safepoint operations and into concurrent phases.
This included marking, relocation, reference processing, unloading class and most root processing. The only operations still carried out in GC safepoints are a root processing subset and a time-bound termination marking operation.
Goals:
- Drop the thread-stack processing from the ZGC safepoint.
- Make stack processing lazy, cooperative, concurrent, and incremental
- Remove all other root processing per thread from the ZGC safepoints.
- Graceful degradation
-
JEP 369: Migrate to GitHub
Host Git repository for OpenJDK Community on GitHub. This will move all single source OpenJDK Projects to GitHub along with JEP 357 (Migrate from Mercurial to Git), and will include all versions 11 and later JDK and JDK upgrade updates.
Know more.
-
JEP 357: Migrate from Mercurial to Git
Migrate Mercurial (hg) to Git from the OpenJDK Project source code repository. The benefits in the size and available resources and hosting of version control system.
Know more.
-
JEP 347: Enable C++14 Language Features
Enable the use of C++14 language features in the JDK C++ source code and provide clear instructions on which features in the HotSpot code can be used.
Know more.
-
JEP 338: Vector API (Incubator)
This offers an initial iteration of an incubator module, to express vector computations that reliably compile at runtime to optimal vector hardware instructions and thus achieve superior performance to equivalent scalar computations.
Goals:
- Clear and concise API : The API should be capable of clearly and concisely expressing a wide range of vector computations. It should be possible to express a computation that is generic to vector size
- Platform agnostic: The API shall be architecture agnostic, enabling support for implementations on multiple CPU architectures. The bias will be to making the Vector API portable, even if some platform-specific idioms cannot be directly expressed in portable code.
- Reliable runtime compilation and performance on x64 and AArch64 architectures
- Graceful degradation : On platforms without vectors, graceful degradation shall yield code competitive with manually-unrolled loops. This may include issuing warnings to the developer if a vector computation cannot be sufficiently compiled to vector hardware instructions.
Take a look at our Suggested Posts :
Quick glance on earlier Java Versions Features :
Java 15 Features - JDK 15
JDK Enhancement Proposals (JEP) has now been officially released on 15 September 2020, listed below features/enhancements as part of the jdk 15 :
- JEP 339: Edwards-Curve Digital Signature Algorithm (EdDSA)
- JEP 360: Sealed Classes (Preview)
- JEP 371: Hidden Classes
- JEP 372: Remove the Nashorn JavaScript Engine
- JEP 374: Disable and Deprecate Biased Locking
- JEP 375: Pattern Matching for instanceof (Second Preview)
- JEP 377: ZGC: A Scalable Low-Latency Garbage Collector
- JEP 378: Text Blocks
- JEP 379: Shenandoah: A Low-Pause-Time Garbage Collector
- JEP 381: Remove the Solaris and SPARC Ports
- JEP 383: Foreign-Memory Access API (Second Incubator)
- JEP 384: Records (Second Preview)
- JEP 385: Deprecate RMI Activation for Removal
Java 14 Features - JDK 14
JDK Enhancement Proposals (JEP) has targeted JDK 14 release for ,17 March 2020 for below features :
- Pattern Matching for instanceof
- Non-Volatile Mapped Byte Buffers
- Helpful NullPointerExceptions
- Switch Expressions (Standard)
- Packaging Tool (Incubator)
- NUMA-Aware Memory Allocation for G1
- JFR Event Streaming
- Records (Preview)
- Deprecate the Solaris and SPARC Ports
- Remove the Concurrent Mark Sweep (CMS) Garbage Collector
- ZGC on macOS
- ZGC on Windows
- Deprecate the ParallelScavenge + SerialOld GC Combination
- Remove the Pack200 Tools and API
- Text Blocks (Second Preview)
- Foreign-Memory Access API
Java 13 Features - JDK 13
- Dynamic CDS Archives
- ZGC: Uncommit Unused Memory
- Reimplement the Legacy Socket API
- Switch Expressions (Preview)
- Text Blocks (Preview)
Java 12 Features
- Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
- Microbenchmark Suite
- Switch Expressions (Preview)
- JVM Constants API
- One AArch64 Port, Not Two
- Default CDS Archives
- Abortable Mixed Collections
- Promptly Return Unused Committed Memory from G1
Java 11 Features
- 181: Nest-Based Access Control
- 309: Dynamic Class-File Constants
- 315: Improve Aarch64 Intrinsics
- 318: Epsilon: A No-Op Garbage Collector
- 320: Remove the Java EE and CORBA Modules
- 321: HTTP Client (Standard)
- 323: Local-Variable Syntax for Lambda Parameters
- 324: Key Agreement with Curve25519 and Curve448
- 327: Unicode 10
- 328: Flight Recorder
- 329: ChaCha20 and Poly1305 Cryptographic Algorithms
- 330: Launch Single-File Source-Code Programs
- 331: Low-Overhead Heap Profiling
- 332: Transport Layer Security (TLS) 1.3
- 333: ZGC: A Scalable Low-Latency Garbage Collector(Experimental)
- 335: Deprecate the Nashorn JavaScript Engine
- 336: Deprecate the Pack200 Tools and API
Java 10 Features
- Local-variable type inference
- Experimental Java-based JIT compiler.This is the integration of the Graal dynamic compiler for the Linux x64 platform
- Application class-data sharing. This allows application classes to be placed in the shared archive to reduce startup and footprint for Java applications
- Time-based release versioning
- Parallel full GC
- Garbage-collector interface
- Additional Unicode language-tag extensions
- Root certificates
- Thread-local handshakes
- Heap allocation on alternative memory devices
- Remove the native-header generation tool - javah
- Consolidate the JDK forest into a single repository
Java 9 Features
- Modularization of the JDK under Project Jigsaw (Java Platform Module System)
- jshell: The Java Shell (a Java REPL)
- Ahead-of-time compilation
- XML catalogs
- More concurrency updates. It includes a Java implementation of Reactive Streams, including a new Flow class that included the interfaces previously provided by Reactive Streams
- Variable handles: define a standard means to invoke the equivalents of various java.util.concurrent.atomic and sun.misc.Unsafe operations
- jlink: The Java Linker: create a tool that can assemble and optimize a set of modules and their dependencies into a custom run-time image. It effectively allows to produce a fully usable executable including the JVM to run it
- JavaDB was removed from JDK
- HiDPI graphics: automatic scaling and sizing
Java 8 Features
- Language-level support for lambda expressions and default methods (virtual extension methods) which allow the addition of methods to interfaces without breaking existing implementations.
- Project Nashorn, a JavaScript runtime which allows developers to embed JavaScript code within applications
- Annotation on Java types
- Unsigned integer arithmetic
- Repeating annotations
- Date and time API
- Statically-linked JNI libraries
- Launch JavaFX applications (direct launching of JavaFX application JARs)
- Remove the permanent generation
Java 7 Features
- JVM support for dynamic languages
- Compressed 64-bit pointers
- Strings in switch
- Automatic resource management in try-statement
- Improved type inference for generic instance creation, aka the diamond operator <>
- Simplified varargs method declaration
- Binary integer literals
- Allowing underscores in numeric literals
- Catching multiple exception types and rethrowing exceptions with improved type checking
- Concurrency utilities
- New file I/O library adding support for multiple file systems
- Timsort is used to sort collections and arrays of objects instead of merge sort
- Library-level support for elliptic curve cryptography algorithms
- An XRender pipeline for Java 2D, which improves handling of features specific to modern GPUs
- New platform APIs for the graphics features
- Enhanced library-level support for new network protocols, including SCTP and Sockets Direct Protocol
- Upstream updates to XML and Unicode
- Java deployment rule sets
Java 6 Features
- Support for older Win9x versions dropped
- Scripting Language Support
- Dramatic performance improvements for the core platform, and Swing.
- Improved Web Service support through JAX-WS.
- JDBC 4.0 support.
- Java Compiler API
- Upgrade of JAXB to version 2.0
- Support for pluggable annotations
- Many GUI improvements, such as integration of SwingWorker in the API, table sorting and filtering, and true Swing double-buffering (eliminating the gray-area effect).
- JVM improvements include: synchronization and compiler performance optimizations, new algorithms and upgrades to existing garbage collection algorithms, and application start-up performance.
- Java 6 can be installed to Mac OS X 10.5 (Leopard) running on 64-bit (Core 2 Duo and higher) processor machines.[54] Java 6 is also supported by both 32-bit and 64-bit machines running Mac OS X 10.6
Java 5 Features
- Generic
- Metadata
- Autoboxing/unboxing
- Enumerations
- Varargs
- Enhanced for each loop
- Improved
- Static imports
- Improvements - Semantics of execution for multi-threaded Java programs
- Improvements - Automatic stub generation for RMI objects
- Improvements - Swing: New skinnable look and feel, called synth
- Improvements - The concurrency utilities in package java.util.concurrent
- Improvements - Scanner class for parsing data from various input streams and buffers