Duplicate :
|
|
Relates :
|
|
Relates :
|
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
|