Preview features to include Java SE APIs
alex.buckley at oracle.com
Thu Apr 9 23:34:47 UTC 2020
In 2018, Oracle introduced the idea of "preview language features" as a
way to have high-quality, fully-specified, but non-final technology in a
mainline Java SE release . This was well received by the Java
community, so we are now proposing the idea of "preview APIs" . The
non-final technology in this case consists of modules, packages, types,
methods, and fields in the Java SE API.
It's already normal for preview language features to motivate new types
and methods in the Java SE API . For example, the preview of Records
introduced `java.lang.Record`, while the preview of Text Blocks added
methods to `java.lang.String`. Such types and methods are available to
programmers only when preview features are enabled overall. Going
forward, any new API point, regardless of connection to the Java
language, could be specified as a preview API; it would then be
available to programmers only when preview features are enabled overall.
In the Java SE Platform Specification, the rules for preview features
 would be extended to cover preview APIs too. The family of preview
features in a given Java SE release would consist of the preview
language features, preview VM features, and preview APIs specified for
that release. All represent Java SE functionality that must be supported
in all implementations, disabled by default, and enabled all at once.
We're confident that the successful outcomes seen with preview language
features -- for example, the graduation of switch expressions from
preview status in Java SE 12 and 13 to final permanent status in 14 --
will be repeated for preview APIs.
Without making any commitments, two possible sources of preview APIs are
Projects Loom and Panama in OpenJDK. Loom's Early Access release
enhances `java.lang.Thread` with support for "virtual threads" ,
while Panama offered an API for low-level memory access as an
"incubator" module in JDK 14 . As these APIs mature, we hope they
will become candidates to preview in a Java SE release, thus maximizing
feedback and improving them still further.
More information about the java-se-spec-experts