--- old/src/share/classes/java/lang/Class.java 2009-10-06 13:31:24.000000000 -0700 +++ new/src/share/classes/java/lang/Class.java 2009-10-06 13:31:24.000000000 -0700 @@ -265,7 +265,7 @@ } /** Called after security checks have been made. */ - private static native Class forName0(String name, boolean initialize, + private static native Class forName0(String name, boolean initialize, ClassLoader loader) throws ClassNotFoundException; @@ -339,7 +339,7 @@ ); } try { - Class[] empty = {}; + Class[] empty = {}; final Constructor c = getConstructor0(empty, Member.DECLARED); // Disable accessibility checks on the constructor // since we have to do the security check here anyway @@ -361,7 +361,7 @@ // Security check (same as in java.lang.reflect.Constructor) int modifiers = tmpConstructor.getModifiers(); if (!Reflection.quickCheckMemberAccess(this, modifiers)) { - Class caller = Reflection.getCallerClass(3); + Class caller = Reflection.getCallerClass(3); if (newInstanceCallerCache != caller) { Reflection.ensureMemberAccess(caller, this, null, modifiers); newInstanceCallerCache = caller; @@ -377,7 +377,7 @@ } } private volatile transient Constructor cachedConstructor; - private volatile transient Class newInstanceCallerCache; + private volatile transient Class newInstanceCallerCache; /** @@ -638,7 +638,7 @@ if (getGenericSignature() != null) return (TypeVariable>[])getGenericInfo().getTypeParameters(); else - return (TypeVariable>[])new TypeVariable[0]; + return (TypeVariable>[])new TypeVariable[0]; } @@ -901,7 +901,7 @@ MethodRepository typeInfo = MethodRepository.make(enclosingInfo.getDescriptor(), getFactory()); - Class returnType = toClass(typeInfo.getReturnType()); + Class returnType = toClass(typeInfo.getReturnType()); Type [] parameterTypes = typeInfo.getParameterTypes(); Class[] parameterClasses = new Class[parameterTypes.length]; @@ -996,12 +996,12 @@ } - private static Class toClass(Type o) { + private static Class toClass(Type o) { if (o instanceof GenericArrayType) return Array.newInstance(toClass(((GenericArrayType)o).getGenericComponentType()), 0) .getClass(); - return (Class)o; + return (Class)o; } /** @@ -1042,7 +1042,7 @@ * Loop over all declared constructors; match number * of and type of parameters. */ - for(Constructor c: enclosingInfo.getEnclosingClass().getDeclaredConstructors()) { + for(Constructor c: enclosingInfo.getEnclosingClass().getDeclaredConstructors()) { Class[] candidateParamClasses = c.getParameterTypes(); if (candidateParamClasses.length == parameterClasses.length) { boolean matches = true; @@ -1304,12 +1304,12 @@ // has already been ok'd by the SecurityManager. return java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { + new java.security.PrivilegedAction[]>() { public Class[] run() { - List list = new ArrayList(); - Class currentClass = Class.this; + List> list = new ArrayList>(); + Class currentClass = Class.this; while (currentClass != null) { - Class[] members = currentClass.getDeclaredClasses(); + Class[] members = currentClass.getDeclaredClasses(); for (int i = 0; i < members.length; i++) { if (Modifier.isPublic(members[i].getModifiers())) { list.add(members[i]); @@ -2191,7 +2191,7 @@ return name; } if (!name.startsWith("/")) { - Class c = this; + Class c = this; while (c.isArray()) { c = c.getComponentType(); } @@ -2565,12 +2565,12 @@ // out concrete implementations inherited from superclasses at // the end. MethodArray inheritedMethods = new MethodArray(); - Class[] interfaces = getInterfaces(); + Class[] interfaces = getInterfaces(); for (int i = 0; i < interfaces.length; i++) { inheritedMethods.addAll(interfaces[i].privateGetPublicMethods()); } if (!isInterface()) { - Class c = getSuperclass(); + Class c = getSuperclass(); if (c != null) { MethodArray supers = new MethodArray(); supers.addAll(c.privateGetPublicMethods()); @@ -2632,16 +2632,16 @@ return res; } // Direct superinterfaces, recursively - Class[] interfaces = getInterfaces(); + Class[] interfaces = getInterfaces(); for (int i = 0; i < interfaces.length; i++) { - Class c = interfaces[i]; + Class c = interfaces[i]; if ((res = c.getField0(name)) != null) { return res; } } // Direct superclass, recursively if (!isInterface()) { - Class c = getSuperclass(); + Class c = getSuperclass(); if (c != null) { if ((res = c.getField0(name)) != null) { return res; @@ -2653,7 +2653,7 @@ private static Method searchMethods(Method[] methods, String name, - Class[] parameterTypes) + Class[] parameterTypes) { Method res = null; String internedName = name.intern(); @@ -2670,7 +2670,7 @@ } - private Method getMethod0(String name, Class[] parameterTypes) { + private Method getMethod0(String name, Class[] parameterTypes) { // Note: the intent is that the search algorithm this routine // uses be equivalent to the ordering imposed by // privateGetPublicMethods(). It fetches only the declared @@ -2687,7 +2687,7 @@ } // Search superclass's methods if (!isInterface()) { - Class c = getSuperclass(); + Class c = getSuperclass(); if (c != null) { if ((res = c.getMethod0(name, parameterTypes)) != null) { return res; @@ -2695,9 +2695,9 @@ } } // Search superinterfaces' methods - Class[] interfaces = getInterfaces(); + Class[] interfaces = getInterfaces(); for (int i = 0; i < interfaces.length; i++) { - Class c = interfaces[i]; + Class c = interfaces[i]; if ((res = c.getMethod0(name, parameterTypes)) != null) { return res; } @@ -2706,7 +2706,7 @@ return null; } - private Constructor getConstructor0(Class[] parameterTypes, + private Constructor getConstructor0(Class[] parameterTypes, int which) throws NoSuchMethodException { Constructor[] constructors = privateGetDeclaredConstructors((which == Member.PUBLIC)); @@ -2775,9 +2775,9 @@ private native Field[] getDeclaredFields0(boolean publicOnly); private native Method[] getDeclaredMethods0(boolean publicOnly); private native Constructor[] getDeclaredConstructors0(boolean publicOnly); - private native Class[] getDeclaredClasses0(); + private native Class[] getDeclaredClasses0(); - private static String argumentTypesToString(Class[] argTypes) { + private static String argumentTypesToString(Class[] argTypes) { StringBuilder buf = new StringBuilder(); buf.append("("); if (argTypes != null) { @@ -2785,7 +2785,7 @@ if (i > 0) { buf.append(", "); } - Class c = argTypes[i]; + Class c = argTypes[i]; buf.append((c == null) ? "null" : c.getName()); } } @@ -2858,7 +2858,7 @@ } // Retrieves the desired assertion status of this class from the VM - private static native boolean desiredAssertionStatus0(Class clazz); + private static native boolean desiredAssertionStatus0(Class clazz); /** * Returns true if and only if this class was declared as an enum in the @@ -2979,7 +2979,7 @@ getName() + " is not an enum type"); Map m = new HashMap(2 * universe.length); for (T constant : universe) - m.put(((Enum)constant).name(), constant); + m.put(((Enum)constant).name(), constant); enumConstantDirectory = m; } return enumConstantDirectory; @@ -3077,8 +3077,8 @@ } // Annotations cache - private transient Map annotations; - private transient Map declaredAnnotations; + private transient Map, Annotation> annotations; + private transient Map, Annotation> declaredAnnotations; private synchronized void initAnnotationsIfNecessary() { clearCachesOnClassRedefinition(); @@ -3090,10 +3090,10 @@ if (superClass == null) { annotations = declaredAnnotations; } else { - annotations = new HashMap(); + annotations = new HashMap, Annotation>(); superClass.initAnnotationsIfNecessary(); - for (Map.Entry e : superClass.annotations.entrySet()) { - Class annotationClass = e.getKey(); + for (Map.Entry, Annotation> e : superClass.annotations.entrySet()) { + Class annotationClass = e.getKey(); if (AnnotationType.getInstance(annotationClass).isInherited()) annotations.put(annotationClass, e.getValue()); } --- old/src/share/classes/java/lang/Package.java 2009-10-06 13:31:25.000000000 -0700 +++ new/src/share/classes/java/lang/Package.java 2009-10-06 13:31:24.000000000 -0700 @@ -320,7 +320,7 @@ * @param class the class to get the package of. * @return the package of the class. It may be null if no package * information is available from the archive or codebase. */ - static Package getPackage(Class c) { + static Package getPackage(Class c) { String name = c.getName(); int i = name.lastIndexOf('.'); if (i != -1) { --- old/src/share/classes/java/lang/reflect/AccessibleObject.java 2009-10-06 13:31:25.000000000 -0700 +++ new/src/share/classes/java/lang/reflect/AccessibleObject.java 2009-10-06 13:31:25.000000000 -0700 @@ -131,7 +131,7 @@ throws SecurityException { if (obj instanceof Constructor && flag == true) { - Constructor c = (Constructor)obj; + Constructor c = (Constructor)obj; if (c.getDeclaringClass() == Class.class) { throw new SecurityException("Can not make a java.lang.Class" + " constructor accessible"); --- old/src/share/classes/java/lang/reflect/Constructor.java 2009-10-06 13:31:26.000000000 -0700 +++ new/src/share/classes/java/lang/reflect/Constructor.java 2009-10-06 13:31:26.000000000 -0700 @@ -64,8 +64,8 @@ private Class clazz; private int slot; - private Class[] parameterTypes; - private Class[] exceptionTypes; + private Class[] parameterTypes; + private Class[] exceptionTypes; private int modifiers; // Generics and annotations support private transient String signature; @@ -80,7 +80,7 @@ // always succeed (it is not affected by the granting or revoking // of permissions); we speed up the check in the common case by // remembering the last Class for which the check succeeded. - private volatile Class securityCheckCache; + private volatile Class securityCheckCache; // Generics infrastructure // Accessor for factory @@ -113,8 +113,8 @@ * package via sun.reflect.LangReflectAccess. */ Constructor(Class declaringClass, - Class[] parameterTypes, - Class[] checkedExceptions, + Class[] parameterTypes, + Class[] checkedExceptions, int modifiers, int slot, String signature, @@ -307,11 +307,11 @@ */ public boolean equals(Object obj) { if (obj != null && obj instanceof Constructor) { - Constructor other = (Constructor)obj; + Constructor other = (Constructor)obj; if (getDeclaringClass() == other.getDeclaringClass()) { /* Avoid unnecessary cloning */ - Class[] params1 = parameterTypes; - Class[] params2 = other.parameterTypes; + Class[] params1 = parameterTypes; + Class[] params2 = other.parameterTypes; if (params1.length == params2.length) { for (int i = 0; i < params1.length; i++) { if (params1[i] != params2[i]) @@ -357,14 +357,14 @@ } sb.append(Field.getTypeName(getDeclaringClass())); sb.append("("); - Class[] params = parameterTypes; // avoid clone + Class[] params = parameterTypes; // avoid clone for (int j = 0; j < params.length; j++) { sb.append(Field.getTypeName(params[j])); if (j < (params.length - 1)) sb.append(","); } sb.append(")"); - Class[] exceptions = exceptionTypes; // avoid clone + Class[] exceptions = exceptionTypes; // avoid clone if (exceptions.length > 0) { sb.append(" throws "); for (int k = 0; k < exceptions.length; k++) { @@ -452,7 +452,7 @@ sb.append(" throws "); for (int k = 0; k < exceptions.length; k++) { sb.append((exceptions[k] instanceof Class)? - ((Class)exceptions[k]).getName(): + ((Class)exceptions[k]).getName(): exceptions[k].toString()); if (k < (exceptions.length - 1)) sb.append(","); @@ -518,7 +518,7 @@ { if (!override) { if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) { - Class caller = Reflection.getCallerClass(2); + Class caller = Reflection.getCallerClass(2); if (securityCheckCache != caller) { Reflection.ensureMemberAccess(caller, clazz, null, modifiers); securityCheckCache = caller; @@ -625,9 +625,9 @@ return AnnotationParser.toArray(declaredAnnotations()); } - private transient Map declaredAnnotations; + private transient Map, Annotation> declaredAnnotations; - private synchronized Map declaredAnnotations() { + private synchronized Map, Annotation> declaredAnnotations() { if (declaredAnnotations == null) { declaredAnnotations = AnnotationParser.parseAnnotations( annotations, sun.misc.SharedSecrets.getJavaLangAccess(). --- old/src/share/classes/java/lang/reflect/Field.java 2009-10-06 13:31:27.000000000 -0700 +++ new/src/share/classes/java/lang/reflect/Field.java 2009-10-06 13:31:27.000000000 -0700 @@ -58,12 +58,12 @@ public final class Field extends AccessibleObject implements Member { - private Class clazz; + private Class clazz; private int slot; // This is guaranteed to be interned by the VM in the 1.4 // reflection implementation private String name; - private Class type; + private Class type; private int modifiers; // Generics and annotations support private transient String signature; @@ -81,8 +81,8 @@ // More complicated security check cache needed here than for // Class.newInstance() and Constructor.newInstance() - private Class securityCheckCache; - private Class securityCheckTargetClassCache; + private Class securityCheckCache; + private Class securityCheckTargetClassCache; // Generics infrastructure @@ -112,9 +112,9 @@ * instantiation of these objects in Java code from the java.lang * package via sun.reflect.LangReflectAccess. */ - Field(Class declaringClass, + Field(Class declaringClass, String name, - Class type, + Class type, int modifiers, int slot, String signature, @@ -964,10 +964,10 @@ private void doSecurityCheck(Object obj) throws IllegalAccessException { if (!override) { if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) { - Class caller = Reflection.getCallerClass(4); - Class targetClass = ((obj == null || !Modifier.isProtected(modifiers)) - ? clazz - : obj.getClass()); + Class caller = Reflection.getCallerClass(4); + Class targetClass = ((obj == null || !Modifier.isProtected(modifiers)) + ? clazz + : obj.getClass()); synchronized (this) { if ((securityCheckCache == caller) @@ -987,10 +987,10 @@ /* * Utility routine to paper over array type names */ - static String getTypeName(Class type) { + static String getTypeName(Class type) { if (type.isArray()) { try { - Class cl = type; + Class cl = type; int dimensions = 0; while (cl.isArray()) { dimensions++; @@ -1025,9 +1025,9 @@ return AnnotationParser.toArray(declaredAnnotations()); } - private transient Map declaredAnnotations; + private transient Map, Annotation> declaredAnnotations; - private synchronized Map declaredAnnotations() { + private synchronized Map, Annotation> declaredAnnotations() { if (declaredAnnotations == null) { declaredAnnotations = AnnotationParser.parseAnnotations( annotations, sun.misc.SharedSecrets.getJavaLangAccess(). --- old/src/share/classes/java/lang/reflect/Method.java 2009-10-06 13:31:28.000000000 -0700 +++ new/src/share/classes/java/lang/reflect/Method.java 2009-10-06 13:31:28.000000000 -0700 @@ -61,14 +61,14 @@ public final class Method extends AccessibleObject implements GenericDeclaration, Member { - private Class clazz; + private Class clazz; private int slot; // This is guaranteed to be interned by the VM in the 1.4 // reflection implementation private String name; - private Class returnType; - private Class[] parameterTypes; - private Class[] exceptionTypes; + private Class returnType; + private Class[] parameterTypes; + private Class[] exceptionTypes; private int modifiers; // Generics and annotations support private transient String signature; @@ -85,8 +85,8 @@ // More complicated security check cache needed here than for // Class.newInstance() and Constructor.newInstance() - private Class securityCheckCache; - private Class securityCheckTargetClassCache; + private Class securityCheckCache; + private Class securityCheckTargetClassCache; // Generics infrastructure @@ -114,11 +114,11 @@ * instantiation of these objects in Java code from the java.lang * package via sun.reflect.LangReflectAccess. */ - Method(Class declaringClass, + Method(Class declaringClass, String name, - Class[] parameterTypes, - Class returnType, - Class[] checkedExceptions, + Class[] parameterTypes, + Class returnType, + Class[] checkedExceptions, int modifiers, int slot, String signature, @@ -355,8 +355,8 @@ if (!returnType.equals(other.getReturnType())) return false; /* Avoid unnecessary cloning */ - Class[] params1 = parameterTypes; - Class[] params2 = other.parameterTypes; + Class[] params1 = parameterTypes; + Class[] params2 = other.parameterTypes; if (params1.length == params2.length) { for (int i = 0; i < params1.length; i++) { if (params1[i] != params2[i]) @@ -410,14 +410,14 @@ sb.append(Field.getTypeName(getReturnType()) + " "); sb.append(Field.getTypeName(getDeclaringClass()) + "."); sb.append(getName() + "("); - Class[] params = parameterTypes; // avoid clone + Class[] params = parameterTypes; // avoid clone for (int j = 0; j < params.length; j++) { sb.append(Field.getTypeName(params[j])); if (j < (params.length - 1)) sb.append(","); } sb.append(")"); - Class[] exceptions = exceptionTypes; // avoid clone + Class[] exceptions = exceptionTypes; // avoid clone if (exceptions.length > 0) { sb.append(" throws "); for (int k = 0; k < exceptions.length; k++) { @@ -590,10 +590,10 @@ { if (!override) { if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) { - Class caller = Reflection.getCallerClass(1); - Class targetClass = ((obj == null || !Modifier.isProtected(modifiers)) - ? clazz - : obj.getClass()); + Class caller = Reflection.getCallerClass(1); + Class targetClass = ((obj == null || !Modifier.isProtected(modifiers)) + ? clazz + : obj.getClass()); boolean cached; synchronized (this) { @@ -702,9 +702,9 @@ return AnnotationParser.toArray(declaredAnnotations()); } - private transient Map declaredAnnotations; + private transient Map, Annotation> declaredAnnotations; - private synchronized Map declaredAnnotations() { + private synchronized Map, Annotation> declaredAnnotations() { if (declaredAnnotations == null) { declaredAnnotations = AnnotationParser.parseAnnotations( annotations, sun.misc.SharedSecrets.getJavaLangAccess(). @@ -731,7 +731,7 @@ public Object getDefaultValue() { if (annotationDefault == null) return null; - Class memberType = AnnotationType.invocationHandlerReturnType( + Class memberType = AnnotationType.invocationHandlerReturnType( getReturnType()); Object result = AnnotationParser.parseMemberValue( memberType, ByteBuffer.wrap(annotationDefault), --- old/src/share/classes/java/lang/reflect/Proxy.java 2009-10-06 13:31:28.000000000 -0700 +++ new/src/share/classes/java/lang/reflect/Proxy.java 2009-10-06 13:31:28.000000000 -0700 @@ -350,7 +350,7 @@ throw new IllegalArgumentException("interface limit exceeded"); } - Class proxyClass = null; + Class proxyClass = null; /* collect interface names to use as key for proxy class cache */ String[] interfaceNames = new String[interfaces.length]; @@ -364,7 +364,7 @@ * interface to the same Class object. */ String interfaceName = interfaces[i].getName(); - Class interfaceClass = null; + Class interfaceClass = null; try { interfaceClass = Class.forName(interfaceName, false, loader); } catch (ClassNotFoundException e) { --- old/src/share/classes/java/lang/reflect/ReflectAccess.java 2009-10-06 13:31:29.000000000 -0700 +++ new/src/share/classes/java/lang/reflect/ReflectAccess.java 2009-10-06 13:31:29.000000000 -0700 @@ -33,9 +33,9 @@ package to instantiate objects in this package. */ class ReflectAccess implements sun.reflect.LangReflectAccess { - public Field newField(Class declaringClass, + public Field newField(Class declaringClass, String name, - Class type, + Class type, int modifiers, int slot, String signature, @@ -50,11 +50,11 @@ annotations); } - public Method newMethod(Class declaringClass, + public Method newMethod(Class declaringClass, String name, - Class[] parameterTypes, - Class returnType, - Class[] checkedExceptions, + Class[] parameterTypes, + Class returnType, + Class[] checkedExceptions, int modifiers, int slot, String signature, @@ -76,8 +76,8 @@ } public Constructor newConstructor(Class declaringClass, - Class[] parameterTypes, - Class[] checkedExceptions, + Class[] parameterTypes, + Class[] checkedExceptions, int modifiers, int slot, String signature, @@ -102,29 +102,29 @@ m.setMethodAccessor(accessor); } - public ConstructorAccessor getConstructorAccessor(Constructor c) { + public ConstructorAccessor getConstructorAccessor(Constructor c) { return c.getConstructorAccessor(); } - public void setConstructorAccessor(Constructor c, + public void setConstructorAccessor(Constructor c, ConstructorAccessor accessor) { c.setConstructorAccessor(accessor); } - public int getConstructorSlot(Constructor c) { + public int getConstructorSlot(Constructor c) { return c.getSlot(); } - public String getConstructorSignature(Constructor c) { + public String getConstructorSignature(Constructor c) { return c.getSignature(); } - public byte[] getConstructorAnnotations(Constructor c) { + public byte[] getConstructorAnnotations(Constructor c) { return c.getRawAnnotations(); } - public byte[] getConstructorParameterAnnotations(Constructor c) { + public byte[] getConstructorParameterAnnotations(Constructor c) { return c.getRawParameterAnnotations(); } --- old/src/share/classes/sun/reflect/LangReflectAccess.java 2009-10-06 13:31:30.000000000 -0700 +++ new/src/share/classes/sun/reflect/LangReflectAccess.java 2009-10-06 13:31:30.000000000 -0700 @@ -33,9 +33,9 @@ public interface LangReflectAccess { /** Creates a new java.lang.reflect.Field. Access checks as per java.lang.reflect.AccessibleObject are not overridden. */ - public Field newField(Class declaringClass, + public Field newField(Class declaringClass, String name, - Class type, + Class type, int modifiers, int slot, String signature, @@ -43,11 +43,11 @@ /** Creates a new java.lang.reflect.Method. Access checks as per java.lang.reflect.AccessibleObject are not overridden. */ - public Method newMethod(Class declaringClass, + public Method newMethod(Class declaringClass, String name, - Class[] parameterTypes, - Class returnType, - Class[] checkedExceptions, + Class[] parameterTypes, + Class returnType, + Class[] checkedExceptions, int modifiers, int slot, String signature, @@ -58,8 +58,8 @@ /** Creates a new java.lang.reflect.Constructor. Access checks as per java.lang.reflect.AccessibleObject are not overridden. */ public Constructor newConstructor(Class declaringClass, - Class[] parameterTypes, - Class[] checkedExceptions, + Class[] parameterTypes, + Class[] checkedExceptions, int modifiers, int slot, String signature, @@ -74,24 +74,24 @@ /** Gets the ConstructorAccessor object for a java.lang.reflect.Constructor */ - public ConstructorAccessor getConstructorAccessor(Constructor c); + public ConstructorAccessor getConstructorAccessor(Constructor c); /** Sets the ConstructorAccessor object for a java.lang.reflect.Constructor */ - public void setConstructorAccessor(Constructor c, + public void setConstructorAccessor(Constructor c, ConstructorAccessor accessor); /** Gets the "slot" field from a Constructor (used for serialization) */ - public int getConstructorSlot(Constructor c); + public int getConstructorSlot(Constructor c); /** Gets the "signature" field from a Constructor (used for serialization) */ - public String getConstructorSignature(Constructor c); + public String getConstructorSignature(Constructor c); /** Gets the "annotations" field from a Constructor (used for serialization) */ - public byte[] getConstructorAnnotations(Constructor c); + public byte[] getConstructorAnnotations(Constructor c); /** Gets the "parameterAnnotations" field from a Constructor (used for serialization) */ - public byte[] getConstructorParameterAnnotations(Constructor c); + public byte[] getConstructorParameterAnnotations(Constructor c); // // Copying routines, needed to quickly fabricate new Field, --- old/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java 2009-10-06 13:31:30.000000000 -0700 +++ new/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java 2009-10-06 13:31:30.000000000 -0700 @@ -40,17 +40,17 @@ * @since 1.5 */ class AnnotationInvocationHandler implements InvocationHandler, Serializable { - private final Class type; + private final Class type; private final Map memberValues; - AnnotationInvocationHandler(Class type, Map memberValues) { + AnnotationInvocationHandler(Class type, Map memberValues) { this.type = type; this.memberValues = memberValues; } public Object invoke(Object proxy, Method method, Object[] args) { String member = method.getName(); - Class[] paramTypes = method.getParameterTypes(); + Class[] paramTypes = method.getParameterTypes(); // Handle Object and Annotation methods if (member.equals("equals") && paramTypes.length == 1 && @@ -84,7 +84,7 @@ * if Cloneable had a public clone method. */ private Object cloneArray(Object array) { - Class type = array.getClass(); + Class type = array.getClass(); if (type == byte[].class) { byte[] byteArray = (byte[])array; @@ -151,7 +151,7 @@ * Translates a member value (in "dynamic proxy return form") into a string */ private static String memberValueToString(Object value) { - Class type = value.getClass(); + Class type = value.getClass(); if (!type.isArray()) // primitive, string, class, enum const, // or annotation return value.toString(); @@ -229,7 +229,7 @@ * two members are identical object references. */ private static boolean memberValueEquals(Object v1, Object v2) { - Class type = v1.getClass(); + Class type = v1.getClass(); // Check for primitive, string, class, enum const, annotation, // or ExceptionProxy @@ -301,7 +301,7 @@ * Computes hashCode of a member value (in "dynamic proxy return form") */ private static int memberValueHashCode(Object value) { - Class type = value.getClass(); + Class type = value.getClass(); if (!type.isArray()) // primitive, string, class, enum const, // or annotation return value.hashCode(); @@ -340,11 +340,11 @@ return; } - Map memberTypes = annotationType.memberTypes(); + Map> memberTypes = annotationType.memberTypes(); for (Map.Entry memberValue : memberValues.entrySet()) { String name = memberValue.getKey(); - Class memberType = memberTypes.get(name); + Class memberType = memberTypes.get(name); if (memberType != null) { // i.e. member still exists Object value = memberValue.getValue(); if (!(memberType.isInstance(value) || --- old/src/share/classes/sun/reflect/annotation/AnnotationParser.java 2009-10-06 13:31:31.000000000 -0700 +++ new/src/share/classes/sun/reflect/annotation/AnnotationParser.java 2009-10-06 13:31:31.000000000 -0700 @@ -59,10 +59,10 @@ * @throws AnnotationFormatError if an annotation is found to be * malformed. */ - public static Map parseAnnotations( + public static Map, Annotation> parseAnnotations( byte[] rawAnnotations, ConstantPool constPool, - Class container) { + Class container) { if (rawAnnotations == null) return Collections.emptyMap(); @@ -76,17 +76,18 @@ } } - private static Map parseAnnotations2( + private static Map, Annotation> parseAnnotations2( byte[] rawAnnotations, ConstantPool constPool, - Class container) { - Map result = new LinkedHashMap(); + Class container) { + Map, Annotation> result = + new LinkedHashMap, Annotation>(); ByteBuffer buf = ByteBuffer.wrap(rawAnnotations); int numAnnotations = buf.getShort() & 0xFFFF; for (int i = 0; i < numAnnotations; i++) { Annotation a = parseAnnotation(buf, constPool, container, false); if (a != null) { - Class klass = a.annotationType(); + Class klass = a.annotationType(); AnnotationType type = AnnotationType.getInstance(klass); if (type.retention() == RetentionPolicy.RUNTIME) if (result.put(klass, a) != null) @@ -123,7 +124,7 @@ public static Annotation[][] parseParameterAnnotations( byte[] rawAnnotations, ConstantPool constPool, - Class container) { + Class container) { try { return parseParameterAnnotations2(rawAnnotations, constPool, container); } catch(BufferUnderflowException e) { @@ -138,7 +139,7 @@ private static Annotation[][] parseParameterAnnotations2( byte[] rawAnnotations, ConstantPool constPool, - Class container) { + Class container) { ByteBuffer buf = ByteBuffer.wrap(rawAnnotations); int numParameters = buf.get() & 0xFF; Annotation[][] result = new Annotation[numParameters][]; @@ -188,15 +189,15 @@ */ private static Annotation parseAnnotation(ByteBuffer buf, ConstantPool constPool, - Class container, + Class container, boolean exceptionOnMissingAnnotationClass) { int typeIndex = buf.getShort() & 0xFFFF; - Class annotationClass = null; + Class annotationClass = null; String sig = "[unknown]"; try { try { sig = constPool.getUTF8At(typeIndex); - annotationClass = parseSig(sig, container); + annotationClass = (Class)parseSig(sig, container); } catch (IllegalArgumentException ex) { // support obsolete early jsr175 format class files annotationClass = constPool.getClassAt(typeIndex); @@ -223,7 +224,7 @@ return null; } - Map memberTypes = type.memberTypes(); + Map> memberTypes = type.memberTypes(); Map memberValues = new LinkedHashMap(type.memberDefaults()); @@ -231,7 +232,7 @@ for (int i = 0; i < numMembers; i++) { int memberNameIndex = buf.getShort() & 0xFFFF; String memberName = constPool.getUTF8At(memberNameIndex); - Class memberType = memberTypes.get(memberName); + Class memberType = memberTypes.get(memberName); if (memberType == null) { // Member is no longer present in annotation type; ignore it @@ -252,7 +253,7 @@ * member -> value map. */ public static Annotation annotationForMap( - Class type, Map memberValues) + Class type, Map memberValues) { return (Annotation) Proxy.newProxyInstance( type.getClassLoader(), new Class[] { type }, @@ -286,14 +287,15 @@ * The member must be of the indicated type. If it is not, this * method returns an AnnotationTypeMismatchExceptionProxy. */ - public static Object parseMemberValue(Class memberType, ByteBuffer buf, + public static Object parseMemberValue(Class memberType, + ByteBuffer buf, ConstantPool constPool, - Class container) { + Class container) { Object result = null; int tag = buf.get(); switch(tag) { case 'e': - return parseEnumValue(memberType, buf, constPool, container); + return parseEnumValue((Class>)memberType, buf, constPool, container); case 'c': result = parseClassValue(buf, constPool, container); break; @@ -361,7 +363,7 @@ */ private static Object parseClassValue(ByteBuffer buf, ConstantPool constPool, - Class container) { + Class container) { int classIndex = buf.getShort() & 0xFFFF; try { try { @@ -379,7 +381,7 @@ } } - private static Class parseSig(String sig, Class container) { + private static Class parseSig(String sig, Class container) { if (sig.equals("V")) return void.class; SignatureParser parser = SignatureParser.make(); TypeSignature typeSig = parser.parseTypeSig(sig); @@ -389,7 +391,7 @@ Type result = reify.getResult(); return toClass(result); } - static Class toClass(Type o) { + static Class toClass(Type o) { if (o instanceof GenericArrayType) return Array.newInstance(toClass(((GenericArrayType)o).getGenericComponentType()), 0) @@ -409,9 +411,9 @@ * u2 const_name_index; * } enum_const_value; */ - private static Object parseEnumValue(Class enumType, ByteBuffer buf, + private static Object parseEnumValue(Class enumType, ByteBuffer buf, ConstantPool constPool, - Class container) { + Class container) { int typeNameIndex = buf.getShort() & 0xFFFF; String typeName = constPool.getUTF8At(typeNameIndex); int constNameIndex = buf.getShort() & 0xFFFF; @@ -449,12 +451,12 @@ * If the array values do not match arrayType, an * AnnotationTypeMismatchExceptionProxy will be returned. */ - private static Object parseArray(Class arrayType, + private static Object parseArray(Class arrayType, ByteBuffer buf, ConstantPool constPool, - Class container) { + Class container) { int length = buf.getShort() & 0xFFFF; // Number of array components - Class componentType = arrayType.getComponentType(); + Class componentType = arrayType.getComponentType(); if (componentType == byte.class) { return parseByteArray(length, buf, constPool); @@ -477,11 +479,11 @@ } else if (componentType == Class.class) { return parseClassArray(length, buf, constPool, container); } else if (componentType.isEnum()) { - return parseEnumArray(length, componentType, buf, + return parseEnumArray(length, (Class)componentType, buf, constPool, container); } else { assert componentType.isAnnotation(); - return parseAnnotationArray(length, componentType, buf, + return parseAnnotationArray(length, (Class )componentType, buf, constPool, container); } } @@ -660,8 +662,8 @@ private static Object parseClassArray(int length, ByteBuffer buf, ConstantPool constPool, - Class container) { - Object[] result = new Class[length]; + Class container) { + Object[] result = new Class[length]; boolean typeMismatch = false; int tag = 0; @@ -677,10 +679,10 @@ return typeMismatch ? exceptionProxy(tag) : result; } - private static Object parseEnumArray(int length, Class enumType, + private static Object parseEnumArray(int length, Class enumType, ByteBuffer buf, ConstantPool constPool, - Class container) { + Class container) { Object[] result = (Object[]) Array.newInstance(enumType, length); boolean typeMismatch = false; int tag = 0; @@ -698,10 +700,10 @@ } private static Object parseAnnotationArray(int length, - Class annotationType, + Class annotationType, ByteBuffer buf, ConstantPool constPool, - Class container) { + Class container) { Object[] result = (Object[]) Array.newInstance(annotationType, length); boolean typeMismatch = false; int tag = 0; @@ -797,7 +799,7 @@ * it is needed. */ private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0]; - public static Annotation[] toArray(Map annotations) { + public static Annotation[] toArray(Map, Annotation> annotations) { return annotations.values().toArray(EMPTY_ANNOTATION_ARRAY); } } --- old/src/share/classes/sun/reflect/annotation/AnnotationType.java 2009-10-06 13:31:32.000000000 -0700 +++ new/src/share/classes/sun/reflect/annotation/AnnotationType.java 2009-10-06 13:31:31.000000000 -0700 @@ -45,7 +45,7 @@ * types. This matches the return value that must be used for a * dynamic proxy, allowing for a simple isInstance test. */ - private final Map memberTypes = new HashMap(); + private final Map> memberTypes = new HashMap>(); /** * Member name -> default value mapping. @@ -76,12 +76,12 @@ * does not represent a valid annotation type */ public static synchronized AnnotationType getInstance( - Class annotationClass) + Class annotationClass) { AnnotationType result = sun.misc.SharedSecrets.getJavaLangAccess(). getAnnotationType(annotationClass); if (result == null) - result = new AnnotationType((Class) annotationClass); + result = new AnnotationType((Class) annotationClass); return result; } @@ -93,7 +93,7 @@ * @throw IllegalArgumentException if the specified class object for * does not represent a valid annotation type */ - private AnnotationType(final Class annotationClass) { + private AnnotationType(final Class annotationClass) { if (!annotationClass.isAnnotation()) throw new IllegalArgumentException("Not an annotation type"); @@ -110,7 +110,7 @@ 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); @@ -140,7 +140,7 @@ * 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; @@ -167,7 +167,7 @@ * Returns member types for this annotation type * (member name -> type mapping). */ - public Map memberTypes() { + public Map> memberTypes() { return memberTypes; }