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

Annotation argument type: interface extends Enum

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE REQUEST :
      Currently only primitives, enums, Class, other annotations, Strings and arrays of these types are allowed as "arguments".

      It should be allowed to use "generic enums" as well, meaning instances of interfaces, that are used in enums.

      Hence this code should become compilable:

      public interface I
      {
          void doIt();
      }

      public enum E1 implements I
      {
          A, B, C;
          public void doIt() {};
      }

      public enum E2 implements I
      {
          D, E, F;
          public void doIt() {};
      }

      public @interface A
      {
          Enum< I > value();
      }


      JUSTIFICATION :
      It is currently not possible to use values of arbitrary (or a restricted subset of) enum as argument type. With this suggestion this is possible.


        Attachments

          Activity

            People

            Assignee:
            smarks Stuart Marks
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: