8263763: Synthetic constructor parameters of enum are not considered for annotation indices

Reviewed-by: darcy, jfranck
This commit is contained in:
Rafael Winterhalter 2021-04-12 21:01:08 +00:00 committed by Joe Darcy
parent 1ee80e03ad
commit 9dd96257c6
4 changed files with 73 additions and 9 deletions

View file

@ -566,17 +566,19 @@ public abstract class Executable extends AccessibleObject
Annotation[][] result = parseParameterAnnotations(parameterAnnotations);
if (result.length != numParameters &&
handleParameterNumberMismatch(result.length, numParameters)) {
Annotation[][] tmp = new Annotation[result.length+1][];
// Shift annotations down one to account for an implicit leading parameter
System.arraycopy(result, 0, tmp, 1, result.length);
tmp[0] = new Annotation[0];
handleParameterNumberMismatch(result.length, parameterTypes)) {
Annotation[][] tmp = new Annotation[numParameters][];
// Shift annotations down to account for any implicit leading parameters
System.arraycopy(result, 0, tmp, numParameters - result.length, result.length);
for (int i = 0; i < numParameters - result.length; i++) {
tmp[i] = new Annotation[0];
}
result = tmp;
}
return result;
}
abstract boolean handleParameterNumberMismatch(int resultLength, int numParameters);
abstract boolean handleParameterNumberMismatch(int resultLength, Class<?>[] parameterTypes);
/**
* {@inheritDoc}