This patch converts AnnotationInvoncationHandler to use parametrized types for Class, Map, and Iterator which kills few compilation warnings during build.
Signed-off-by: Pekka Enberg <penb...@kernel.org> --- ChangeLog | 10 ++++++ .../annotation/AnnotationInvocationHandler.java | 31 +++++++++++-------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f57a9e..cf728f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-10-11 Pekka Enberg <penb...@kernel.org> + + * sun/reflect/annotation/AnnotationInvocationHandler.java: + (AnnotationInvocationHandler): Parametrize raw types. + (create): Parametrize raw types. + (equals): Parametrize raw types. + (hashCode): Parametrize raw types. + (toString): Parametrize raw types. + (getBoxedReturnType): Parametrize raw types. + 2011-09-09 Andrew John Hughes <ahug...@redhat.com> PR classpath/45526: Produce header files for diff --git a/sun/reflect/annotation/AnnotationInvocationHandler.java b/sun/reflect/annotation/AnnotationInvocationHandler.java index 909e7ae..7d585a9 100644 --- a/sun/reflect/annotation/AnnotationInvocationHandler.java +++ b/sun/reflect/annotation/AnnotationInvocationHandler.java @@ -62,21 +62,23 @@ public final class AnnotationInvocationHandler implements InvocationHandler, Serializable { private static final long serialVersionUID = 6182022883658399397L; - private final Class type; - private final Map memberValues; + private final Class<? extends Annotation> type; + private final Map<String, Object> memberValues; /** * Construct a new invocation handler for an annotation proxy. * Note that the VM is responsible for filling the memberValues map * with the default values of all the annotation members. */ - public AnnotationInvocationHandler(Class type, Map memberValues) + public AnnotationInvocationHandler(Class<? extends Annotation> type, + Map<String, Object> memberValues) { this.type = type; this.memberValues = memberValues; } - public static Annotation create(Class type, Map memberValues) + public static Annotation create(Class<? extends Annotation> type, + Map<String, Object> memberValues) { for (Method m : type.getDeclaredMethods()) { @@ -106,7 +108,8 @@ public final class AnnotationInvocationHandler * (can) use different representations of annotations that reuse this * method. */ - public static boolean equals(Class type, Map memberValues, Object other) + public static boolean equals(Class<? extends Annotation> type, + Map<String, Object> memberValues, Object other) { if (type.isInstance(other)) { @@ -217,13 +220,14 @@ public final class AnnotationInvocationHandler * (can) use different representations of annotations that reuse this * method. */ - public static int hashCode(Class type, Map memberValues) + public static int hashCode(Class<? extends Annotation> type, + Map<String, Object> memberValues) { int h = 0; - Iterator iter = memberValues.keySet().iterator(); + Iterator<String> iter = memberValues.keySet().iterator(); while (iter.hasNext()) { - Object key = iter.next(); + String key = iter.next(); Object val = memberValues.get(key); h += deepHashCode(val) ^ 127 * key.hashCode(); } @@ -267,15 +271,16 @@ public final class AnnotationInvocationHandler * (can) use different representations of annotations that reuse this * method. */ - public static String toString(Class type, Map memberValues) + public static String toString(Class<? extends Annotation> type, + Map<String, Object> memberValues) { StringBuffer sb = new StringBuffer(); sb.append('@').append(type.getName()).append('('); String sep = ""; - Iterator iter = memberValues.keySet().iterator(); + Iterator<String> iter = memberValues.keySet().iterator(); while (iter.hasNext()) { - Object key = iter.next(); + String key = iter.next(); Object val = memberValues.get(key); sb.append(sep).append(key).append('=').append(deepToString(val)); sep = ", "; @@ -284,9 +289,9 @@ public final class AnnotationInvocationHandler return sb.toString(); } - private static Class getBoxedReturnType(Method method) + private static Class<?> getBoxedReturnType(Method method) { - Class returnType = method.getReturnType(); + Class<?> returnType = method.getReturnType(); if (returnType == boolean.class) return Boolean.class; -- 1.7.6.4