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

Provide mechanism to query preview feature status for annotation processors

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 13
    • Component/s: core-libs
    • Labels:
      None
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      New default method added to an interface.
    • Interface Kind:
      Java API
    • Scope:
      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

              • Assignee:
                darcy Joe Darcy
                Reporter:
                darcy Joe Darcy
                Reviewed By:
                Jonathan Gibbons
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: