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

Alex Buckley alex.buckley at oracle.com
Tue Jul 16 23:14:15 UTC 2019


On 7/2/2019 5:33 PM, Joe Darcy wrote:
> 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.

If this is strictly about the wording of the summary message, then I 
would prefer to stay away from the term "preview API" until such time as 
there is a java.lang.Preview annotation type which supercedes 
terminal-deprecation-at-birth. Perhaps:

   Note: Test.java uses preview language features and/or
         APIs connected with preview language features.
   Note: Recompile ...

And if you compile with --enable-preview but (say) you don't use text 
blocks, you just call String::stripIndent directly:

   Note: Test.java uses APIs connected with preview language features.
   Note: Recompile ...

Alex


More information about the compiler-dev mailing list