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

Annotation argument type: interface extends Enum

XMLWordPrintable

    • generic
    • generic

      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.


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

              Created:
              Updated:
              Resolved: