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

Print this page

        

*** 43,53 **** * Member name -> type mapping. Note that primitive types * are represented by the class objects for the corresponding wrapper * types. This matches the return value that must be used for a * dynamic proxy, allowing for a simple isInstance test. */ ! private final Map<String, Class> memberTypes = new HashMap<String,Class>(); /** * Member name -> default value mapping. */ private final Map<String, Object> memberDefaults = --- 43,53 ---- * Member name -> type mapping. Note that primitive types * are represented by the class objects for the corresponding wrapper * types. This matches the return value that must be used for a * dynamic proxy, allowing for a simple isInstance test. */ ! private final Map<String, Class<?>> memberTypes = new HashMap<String,Class<?>>(); /** * Member name -> default value mapping. */ private final Map<String, Object> memberDefaults =
*** 74,89 **** * * @throw IllegalArgumentException if the specified class object for * does not represent a valid annotation type */ public static synchronized AnnotationType getInstance( ! Class annotationClass) { AnnotationType result = sun.misc.SharedSecrets.getJavaLangAccess(). getAnnotationType(annotationClass); if (result == null) ! result = new AnnotationType((Class<?>) annotationClass); return result; } /** --- 74,89 ---- * * @throw IllegalArgumentException if the specified class object for * does not represent a valid annotation type */ public static synchronized AnnotationType getInstance( ! Class<? extends Annotation> annotationClass) { AnnotationType result = sun.misc.SharedSecrets.getJavaLangAccess(). getAnnotationType(annotationClass); if (result == null) ! result = new AnnotationType((Class<? extends Annotation>) annotationClass); return result; } /**
*** 91,101 **** * * @param annotationClass the class object for the annotation type * @throw IllegalArgumentException if the specified class object for * does not represent a valid annotation type */ ! private AnnotationType(final Class<?> annotationClass) { if (!annotationClass.isAnnotation()) throw new IllegalArgumentException("Not an annotation type"); Method[] methods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() { --- 91,101 ---- * * @param annotationClass the class object for the annotation type * @throw IllegalArgumentException if the specified class object for * does not represent a valid annotation type */ ! private AnnotationType(final Class<? extends Annotation> annotationClass) { if (!annotationClass.isAnnotation()) throw new IllegalArgumentException("Not an annotation type"); Method[] methods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
*** 108,118 **** for (Method method : methods) { if (method.getParameterTypes().length != 0) throw new IllegalArgumentException(method + " has params"); String name = method.getName(); ! Class type = method.getReturnType(); memberTypes.put(name, invocationHandlerReturnType(type)); members.put(name, method); Object defaultValue = method.getDefaultValue(); if (defaultValue != null) --- 108,118 ---- for (Method method : methods) { if (method.getParameterTypes().length != 0) throw new IllegalArgumentException(method + " has params"); String name = method.getName(); ! Class<?> type = method.getReturnType(); memberTypes.put(name, invocationHandlerReturnType(type)); members.put(name, method); Object defaultValue = method.getDefaultValue(); if (defaultValue != null)
*** 138,148 **** * Returns the type that must be returned by the invocation handler * of a dynamic proxy in order to have the dynamic proxy return * the specified type (which is assumed to be a legal member type * for an annotation). */ ! public static Class invocationHandlerReturnType(Class type) { // Translate primitives to wrappers if (type == byte.class) return Byte.class; if (type == char.class) return Character.class; --- 138,148 ---- * Returns the type that must be returned by the invocation handler * of a dynamic proxy in order to have the dynamic proxy return * the specified type (which is assumed to be a legal member type * for an annotation). */ ! public static Class<?> invocationHandlerReturnType(Class<?> type) { // Translate primitives to wrappers if (type == byte.class) return Byte.class; if (type == char.class) return Character.class;
*** 165,175 **** /** * Returns member types for this annotation type * (member name -> type mapping). */ ! public Map<String, Class> memberTypes() { return memberTypes; } /** * Returns members of this annotation type --- 165,175 ---- /** * Returns member types for this annotation type * (member name -> type mapping). */ ! public Map<String, Class<?>> memberTypes() { return memberTypes; } /** * Returns members of this annotation type