jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java
changeset 10342 ca0984bc9d32
parent 5506 202f599c92aa
child 14342 8435a30053c1
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java	Mon Aug 15 17:17:21 2011 -0700
@@ -187,6 +187,7 @@
      * TypeNotPresentException if a referenced annotation type is not
      * available at runtime
      */
+    @SuppressWarnings("unchecked")
     private static Annotation parseAnnotation(ByteBuffer buf,
                                               ConstantPool constPool,
                                               Class<?> container,
@@ -200,7 +201,7 @@
                 annotationClass = (Class<? extends Annotation>)parseSig(sig, container);
             } catch (IllegalArgumentException ex) {
                 // support obsolete early jsr175 format class files
-                annotationClass = constPool.getClassAt(typeIndex);
+                annotationClass = (Class<? extends Annotation>)constPool.getClassAt(typeIndex);
             }
         } catch (NoClassDefFoundError e) {
             if (exceptionOnMissingAnnotationClass)
@@ -256,7 +257,7 @@
         Class<? extends Annotation> type, Map<String, Object> memberValues)
     {
         return (Annotation) Proxy.newProxyInstance(
-            type.getClassLoader(), new Class[] { type },
+            type.getClassLoader(), new Class<?>[] { type },
             new AnnotationInvocationHandler(type, memberValues));
     }
 
@@ -287,6 +288,7 @@
      * The member must be of the indicated type. If it is not, this
      * method returns an AnnotationTypeMismatchExceptionProxy.
      */
+    @SuppressWarnings("unchecked")
     public static Object parseMemberValue(Class<?> memberType,
                                           ByteBuffer buf,
                                           ConstantPool constPool,
@@ -411,6 +413,7 @@
      *           u2   const_name_index;
      *       } enum_const_value;
      */
+    @SuppressWarnings({"rawtypes", "unchecked"})
     private static Object parseEnumValue(Class<? extends Enum> enumType, ByteBuffer buf,
                                          ConstantPool constPool,
                                          Class<?> container) {
@@ -433,7 +436,7 @@
             return  Enum.valueOf(enumType, constName);
         } catch(IllegalArgumentException e) {
             return new EnumConstantNotPresentExceptionProxy(
-                (Class<? extends Enum>)enumType, constName);
+                (Class<? extends Enum<?>>)enumType, constName);
         }
     }
 
@@ -451,6 +454,7 @@
      * If the array values do not match arrayType, an
      * AnnotationTypeMismatchExceptionProxy will be returned.
      */
+    @SuppressWarnings("unchecked")
     private static Object parseArray(Class<?> arrayType,
                                      ByteBuffer buf,
                                      ConstantPool constPool,
@@ -479,7 +483,7 @@
         } else if (componentType == Class.class) {
             return parseClassArray(length, buf, constPool, container);
         } else if (componentType.isEnum()) {
-            return parseEnumArray(length, (Class<? extends Enum>)componentType, buf,
+            return parseEnumArray(length, (Class<? extends Enum<?>>)componentType, buf,
                                   constPool, container);
         } else {
             assert componentType.isAnnotation();
@@ -679,7 +683,7 @@
         return typeMismatch ? exceptionProxy(tag) : result;
     }
 
-    private static Object parseEnumArray(int length, Class<? extends Enum> enumType,
+    private static Object parseEnumArray(int length, Class<? extends Enum<?>> enumType,
                                          ByteBuffer buf,
                                          ConstantPool constPool,
                                          Class<?> container) {