< prev index next >
src/java.base/share/classes/java/lang/reflect/Constructor.java
Print this page
*** 586,608 ****
public Annotation[][] getParameterAnnotations() {
return sharedGetParameterAnnotations(parameterTypes, parameterAnnotations);
}
@Override
! void handleParameterNumberMismatch(int resultLength, int numParameters) {
Class<?> declaringClass = getDeclaringClass();
if (declaringClass.isEnum() ||
declaringClass.isAnonymousClass() ||
declaringClass.isLocalClass() )
! return ; // Can't do reliable parameter counting
else {
! if (!declaringClass.isMemberClass() || // top-level
! // Check for the enclosing instance parameter for
! // non-static member classes
! (declaringClass.isMemberClass() &&
((declaringClass.getModifiers() & Modifier.STATIC) == 0) &&
! resultLength + 1 != numParameters) ) {
throw new AnnotationFormatError(
"Parameter annotations don't match number of parameters");
}
}
}
--- 586,607 ----
public Annotation[][] getParameterAnnotations() {
return sharedGetParameterAnnotations(parameterTypes, parameterAnnotations);
}
@Override
! boolean handleParameterNumberMismatch(int resultLength, int numParameters) {
Class<?> declaringClass = getDeclaringClass();
if (declaringClass.isEnum() ||
declaringClass.isAnonymousClass() ||
declaringClass.isLocalClass() )
! return false; // Can't do reliable parameter counting
else {
! if (declaringClass.isMemberClass() &&
((declaringClass.getModifiers() & Modifier.STATIC) == 0) &&
! resultLength + 1 == numParameters) {
! return true;
! } else {
throw new AnnotationFormatError(
"Parameter annotations don't match number of parameters");
}
}
}
< prev index next >