[RFC/PATCH] AnnotationInvocationHandler type parametrization
Pekka Enberg <penberg <at> kernel.org>
2013-03-09 09:36:13 GMT
Type parametrize uses of generic types in AnnotationInvocationHandler.
Signed-off-by: Pekka Enberg <penberg <at> kernel.org>
---
ChangeLog | 10 +++++++
.../annotation/AnnotationInvocationHandler.java | 28 ++++++++++----------
2 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 289a979..08f2d6e 100644
--- a/ChangeLog
+++ b/ChangeLog
<at> <at> -1,5 +1,15 <at> <at>
2013-03-09 Pekka Enberg <penberg <at> kernel.org>
+ * sun/reflect/annotation/AnnotationInvocationHandler.java:
+ (AnnotationInvocationHandler(Class, Map)): Add type parameters.
+ (create(Class, Map)): Add type parameters.
+ (equals(Class, Map)): Add type parameters.
+ (hashCode(Class, Map)): Add type parameters.
+ (toString(Class, Map)): Add type parameters.
+ (getBoxedReturnType(Method)): Add type parameters.
+
+2013-03-09 Pekka Enberg <penberg <at> kernel.org>
+
* .gitignore: Exclude autogen-generated files.
2013-03-04 Andrew John Hughes <gnu_andrew <at> member.fsf.org>
diff --git a/sun/reflect/annotation/AnnotationInvocationHandler.java b/sun/reflect/annotation/AnnotationInvocationHandler.java
index 909e7ae..7494967 100644
--- a/sun/reflect/annotation/AnnotationInvocationHandler.java
+++ b/sun/reflect/annotation/AnnotationInvocationHandler.java
<at> <at> -62,21 +62,21 <at> <at> 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())
{
<at> <at> -90,7 +90,7 <at> <at> public final class AnnotationInvocationHandler
AnnotationInvocationHandler handler
= new AnnotationInvocationHandler(type, memberValues);
return (Annotation) Proxy.newProxyInstance(type.getClassLoader(),
- new Class[] { type },
+ new Class<?>[] { type },
handler);
}
<at> <at> -106,7 +106,7 <at> <at> 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))
{
<at> <at> -217,13 +217,13 <at> <at> 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();
}
<at> <at> -267,15 +267,15 <at> <at> 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(' <at> ').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 = ", ";
<at> <at> -284,9 +284,9 <at> <at> 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.7.6