Java SE 12 ( JSR 386)
Public Review Specification
Iris Clark & Brian Goetz
2018/10/31 22:29 -0700 [2dbd38e170f8]

This Specification defines version 12 of the Java Platform, Standard Edition (“Java SE 12”). The Reference Implementation of this Specification is the Java Development Kit, version 12 (“JDK 12”).

Contents
1Summary
2Structure
3Definitions
4Component JSR Specifications
5Feature summary
6Feature descriptions
7Modules
8APIs removed
9APIs proposed for removal
Annexes
A1Complete API Specification
A2API Specification differences
A3Java Language & Virtual Machine Specifications
1
Summary  

This release continues the evolution of the Platform to ensure the broadest possible success of the core Java technology. It contains language preview features to provoke developer feedback based on real world use.

2
Structure  

This document directly specifies API features, enhancements, clarifications, and bug fixes. It also specifies features by reference to other Specifications which are revised in Maintenance Releases of existing JSRs. The specifications of these changes are contained in two accompanying documents: Annex 1 is the complete Java SE 12 API Specification and Annex 2 is an annotated API specification showing the exact differences relative to Java SE 11. Informative background for these changes may be found in the list of approved Change Specification Requests for this release.

This Specification includes the Java SE 12 Editions of The Java Language Specification and The Java Virtual Machine Specification in Annex 3. The Java SE 12 Editions contain all corrections and clarifications made since the Java SE 11 Editions, as well as additions for new features.

The Final Release of this Specification is expected to include all of the currently described features and updates; however, further changes may be forthcoming. For example, the Expert Group could determine that a feature is not yet be ready for standardization.

3
Definitions  

Changes to the Java SE Platform Specification are categorized as either features or enhancements. A feature is, roughly speaking, a change of which at least one of the following statements is true:

Any addition that is not a feature is considered an enhancement.

There is, obviously, room for judgment when interpreting this definition. In order to maximize the visibility of Platform revisions we generally tend to consider borderline items to be features rather than enhancements.

4
Component JSR Specifications  

Some Component JSR Specifications previously incorporated into the Platform are still available separately or have significant Specifications themselves. Changes to their Specifications are therefore made in separate Maintenance Releases. The following existing component JSRs may have Maintenance Releases. These will be incorporated by reference before the Final Release of this Specification as necessary:

JSR 114: JDBC Rowset Implementations
JSR 199: Java Compiler API
JSR 221: JDBC API
JSR 269: Pluggable Annotation-Processing API

Each Component JSR Specification, or revision thereto, may be related to one or more features in the detailed list below.

5
Feature summary  
LanguageRaw String Literals (Preview)
Switch Expressions (Preview)
6
Feature descriptions  

Work on features in the Java SE 12 Reference Implementation is organized in terms of JDK Enhancement Proposals (JEPs). Each feature description gives a link to the corresponding JEP document as a convenience, but that document is not a normative part of this Specification. Some features are included in the Java SE 12 Reference Implementation on a preview basis, to gain exposure before achieving permanent status in a later release of the Java SE Platform.

Language
Raw String Literals (Preview)

Add raw string literals to the Java programming language. A raw string literal can span multiple lines of source code and does not interpret escape sequences, such as \n, or Unicode escapes, of the form \uXXXX. This will be a preview language feature.

Switch Expressions (Preview)

Extend the switch statement so that it can be used as either a statement or an expression, and that both forms can use either a "traditional" or "simplified" scoping and control flow behavior. These changes will simplify everyday coding, and also prepare the way for the use of pattern matching (JEP 305) in switch. This will be a preview language feature.

Preview features A preview language or VM feature is a new feature of the Java SE Platform that is fully specified, fully implemented, and yet impermanent. Preview features must possess the following properties:

Implementations of this Specification must:

Additional details about preview features, including a description of a feature’s life cycle and the relationship of preview features to Java SE APIs are available in JEP 12 Preview Language and VM Features.

7
Modules  

A module is a named set of packages designed for reuse. A specification governed by the JCP defines standard packages, and may group them into one or more standard modules.

This Specification groups the standard packages of the Java SE Platform into 21 standard modules, which we refer to as the Java SE modules. The name of a Java SE module always starts with the string "java.". The complete list of such modules is:

java.base
java.compiler
java.datatransfer
java.desktop
java.instrument
java.logging
java.management
java.management.rmi
java.naming
java.net.http
java.prefs
java.rmi
java.scripting
java.se (aggregator)
java.security.jgss
java.security.sasl
java.sql
java.sql.rowset
java.transaction.xa
java.xml
java.xml.crypto

Compared to Java SE 11, this Specification does not add or remove any modules.

The module graph The Java SE modules depend upon each other as stated in their specifications, which are part of the overall API Specification. The corresponding complete Java SE module graph has too many edges to be displayed easily in visual form; here is the transitive reduction of the directed acyclic graph, in which redundant edges are omitted (click to enlarge):

java.se Spec Module Graph

Here is how to read this visualization of the module graph:

A module is a Java SE module — that is, considered part of the Java SE Platform Specification — if and only if it is a standard module reachable from the java.se module.

This Specification incorporates the following subsections by reference from Java SE 9 Platform Specification (JSR 379), “Modules”:

8
APIs removed  

Following the conventions established by the Enhanced Deprecation feature, various modules and APIs were annotated with forRemoval=true in the “APIs Proposed for Removal” section of the Platform Specifications for Java SE 9, Java SE 10, and Java SE 11.

The following individual APIs are removed from this Specification. The number in parentheses indicates the Java SE Platform Specification which first proposed their removal.

Methods

9
APIs proposed for removal  

The following APIs were proposed for removal by the Platform Specifications for Java SE 9, Java SE 10, and Java SE 11, and continue to be eligible for removal in a future release. They are not removed from this Specification.

Packages 

Interfaces 

Classes 

Exceptions 

Fields 

Methods 

Additional details about deprecations, including potential alternatives, may be found in the Deprecated API list of the API Specification. Migration away from deprecated APIs is strongly encouraged.

Compared to Java SE 11, this Specification does not add or propose to remove any further APIs.