JDK 17 - What's new features released in Java 17
JDK 17 has released on 14 September 2021 . With 10 new features + 2 feature removals + 2 feature deprecations.
It standardises sealed classes, restores always-strict floating-point semantics, and shows
off pattern matching for switch statements. It deprecates the Security Manager and Applet APIs in
preparation for their removal in a future release and more details to watch out...
Java 17 release date :
14 September 2021Java 17 Download :
Java 17 JDK/JREJava 17 released as the next LTS version of Java. Long-term support (LTS) is a product lifecycle management policy in which a stable release of computer software is maintained for a longer period of time than the standard edition. The term is typically reserved for open-source software, where it describes a software edition that is supported for months or years longer than the software's standard edition.
Java 17 has below features as part of the JDK 17:
-
JEP 415: Context-Specific Deserialization Filters
-
JEP 414: Vector API (Second Incubator)
-
JEP 412: Foreign Function & Memory API (Incubator)
-
JEP 411: Deprecate the Security Manager for Removal
-
JEP 410: Remove the Experimental AOT and JIT Compiler
-
JEP 409: Sealed Classes
-
JEP 407: Remove RMI Activation
-
JEP 406: Pattern Matching for switch (Preview)
-
JEP 403: Strongly Encapsulate JDK Internals
-
JEP 398: Deprecate the Applet API for Removal
-
JEP 391: macOS/AArch64 Port
-
JEP 382: New macOS Rendering Pipeline
-
JEP 356: Enhanced Pseudo-Random Number Generators
-
JEP 306: Restore Always-Strict Floating-Point Semantics
JEP 415 : Context-Specific Deserialization Filters
Allow applications to configure context-specific and dynamically-selected deserialization filters using a JVM-wide filter factory that is used to choose a filter for each each deserialization operation.
Motivation:
- Deserialization of untrusted data is an operation that is intrinsically risky, because the contents of incoming data streams are obtained in many cases via an unknown or unauthenticated client.
- The key to preventing serialisation attacks is to prohibit instances of arbitrary classes from being deserialized, which prevents the execution of their methods either directly or indirectly.
- An attacker can run code from any class with bad intent by carefully constructing the stream. The integrity of application objects, library objects, and the Java runtime could be compromised if object construction involves side effects that change state or trigger other operations.
JEP 414: Vector API (Second Incubator)
Introduce an platform-agnostic vector API first integrated into JDK 16 and will be incubated again in JDK 17 to express vector computations that reliably compile to optimal vector instructions on supported CPU architectures at runtime, outperforming equivalent scalar computations.
The vector API in JDK 17 has been improved for performance and implementation, including enhancements to translate byte vectors to and from boolean arrays.
Goals:
- Clear and concise API : The API should be capable of expressing a broad variety of vector computations in a clear and concise manner.
- Platform agnostic : The API should be independent of CPU architecture, allowing implementations on a variety of architectures that support vector instructions.
- Reliable runtime compilation and performance on x64 and AArch64 architectures
- Graceful degradation : If a vector computation cannot be efficiently compiled to vector instructions, warnings can be issued.
JEP 412: Foreign Function & Memory API (Incubator)
Introduce an API that allows Java programmes to call up native libraries and process native data without the risk of JNI, by efficiently invoking foreign functions (i.e., code outside of the JVM) and securely accessing foreign memory (i.e. memory not handled by the JVM).
In this JEP proposal is evolution of earlier two incubating APIs: the Foreign-Memory Access API and the Foreign Linker API. which was previously targeted in Java 14, 15 and Java 16
Goals:
- Ease of use : Replace a superior pure Java development model with the Java Native Interface (JNI).
- Performance : Performance that is similar to existing APIs like JNI or sun.misc.Unsafe, if not better. Performance.
- General : Provided ways to work on various types of external memory (for example, native memory, persistent memory and heap memory) and to accommodate other platforms over time (for example, x86 32-bit) and foreign functions written in languages other than C (for example, C++, FORTAN).
- Safety : Deactivate default unsecure operations only when the application developers or end users have expressly opted in.
JEP 411: Deprecate the Security Manager for Removal
Since Java 1.0, there has been a Security Manager. However, it has been rarely used for many years. In order to move Java forward, Security Manager has been deprecated in Java 17 and will be removed in a future version, along with the legacy Applet API (JEP 398).
Goals:
- Prepare developers for the Security Manager's removal in a future version of Java.
- If a user's Java programme relies on the Security Manager, issue an alert.
- Evaluate if new APIs or mechanisms are required to fix unique, limited use cases where the Security Manager has been used, such as blocking System::exit.
JEP 410: Remove the Experimental AOT and JIT Compiler
Remove the experimental Java-based ahead-of-time (AOT) and just-in-time (JIT) compiler because of limited usage and effort required to maintain it is significant.
Even though retain the experimental Java-level JVM compiler interface (JVMCI) such that developers can continue to use externally-built versions of the compiler for JIT compilation with use of Graal compiler (GraalVM).
Motivation:
As the experimental feature JDK 9 has been integrated with ahead-of time compilation (the jaotc tool). For AOT compilation, the jaotc uses the Java-written Graal compiler. Since these experimental characteristics have not been used, and there is a considerable effort to maintain and improve them. The JDK 16 builds released by Oracle did not have these functions, neither did anyone complain.
JEP 409: Sealed Classes
Sealed Classes were proposed and delivered as a
second preview feature in JDK 16.
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.
A class can be sealed by using the sealed modifier - permits to its declaration. After which any extends and implements clauses, the permits clause specifies the classes that are permitted/allowed to extend the sealed class.
Example: Below example shows how Animal class specifies three permitted subclasses:package com.techgeeknext.example.species;
public sealed class Animal
permits Dog, Monkey, Leopard {...}
Note: The classes specified by permits must be located close to the superclass,
either in the same module or in the same package.
package com.techgeeknext.example.species;
public sealed class Animal
com.techgeeknext.example.species.canis.Dog,
com.techgeeknext.example.species.macaca.Monkey,
com.techgeeknext.example.species.rana.Leopard
{....}
Know more.
JEP 407: Remove RMI Activation
The Remote Method Invocation (RMI) Activation mechanism will be removed, but the rest of RMI should be preserved. The RMI Activation mechanism has become redundant and is no longer in use. JEP 385 in Java SE 15 deprecated it and recommended that it be removed.
JEP 406: Pattern Matching for switch (Preview)
Pattern matching for switch expands Java's pattern language to allow switch expressions and statements to be verified against a variety of patterns, each with a different action. This makes it possible to express complex data-oriented queries in a simplistic and secure manner.
The instanceof operator in JDK 16 has been expanded to accept a type pattern and perform pattern matching. The modest extension proposed simplifies the well-known instanceof-and-cast idiom.
Goals:
- Allowing patterns to appear in case labels increases the expressiveness and applicability of switch phrases and statements.
- Let the null-hostility of the historical turning point be relaxed if needed.
- Two new patterns will be introduced:
- Guarded patterns: to refine pattern matching logic using arbitrary boolean expressions.
- Parenthesized patterns: to clear up parsing ambiguities.
- Ensure that all existing switch expressions and statements compile with identical semantics and perform them without any modification.
JEP 403: Strongly Encapsulate JDK Internals
Strongly encapsulate all internal elements of the JDK, except for critical internal APIs such as sun.misc.Unsafe. It will no longer be possible to relax the strict encapsulation of internal parts with a single command-line option, as it was from JDK 9 to JDK 16.
JEP 398: Deprecate the Applet API for Removal
Applet API is effectively useless, because all web browser vendors have either removed or revealed plans to drop support for Java browser plug-ins . While the Applet API was deprecated in Java 9, it was not removed earlier.
JEP 391: macOS/AArch64 Port
Port the JDK to the new architecture macOS/AArch64 expecting future demand
Motivation:
- Apple's decision to move from x64 to AArch64 on its Macintosh computers. For Linux, an AArch64 version of Java is already available, and development on a Windows port is currently underway.
- Because of discrepancies in low-level conventions such as the programme binary interface and the collection of reserved processor registers, Java developers plan to reuse existing AArch64 code from these ports by using conditional compilation, as is standard in JDK ports.
- Changes for MacOS/AArch64 have the potential to split current Linux/AArch64, Windows/AArch64, and MacOS/x64 ports, although this possibility can be mitigated by pre-integration testing.
JEP 382: New macOS Rendering Pipeline
Need for new Java 2D rendering pipeline for macOS using the new Apple Metal framework. As today, Java 2D is totally reliant on OpenGL. While Apple deprecated the OpenGL rendering library in macOS 10.14, but the Metal framework replaces the OpenGL rendering library.
Goals:
- Provide a completely functioning rendering pipeline for the macOS Metal framework-based Java 2D API.
- In select real-world applications and benchmarks, provide performance comparable to or better than the OpenGL pipeline.
- Coexist with the OpenGL pipeline until it is discontinued.
JEP 356: Enhanced Pseudo-Random Number Generators
Introduces new interface and implementations for pseudorandom number generators (PRNGs), which including jumpable PRNGs and a new class of splittable PRNG algorithms (LXM).
Motivating the plan is a focus on multiple areas for improvement in the area of pseudorandom number generation in Java. RandomGenerator, a modern interface, will have a uniform API for all current and new PRNGs, as well as four specialised RandomGenerator interfaces.
Goals:
- Make it simpler to use different PRNG algorithms in different applications.
- By providing streams of PRNG objects, you can better support stream-based programming.
- Remove redundant code from current PRNG groups.
- Maintain the actions of the java.util.Random class as far as possible.
JEP 306: Restore Always-Strict Floating-Point Semantics
Rather of having both severe floating-point semantics (strictfp) and significantly different default floating-point semantics, make floating-point operations uniformly strict. This will return the language and virtual machine to their original floating-point semantics, as they were before the introduction of strict and default floating-point modes in Java SE 1.2.
Goals:
- Continue to improve the JDK's security and maintainability, which is one of Project Jigsaw's primary objectives.
- Encourage developers to move away from internal parts and toward standard APIs so that they and their users can upgrade to future Java releases with ease.
Latest version of Java is Java 16 : JDK 16 Features
Java 17 is still in progress, so you can take a look at the latest Java version: Java 16 functionality upgrade to get an idea of what will be in JDK 17
The open-source Java 16 (Java SE 16) and Java Development Kit 16 (JDK 16) is released. The feature set has been frozen for the time being. There will be no more JEPs for this release; developers can start looking at JDK 16 now to get a sense of what's coming in JDK 16. Java 16 released on date : 16 March 2021
Some of the new feature highlights 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..
Download : JDK 16 ReleaseJDK 16 is here, below features are part of jdk 16.
-
JEP 397: Sealed Classes (Second Preview)
-
JEP 396: Strongly Encapsulate JDK Internals by Default
-
JEP 395: Records
-
JEP 394: Pattern Matching for instanceof
-
JEP 393: Foreign-Memory Access API (Third Incubator)
-
JEP 392: Packaging Tool
-
JEP 390: Warnings for Value-Based Classes
-
JEP 389: Foreign Linker API (Incubator)
-
JEP 388: Windows/AArch64 Port
-
JEP 387: Elastic Metaspace
-
386: Alpine Linux Port
-
JEP 376: ZGC: Concurrent Thread-Stack Processing
-
JEP 369: Migrate to GitHub
-
JEP 357: Migrate from Mercurial to Git
-
JEP 347: Enable C++14 Language Features
-
JEP 338: Vector API (Incubator)
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