src/share/classes/sun/reflect/annotation/AnnotationSupport.java

Print this page

        

@@ -173,14 +173,16 @@
 
         return result;
     }
 
 
-    /* Reflectively invoke the values-method of the given annotation
-     * (container), cast it to an array of annotations and return the 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) {
+    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,20 +199,16 @@
 
             // 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,