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

Print this page

        

@@ -103,15 +103,17 @@
      */
     private AnnotationType(final Class<? extends Annotation> annotationClass) {
         if (!annotationClass.isAnnotation())
             throw new IllegalArgumentException("Not an annotation type");
 
+        // Initialize memberTypes and defaultValues
         Method[] methods =
             AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
                 public Method[] run() {
-                    // Initialize memberTypes and defaultValues
-                    return annotationClass.getDeclaredMethods();
+                    Method[] methods = annotationClass.getDeclaredMethods();
+                    AccessibleObject.setAccessible(methods, true);
+                    return methods;
                 }
             });
 
         memberTypes = new HashMap<String,Class<?>>(methods.length+1, 1.0f);
         memberDefaults = new HashMap<String, Object>(0);