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

Synthetic constructor parameters of enum are not considered for annotation indices

    XMLWordPrintable

    Details

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: