Preview APIs for preview features -- JDK 14+

Alex Buckley alex.buckley at oracle.com
Tue Sep 24 22:54:57 UTC 2019


On 9/6/2019 2:58 PM, Alex Buckley wrote:
> Platform enthusiasts will know that the Java SE 13 Edition of the JLS 
> recently shared with the JSR-388 Expert Group includes a new 
> section, 1.5 "Preview Features". For the Java SE 14 Edition onwards, JLS 
> 1.5 will enumerate the relevant APIs as well as the preview features 
> themselves. It will also specify the compile-time error and the 
> non-suppressible warning that are due, respectively, when said APIs are 
> used with preview features disabled and with preview features enabled.

I have updated JEP 12 "Preview Language and VM Features" to embody the 
error / non-suppressible-warning policy for use of "essential" APIs:

   http://openjdk.java.net/jeps/12#Relationship-to-Java-SE-APIs

There is a corresponding JLS change, and a CSR for javac's new behavior:

   https://bugs.openjdk.java.net/browse/JDK-8231433
   https://bugs.openjdk.java.net/browse/JDK-8231411

In the JDK sandbox, Jan and Jon have been working on the `@preview` tag 
for javadoc, and using it to replace `@Deprecated(forRemoval=true, 
since="13")` on API elements like String::stripIndent that are essential 
for text blocks:

   http://hg.openjdk.java.net/jdk/sandbox/rev/ee07de0d2c16

Everything is coming together to support whichever preview features are 
deemed worthy for JDK 14!

Alex


More information about the jdk-dev mailing list