< prev index next >
src/java.base/share/classes/java/lang/reflect/Executable.java
Print this page
*** 549,564 ****
if (parameterAnnotations == null)
return new Annotation[numParameters][0];
Annotation[][] result = parseParameterAnnotations(parameterAnnotations);
! if (result.length != numParameters)
! handleParameterNumberMismatch(result.length, numParameters);
return result;
}
! abstract void handleParameterNumberMismatch(int resultLength, int numParameters);
/**
* {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
*/
--- 549,570 ----
if (parameterAnnotations == null)
return new Annotation[numParameters][0];
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];
! result = tmp;
! }
return result;
}
! abstract boolean handleParameterNumberMismatch(int resultLength, int numParameters);
/**
* {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
*/
< prev index next >