src/share/classes/sun/reflect/annotation/AnnotationType.java
Print this page
@@ -43,11 +43,11 @@
* 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>();
+ private final Map<String, Class<?>> memberTypes = new HashMap<String,Class<?>>();
/**
* Member name -> default value mapping.
*/
private final Map<String, Object> memberDefaults =
@@ -74,16 +74,16 @@
*
* @throw IllegalArgumentException if the specified class object for
* does not represent a valid annotation type
*/
public static synchronized AnnotationType getInstance(
- Class annotationClass)
+ Class<? extends Annotation> annotationClass)
{
AnnotationType result = sun.misc.SharedSecrets.getJavaLangAccess().
getAnnotationType(annotationClass);
if (result == null)
- result = new AnnotationType((Class<?>) annotationClass);
+ result = new AnnotationType((Class<? extends Annotation>) annotationClass);
return result;
}
/**
@@ -91,11 +91,11 @@
*
* @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) {
+ 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,11 +108,11 @@
for (Method method : methods) {
if (method.getParameterTypes().length != 0)
throw new IllegalArgumentException(method + " has params");
String name = method.getName();
- Class type = method.getReturnType();
+ Class<?> type = method.getReturnType();
memberTypes.put(name, invocationHandlerReturnType(type));
members.put(name, method);
Object defaultValue = method.getDefaultValue();
if (defaultValue != null)
@@ -138,11 +138,11 @@
* 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) {
+ 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,11 +165,11 @@
/**
* Returns member types for this annotation type
* (member name -> type mapping).
*/
- public Map<String, Class> memberTypes() {
+ public Map<String, Class<?>> memberTypes() {
return memberTypes;
}
/**
* Returns members of this annotation type