RFR: JDK-8226585: Improve javac messages for using a preview API

Alex Buckley alex.buckley at oracle.com
Wed Oct 16 17:45:08 UTC 2019

On 10/16/2019 5:50 AM, Jan Lahoda wrote:
> -loosened the handling of essential preview APIs when --enable-preview 
> and @SuppressWarnings is applied - there is no warning for the essential 
> APIs (as there is no warning in such a case for non-essential APIs). 
> This is per the discussion in the CSR:
> https://bugs.openjdk.java.net/browse/JDK-8231411

Thank you for implementing this change so quickly. Per the discussion in 
the CSR, I have updated JEP 12 to allow suppression in the case above 
(see http://openjdk.java.net/jeps/12#Relationship-to-Java-SE-APIs / 
second list / fourth bullet) and also the JLS RFE (JDK-8231433).

The interesting takeaway is that use of a preview language feature 
generates a non-suppressible warning (scan JEP 12 for "This message 
cannot be turned off") while use of an essential API element associated 
with a preview language feature generates a suppressible warning.


More information about the compiler-dev mailing list