Java Platform, Standard Edition What’s New in Oracle JDK 9, Release 9

JEP 102: Process API Updates

Improves the API for controlling and managing operating system processes.

The ProcessHandle class provides the process’s native process ID, arguments, command, start time, accumulated CPU time, user, parent process, and descendants. The class can also monitor processes’ liveness and destroy processes. With the ProcessHandle.onExit method, the asynchronous mechanisms of the CompletableFuture class can perform an action when the process exits.

See Process API in Java Platform, Standard Edition Java Core Libraries Developer’s Guide, java.lang.Process, and java.lang.ProcessHandle.

JEP 193: Variable Handles

Defines a standard means to invoke the equivalents of java.util.concurrent.atomic and sun.misc.Unsafe operations upon object fields and array elements.

Defines a standard set of fence operations, which consist of VarHandle static methods that enable fine-grained control of memory ordering. This is an alternative to sun.misc.Unsafe, which provides a nonstandard set of fence operations.

Defines a standard reachability fence operation to ensure that a referenced object remains strongly reachable.

JEP 254: Compact Strings

Adopts a more space-efficient internal representation for strings. Previously, the String class stored characters in a char array, using two bytes (16 bits) for each character. The new internal representation of the String class is a byte array plus an encoding-flag field.

This is purely an implementation change, with no changes to existing public interfaces.

See the CompactStrings option of the java command in Java Platform, Standard Edition Tools Reference.

JEP 264: Platform Logging API and Service

Defines a minimal logging API that platform classes can use to log messages, together with a service interface for consumers of those messages. A library or application can provide an implementation of this service to route platform log messages to the logging framework of its choice. If no implementation is provided, then a default implementation based on the java.util.logging API is used.

JEP 266: More Concurrency Updates

Adds further concurrency updates to those introduced in JDK 8 in JEP 155: Concurrency Updates, including an interoperable publish-subscribe framework and enhancements to the CompletableFuture API.

JEP 268: XML Catalogs

Adds a standard XML Catalog API that supports the Organization for the Advancement of Structured Information Standards (OASIS) XML Catalogs version 1.1 standard. The API defines catalog and catalog-resolver abstractions that can be used as an intrinsic or external resolver with the JAXP processors that accept resolvers.

Existing libraries or applications that use the internal catalog API will need to migrate to the new API to take advantage of the new features.

See XML Catalog API in Java Platform, Standard Edition Java Core Libraries Developer’s Guide.

JEP 274: Enhanced Method Handles

Enhances the MethodHandle, MethodHandles, and MethodHandles.Lookup classes of the java.lang.invoke package to ease common use cases and enable better compiler optimizations.

  • In the MethodHandles class in the java.lang.invoke package, provide new MethodHandle combinators for loops and try/finally blocks.

  • Enhance the MethodHandle and MethodHandles classes with new MethodHandle combinators for argument handling.

  • Implement new lookups for interface methods and, optionally, super constructors in the MethodHandles.Lookup class.

Additions include:

JEP 277: Enhanced Deprecation

@Deprecated

annotation to provide better information about the status and intended disposition of an API in the specification. Two new elements have been added:

  • @Deprecated(forRemoval=true) indicates that the API will be removed in a future release of the Java SE platform.

  • @Deprecated(since=”version”) contains the Java SE version string that indicates when the API element was deprecated, for those deprecated in Java SE 9 and beyond.

Revamps theannotation to provide better information about the status and intended disposition of an API in the specification. Two new elements have been added:

For example: @Deprecated(since=”9″, forRemoval=true)

@Deprecated annotations in the core platform have been updated.

You can use a new tool, jdeprscan, to scan a class library (JAR file) for uses of deprecated JDK API elements.

See Enhanced Deprecation in Java Platform, Standard Edition Java Core Libraries Developer’s Guide.

See jdperscan in Java Platform, Standard Edition Tools Reference.

JEP 285: Spin-Wait Hints

Defines an API that enables Java code to hint that a spin loop is executing. A spin loop repeatedly checks to see if a condition is true, such as when a lock can be acquired, after which some computation can be safely performed followed by the release of the lock. This API is purely a hint, and carries no semantic behavior requirements. See the method Thread.onSpinWait.

JEP 290: Filter Incoming Serialization Data

Allows incoming streams of object-serialization data to be filtered to improve both security and robustness. Object-serialization clients can validate their input more easily, and exported Remote Method Invocation (RMI) objects can validate invocation arguments more easily as well.

Serialization clients implement a filter interface that is set on an ObjectInputStream. For RMI, the object is exported through a RemoteServerRef that sets the filter on the MarshalInputStream to validate the invocation arguments as they are unmarshalled.

JEP 259: Stack-Walking API

Provides a stack-walking API that allows easy filtering and lazy access to the information in stack traces.

The API supports both short walks that stop at a frame that matches given criteria, and long walks that traverse the entire stack. Stopping at a frame that matches a given criteria avoids the cost of examining all the frames if the caller is interested only in the top frames on the stack. The API enables access to Class objects when the stack walker is configured to do so. See the class java.lang.Stackwalker.

JEP 255: Merge Selected Xerces 2.11.0 Updates into JAXP

Updates the JDK to support the 2.11.0 version of the Xerces parser. There is no change to the public JAXP API.

The changes are in the following categories of Xerces 2.11.0: Datatypes, DOM L3 Serializer, XPointer, Catalog Resolver, and XML Schema Validation (including bug fixes, but not the XML Schema 1.1 development code).