Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8222424

Provide mechanism to query preview feature status for annotation processors

    XMLWordPrintable

Details

    • CSR
    • Status: Closed
    • P4
    • Resolution: Approved
    • 13
    • core-libs
    • None
    • minimal
    • New default method added to an interface.
    • Java API
    • SE

    Description

      Summary

      Provide a method on ProcessingEnvironment to allow the whether or not preview features are enabled to be determined.

      Problem

      When generating code, a sophisticated annotation processor could benefit from knowing whether or not preview language feature are available.

      Solution

      Provide a predicated on ProcessingEnvironment to return whether or not preview features are enabled.

      Specification

      +    /**
      +     * Returns {@code true} if <em>preview features</em> are enabled
      +     * and {@code false} otherwise.
      +     * @return whether or not preview features are enabled
      +     *
      +     * @implSpec The default implementation of this method returns
      +     * {@code false}.
      +     *
      +     * @since 13
      +     */
      +    default boolean isPreviewEnabled() {
      +        return false;
      +    }

      Attachments

        Issue Links

          Activity

            People

              darcy Joe Darcy
              darcy Joe Darcy
              Jonathan Gibbons
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: