New Non-Language Features in Java 17 | TechWell

New Non-Language Features in Java 17

New Non-Language Features in Java 17

A Java application, or program, runs on the Java Virtual Machine (JVM). Each new version of Java brings new language and non-language features. Some features are related to the JVM itself, and other features are related to core-libs, client-libs, deprecated APIs and such. An earlier article discussed the new language features in Java 17, a Long Term Support (LTS) version. This article discusses some of the new non-language features.

Pseudo-Random Number Generators

Pseudo-Random Number Generators (PRNGs) generate almost random numbers; that is why they are called “Pseudo.” Java 17 introduces new interfaces and implementations for PRNGs to make it easier to use various PRNG algorithms interchangeably, support streams of PRNG objects, and eliminate code duplication in existing PRNG classes, while preserving the behavior of the legacy class java.util.Random. A new interface RandomGenerator provides a uniform interface for all existing and new PRNGs. Four sub-interfaces of RandomGenerator provide specialized functionality; SplittableRandomGenerator, JumpableRandomGenerator, LeapableRandomGenerator, and ArbitrarilyJumpableRandomGenerator.

Keeping Up with the macOS

The macOS has made some changes, and Java 17 has kept up with those changes. Graphical user interfaces (GUIs) on macOS internally used the platform-specific OpenGL API for rendering, including Java 2D API internal rendering, up till version 10.14. Later versions of macOS have replaced OpenGL API with the Metal framework for internal rendering, which implies that Java 2D internal rendering does not make use of the OpenGL API either. Java 17 adds support for the Java 2D API internal rendering pipeline for the Metal framework so that the macOS can continue to render the Java 2D API based GUIs.

Another change mcOS announced in 2020 was to transition from Intel x86-64 processors to Apple-designed systems on a chip based on the AArch64 architecture. The transition has already been made for the iMac. Only Mac Pro and Mac Mini are yet to be transitioned. Java 17 provides a macOS/AArch64 port of the JDK.

Applet API Deprecated for Removal

Applets have been included in the JDK from the beginning. An applet is a small program that can be embedded in a web page via a Java Applet browser plugin, or run standalone in a Java Applet Viewer. Applet’s main disadvantages were its dependence on the JRE, and lack of support on mobile browsers. Applets were deprecated in JDK 9. Most browsers already don’t support the Java Applet browser plugin. JDK 17 deprecates Applets for removal.

Internal APIs Encapsulated

The JDK has always included internal APIs that were for internal use only, and not meant to be used by a developer. These internal APIs include the non-critical internal APIs, and critical internal APIs. The non-critical internal APIs’ functionality is available in standard JDK APIs, and libraries but such APIs are still accessed directly for convenience. Such non-critical internal APIs include the jdk.*, and org.* packages. But because non-critical internal APIs are sometimes used, maintaining such non-standard implementations is a burden. Some non-public classes, methods, and fields in java.* packages are designed for privileged operations, or cryptographic data, and use of such internal APIs is counter to the purpose of such APIs, which is to limit access to them.

JDK 9 encapsulated the non-critical internal APIs making them inaccessible at compile-time, but still accessible via some command-line options. JDK 16 introduced strong encapsulation of the non-critical internal APIs with the provision to relax the strong encapsulation. JDK 17 strongly encapsulates the non-critical internal APIs without a provision to relax the strong encapsulation so that it is not easy for a user developed application to access them. Critical internal APIs provide critical functionality that is difficult, or impossible, to implement outside of the JDK. JDK 17 does not encapsulate the critical internal APIs.

Some other new non-language new features include removal of RMI Activation, removal of the experimental AOT and JIT compiler, deprecation of the Security Manager for removal, foreign function & Memory API, Vector API, and Context-Specific Deserialization Filters.

Up Next

About the Author

TechWell Insights To Go

(* Required fields)

Get the latest stories delivered to your inbox every week.