Aligning compiler messages for using preview API with preview language features?

Joe Darcy joe.darcy at oracle.com
Wed Jul 3 00:33:35 UTC 2019


Hello,

As a follow-up to some recent work ("Improving compiler messages for 
preview API " [1]), I wanted to get some feedback on a possible 
variation of the work to align the messages for using preview API 
elements and using preview language features.

Assuming some mechanism to implement a predicate identifying a preview 
API (presence of an annotation, side table in the compiler, etc.), the 
messages for preview APIs could be routed through the same 
previewHandler used to process preview language features.

The summary message

     Note: Test.java uses preview language features.
     Note: Recompile with -Xlint:preview for details.

could then be replaced with something like

     Note: Test.java uses preview language features and/or preview API 
elements.
     Note: Recompile with -Xlint:preview for details.

or more specialize variants for the particular combinations of a least 
one flavor of preview functionality being used.

Comments?

Thanks,

-Joe

[1] 
https://mail.openjdk.java.net/pipermail/compiler-dev/2019-June/013498.html



More information about the compiler-dev mailing list