Synthetic constructor parameters of enum are not considered for annotation indices

XMLWordPrintable

      javac places annotations for an enum on the wrong index. Considering:

      enum SampleEnum {
        INSTANCE("foo");
        SampleEnum(@SampleAnnotation String value) { }
      }

      @Retention(RetentionPolicy.RUNTIME)
      @interface SampleAnnotation { }

      the following code yields an exception:

      Constructor<?> c = SampleAnnotation.class.getDeclaredConstructors()[0];
      c.getParameters()[2].getAnnotations(); // throws IndexOutOfBoundsException

            Assignee:
            Rafael Winterhalter
            Reporter:
            Rafael Winterhalter
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: