On Fri, 19 Mar 2021 15:20:00 GMT, Rafael Winterhalter 
<winterhal...@openjdk.org> wrote:

>> 8263763: The constructor of an enumeration prefixes with two synthetic 
>> arguments for constant name and ordinal index. For this reason, the 
>> constructor annotations need to be shifted two indices to the right, such 
>> that the annotation indices match with the parameter indices.
>
> Rafael Winterhalter has refreshed the contents of this pull request, and 
> previous commits have been removed. The incremental views will show 
> differences compared to the previous content of the PR.

Marked as reviewed by darcy (Reviewer).

src/java.base/share/classes/java/lang/reflect/Constructor.java line 612:

> 610:         Class<?> declaringClass = getDeclaringClass();
> 611:         if (
> 612:             declaringClass.isEnum()

Please format as
if (declaringClass.isEnum()) {
...

test/jdk/java/lang/annotation/EnumConstructorAnnotation.java line 39:

> 37:     public static void main(String[] args) {
> 38:         Constructor<?> c = SampleEnum.class.getDeclaredConstructors()[0];
> 39:         Annotation[] a = c.getParameters()[2].getAnnotations();

The value of c.getParameters().getAnnotations() can be checked for consistency 
against c.getParameterAnnotations(). (The type java.lang.reflect.Parameter was 
added several releases after annotations were added.)

-------------

PR: https://git.openjdk.java.net/jdk/pull/3082

Reply via email to