-
Bug
-
Resolution: Fixed
-
P4
-
None
-
b18
-
generic
-
generic
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
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
- duplicates
-
JDK-8246586 java.lang.reflect.Parameter.getAnnotation doesn't take into account synthetic parameters
-
- Closed
-
- relates to
-
JDK-8180892 Correct handling of annotations on parameters
-
- Open
-
-
JDK-8262807 Note assumptions of core reflection modeling and parameter handling
-
- Resolved
-
-
JDK-8284333 Constructor.getAnnotatedParameterTypes returns wrong value for Enums
-
- Closed
-
(1 links to)