src/share/classes/sun/reflect/annotation/AnnotationSupport.java
Print this page
*** 173,186 ****
return result;
}
! /* Reflectively invoke the values-method of the given annotation
! * (container), cast it to an array of annotations and return the result.
*/
! private static <A extends Annotation> A[] getValueArray(Annotation container) {
try {
// According to JLS the container must have an array-valued value
// method. Get the AnnotationType, get the "value" method and invoke
// it to get the content.
--- 173,188 ----
return result;
}
! /*
! * Reflectively invoke the values-method of the given annotation
! * (container), cast it to an array of annotations and return the
! * result.
*/
! public static <A extends Annotation> A[] getValueArray(Annotation container) {
try {
// According to JLS the container must have an array-valued value
// method. Get the AnnotationType, get the "value" method and invoke
// it to get the content.
*** 197,216 ****
// This will erase to (Annotation[]) but we do a runtime cast on the
// return-value in the method that call this method.
@SuppressWarnings("unchecked")
A[] values = (A[]) m.invoke(container);
-
return values;
-
} catch (IllegalAccessException | // couldn't loosen security
IllegalArgumentException | // parameters doesn't match
InvocationTargetException | // the value method threw an exception
ClassCastException e) {
-
throw invalidContainerException(container, e);
-
}
}
private static AnnotationFormatError invalidContainerException(Annotation anno,
--- 199,214 ----