Mercurial > hg > icedtea6
changeset 3156:3a715e42ffe4
Re-enable 7122142 backport with more minimal version.
2014-10-09 Andrew John Hughes <gnu.andrew@redhat.com>
* Makefile.am:
(ICEDTEA_PATCHES): Re-enable annotation race
condition patch.
* patches/openjdk/7122142-annotation_race_condition.patch:
Replace with more minimal backport that doesn't
alter existing types.
author | Andrew John Hughes <gnu.andrew@redhat.com> |
---|---|
date | Sun, 12 Oct 2014 20:20:59 +0100 |
parents | 09cb54af2f31 |
children | 9afbc6f09a6f |
files | ChangeLog Makefile.am patches/openjdk/7122142-annotation_race_condition.patch |
diffstat | 3 files changed, 84 insertions(+), 1025 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Oct 09 01:42:05 2014 +0100 +++ b/ChangeLog Sun Oct 12 20:20:59 2014 +0100 @@ -1,3 +1,12 @@ +2014-10-09 Andrew John Hughes <gnu.andrew@redhat.com> + + * Makefile.am: + (ICEDTEA_PATCHES): Re-enable annotation race + condition patch. + * patches/openjdk/7122142-annotation_race_condition.patch: + Replace with more minimal backport that doesn't + alter existing types. + 2014-08-29 Andrew John Hughes <gnu.andrew@member.fsf.org> * NEWS: Update OpenJDK bug URL.
--- a/Makefile.am Thu Oct 09 01:42:05 2014 +0100 +++ b/Makefile.am Sun Oct 12 20:20:59 2014 +0100 @@ -628,10 +628,8 @@ patches/openjdk/8006935-long_keys_in_hmac_prf.patch \ patches/openjdk/7106773-512_bits_rsa.patch \ patches/pr1904-icedtea_and_distro_versioning.patch \ - patches/openjdk/8017173-xml_cipher_rsa_oaep_cant_be_instantiated.patch - -# Temporarily disabled as causes crashes -# patches/openjdk/7122142-annotation_race_condition.patch + patches/openjdk/8017173-xml_cipher_rsa_oaep_cant_be_instantiated.patch \ + patches/openjdk/7122142-annotation_race_condition.patch if WITH_RHINO ICEDTEA_PATCHES += \
--- a/patches/openjdk/7122142-annotation_race_condition.patch Thu Oct 09 01:42:05 2014 +0100 +++ b/patches/openjdk/7122142-annotation_race_condition.patch Sun Oct 12 20:20:59 2014 +0100 @@ -1,6 +1,6 @@ -diff -r d1f592073a0e src/share/classes/java/lang/Class.java ---- openjdk/jdk/src/share/classes/java/lang/Class.java Fri Sep 12 22:39:32 2014 +0100 -+++ openjdk/jdk/src/share/classes/java/lang/Class.java Thu Oct 02 20:18:56 2014 +0100 +diff -r 29dda8a54371 src/share/classes/java/lang/Class.java +--- openjdk/jdk/src/share/classes/java/lang/Class.java Wed Oct 08 23:01:05 2014 +0100 ++++ openjdk/jdk/src/share/classes/java/lang/Class.java Thu Oct 09 01:43:01 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved. @@ -8,121 +8,7 @@ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it -@@ -271,7 +271,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; - -@@ -341,15 +341,15 @@ - ); - } - try { -- Class[] empty = {}; -+ Class<?>[] empty = {}; - final Constructor<T> c = getConstructor0(empty, Member.DECLARED); - // Disable accessibility checks on the constructor - // since we have to do the security check here anyway - // (the stack depth is wrong for the Constructor's - // security check to work) -- java.security.AccessController.doPrivileged -- (new java.security.PrivilegedAction() { -- public Object run() { -+ java.security.AccessController.doPrivileged( -+ new java.security.PrivilegedAction<Void>() { -+ public Void run() { - c.setAccessible(true); - return null; - } -@@ -379,7 +379,7 @@ - } - } - private volatile transient Constructor<T> cachedConstructor; -- private volatile transient Class newInstanceCallerCache; -+ private volatile transient Class<?> newInstanceCallerCache; - - - /** -@@ -637,7 +637,7 @@ - if (getGenericSignature() != null) - return (TypeVariable<Class<T>>[])getGenericInfo().getTypeParameters(); - else -- return (TypeVariable<Class<T>>[])new TypeVariable[0]; -+ return (TypeVariable<Class<T>>[])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]; - -@@ -1005,12 +1005,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; - } - - /** -@@ -1340,13 +1340,13 @@ - // out anything other than public members and (2) public member access - // has already been ok'd by the SecurityManager. - -- Class[] result = (Class[]) java.security.AccessController.doPrivileged -- (new java.security.PrivilegedAction() { -- public Object run() { -- java.util.List<Class> list = new java.util.ArrayList(); -- Class currentClass = Class.this; -+ return java.security.AccessController.doPrivileged( -+ new java.security.PrivilegedAction<Class<?>[]>() { -+ public Class[] run() { -+ List<Class<?>> list = new ArrayList<Class<?>>(); -+ 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]); -@@ -1354,12 +1354,9 @@ - } - currentClass = currentClass.getSuperclass(); - } -- Class[] empty = {}; -- return list.toArray(empty); -+ return list.toArray(new Class[0]); - } - }); -- -- return result; - } - - -@@ -2283,7 +2280,7 @@ - return name; - } - if (!name.startsWith("/")) { -- Class c = this; -+ Class<?> c = this; - while (c.isArray()) { - c = c.getComponentType(); - } -@@ -2300,44 +2297,111 @@ +@@ -2305,44 +2305,110 @@ } /** @@ -245,8 +131,7 @@ + while (true) { + ReflectionData<T> rd = new ReflectionData<T>(classRedefinedCount); + // try to CAS it... -+ if (Atomic.casReflectionData(this, oldReflectionData, -+ new SoftReference<ReflectionData<T>>(rd))) { ++ if (Atomic.casReflectionData(this, oldReflectionData, new SoftReference<ReflectionData<T>>(rd))) { + return rd; + } + // else retry @@ -260,7 +145,7 @@ } } -@@ -2365,7 +2429,7 @@ +@@ -2370,7 +2436,7 @@ } // Annotations handling @@ -269,7 +154,7 @@ native ConstantPool getConstantPool(); -@@ -2380,27 +2444,19 @@ +@@ -2385,27 +2451,19 @@ // via ReflectionFactory.copyField. private Field[] privateGetDeclaredFields(boolean publicOnly) { checkInitted(); @@ -304,12 +189,9 @@ } } return res; -@@ -2409,22 +2465,20 @@ - // Returns an array of "root" fields. These Field objects must NOT - // be propagated to the outside world, but must instead be copied +@@ -2416,12 +2474,10 @@ // via ReflectionFactory.copyField. -- private Field[] privateGetPublicFields(Set traversedInterfaces) { -+ private Field[] privateGetPublicFields(Set<Class<?>> traversedInterfaces) { + private Field[] privateGetPublicFields(Set traversedInterfaces) { checkInitted(); - Field[] res = null; - if (useCaches) { @@ -324,37 +206,7 @@ if (res != null) return res; } - // No cached value available; compute value recursively. - // Traverse in correct order for getField(). -- List fields = new ArrayList(); -+ List<Field> fields = new ArrayList<Field>(); - if (traversedInterfaces == null) { -- traversedInterfaces = new HashSet(); -+ traversedInterfaces = new HashSet<Class<?>>(); - } - - // Local fields -@@ -2432,9 +2486,7 @@ - addAll(fields, tmp); - - // Direct superinterfaces, recursively -- Class[] interfaces = getInterfaces(); -- for (int i = 0; i < interfaces.length; i++) { -- Class c = interfaces[i]; -+ for (Class<?> c : getInterfaces()) { - if (!traversedInterfaces.contains(c)) { - traversedInterfaces.add(c); - addAll(fields, c.privateGetPublicFields(traversedInterfaces)); -@@ -2443,7 +2495,7 @@ - - // Direct superclass, recursively - if (!isInterface()) { -- Class c = getSuperclass(); -+ Class<?> c = getSuperclass(); - if (c != null) { - addAll(fields, c.privateGetPublicFields(traversedInterfaces)); - } -@@ -2451,13 +2503,13 @@ +@@ -2456,8 +2512,8 @@ res = new Field[fields.size()]; fields.toArray(res); @@ -365,18 +217,9 @@ } return res; } - -- private static void addAll(Collection c, Field[] o) { -+ private static void addAll(Collection<Field> c, Field[] o) { - for (int i = 0; i < o.length; i++) { - c.add(o[i]); - } -@@ -2473,20 +2525,12 @@ - // Returns an array of "root" constructors. These Constructor - // objects must NOT be propagated to the outside world, but must +@@ -2480,18 +2536,10 @@ // instead be copied via ReflectionFactory.copyConstructor. -- private Constructor[] privateGetDeclaredConstructors(boolean publicOnly) { -+ private Constructor<T>[] privateGetDeclaredConstructors(boolean publicOnly) { + private Constructor[] privateGetDeclaredConstructors(boolean publicOnly) { checkInitted(); - Constructor[] res = null; - if (useCaches) { @@ -397,7 +240,7 @@ if (res != null) return res; } // No cached value available; request value from VM -@@ -2495,11 +2539,11 @@ +@@ -2500,11 +2548,11 @@ } else { res = getDeclaredConstructors0(publicOnly); } @@ -412,7 +255,7 @@ } } return res; -@@ -2516,27 +2560,19 @@ +@@ -2521,27 +2569,19 @@ // via ReflectionFactory.copyMethod. private Method[] privateGetDeclaredMethods(boolean publicOnly) { checkInitted(); @@ -447,7 +290,7 @@ } } return res; -@@ -2638,12 +2674,10 @@ +@@ -2643,12 +2683,10 @@ // via ReflectionFactory.copyMethod. private Method[] privateGetPublicMethods() { checkInitted(); @@ -464,22 +307,7 @@ if (res != null) return res; } -@@ -2659,12 +2693,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()); -@@ -2691,8 +2725,8 @@ +@@ -2696,8 +2734,8 @@ methods.addAllIfNotPresent(inheritedMethods); methods.compactAndTrim(); res = methods.getArray(); @@ -490,7 +318,7 @@ } return res; } -@@ -2702,7 +2736,7 @@ +@@ -2707,7 +2745,7 @@ // Helpers for fetchers of one field, method, or constructor // @@ -499,7 +327,7 @@ String internedName = name.intern(); for (int i = 0; i < fields.length; i++) { if (fields[i].getName() == internedName) { -@@ -2720,22 +2754,22 @@ +@@ -2725,7 +2763,7 @@ // of Field objects which have to be created for the common // case where the field being requested is declared in the // class which is being queried. @@ -508,43 +336,7 @@ // Search declared public fields if ((res = searchFields(privateGetDeclaredFields(true), name)) != null) { 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; -@@ -2747,7 +2781,7 @@ - - private static Method searchMethods(Method[] methods, - String name, -- Class[] parameterTypes) -+ Class<?>[] parameterTypes) - { - Method res = null; - String internedName = name.intern(); -@@ -2764,7 +2798,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 -@@ -2772,7 +2806,7 @@ +@@ -2777,7 +2815,7 @@ // number of Method objects which have to be created for the // common case where the method being requested is declared in // the class which is being queried. @@ -553,133 +345,10 @@ // Search declared public methods if ((res = searchMethods(privateGetDeclaredMethods(true), name, -@@ -2781,7 +2815,7 @@ - } - // Search superclass's methods - if (!isInterface()) { -- Class c = getSuperclass(); -+ Class<? super T> c = getSuperclass(); - if (c != null) { - if ((res = c.getMethod0(name, parameterTypes)) != null) { - return res; -@@ -2789,9 +2823,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; - } -@@ -2800,14 +2834,14 @@ - return null; - } - -- private Constructor<T> getConstructor0(Class[] parameterTypes, -+ private Constructor<T> getConstructor0(Class<?>[] parameterTypes, - int which) throws NoSuchMethodException - { -- Constructor[] constructors = privateGetDeclaredConstructors((which == Member.PUBLIC)); -- for (int i = 0; i < constructors.length; i++) { -+ Constructor<T>[] constructors = privateGetDeclaredConstructors((which == Member.PUBLIC)); -+ for (Constructor<T> constructor : constructors) { - if (arrayContentsEq(parameterTypes, -- constructors[i].getParameterTypes())) { -- return getReflectionFactory().copyConstructor(constructors[i]); -+ constructor.getParameterTypes())) { -+ return getReflectionFactory().copyConstructor(constructor); - } - } - throw new NoSuchMethodException(getName() + ".<init>" + argumentTypesToString(parameterTypes)); -@@ -2857,21 +2891,21 @@ - return out; - } - -- private static Constructor[] copyConstructors(Constructor[] arg) { -- Constructor[] out = new Constructor[arg.length]; -+ private static <U> Constructor<U>[] copyConstructors(Constructor<U>[] arg) { -+ Constructor<U>[] out = arg.clone(); - ReflectionFactory fact = getReflectionFactory(); -- for (int i = 0; i < arg.length; i++) { -- out[i] = fact.copyConstructor(arg[i]); -+ for (int i = 0; i < out.length; i++) { -+ out[i] = fact.copyConstructor(out[i]); - } - return out; - } - - private native Field[] getDeclaredFields0(boolean publicOnly); - private native Method[] getDeclaredMethods0(boolean publicOnly); -- private native Constructor[] getDeclaredConstructors0(boolean publicOnly); -- private native Class[] getDeclaredClasses0(); -+ private native Constructor<T>[] getDeclaredConstructors0(boolean publicOnly); -+ 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) { -@@ -2879,7 +2913,7 @@ - if (i > 0) { - buf.append(", "); - } -- Class c = argTypes[i]; -+ Class<?> c = argTypes[i]; - buf.append((c == null) ? "null" : c.getName()); - } - } -@@ -2952,7 +2986,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 -@@ -2973,7 +3007,7 @@ - // Fetches the factory for reflective objects - private static ReflectionFactory getReflectionFactory() { - if (reflectionFactory == null) { -- reflectionFactory = (ReflectionFactory) -+ reflectionFactory = - java.security.AccessController.doPrivileged - (new sun.reflect.ReflectionFactory.GetReflectionFactoryAction()); - } -@@ -3039,9 +3073,9 @@ - if (!isEnum()) return null; - try { - final Method values = getMethod("values"); -- java.security.AccessController.doPrivileged -- (new java.security.PrivilegedAction() { -- public Object run() { -+ java.security.AccessController.doPrivileged( -+ new java.security.PrivilegedAction<Void>() { -+ public Void run() { - values.setAccessible(true); - return null; - } -@@ -3073,7 +3107,7 @@ - getName() + " is not an enum type"); - Map<String, T> m = new HashMap<String, T>(2 * universe.length); - for (T constant : universe) -- m.put(((Enum)constant).name(), constant); -+ m.put(((Enum<?>)constant).name(), constant); - enumConstantDirectory = m; - } - return enumConstantDirectory; -@@ -3173,11 +3207,22 @@ - } - +@@ -3180,9 +3218,20 @@ // Annotations cache -- private transient Map<Class, Annotation> annotations; -- private transient Map<Class, Annotation> declaredAnnotations; -+ private transient Map<Class<? extends Annotation>, Annotation> annotations; -+ private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations; + private transient Map<Class, Annotation> annotations; + private transient Map<Class, Annotation> declaredAnnotations; + // Value of classRedefinedCount when we last cleared the cached annotations and declaredAnnotations fields + private transient int lastAnnotationsRedefinedCount = 0; + @@ -698,21 +367,7 @@ if (annotations != null) return; declaredAnnotations = AnnotationParser.parseAnnotations( -@@ -3186,10 +3231,10 @@ - if (superClass == null) { - annotations = declaredAnnotations; - } else { -- annotations = new HashMap<Class, Annotation>(); -+ annotations = new HashMap<Class<? extends Annotation>, Annotation>(); - superClass.initAnnotationsIfNecessary(); -- for (Map.Entry<Class, Annotation> e : superClass.annotations.entrySet()) { -- Class annotationClass = e.getKey(); -+ for (Map.Entry<Class<? extends Annotation>, Annotation> e : superClass.annotations.entrySet()) { -+ Class<? extends Annotation> annotationClass = e.getKey(); - if (AnnotationType.getInstance(annotationClass).isInherited()) - annotations.put(annotationClass, e.getValue()); - } -@@ -3199,10 +3244,11 @@ +@@ -3204,10 +3253,11 @@ // Annotation types cache their internal (AnnotationType) form @@ -727,9 +382,9 @@ } AnnotationType getAnnotationType() { -diff -r d1f592073a0e src/share/classes/java/lang/System.java ---- openjdk/jdk/src/share/classes/java/lang/System.java Fri Sep 12 22:39:32 2014 +0100 -+++ openjdk/jdk/src/share/classes/java/lang/System.java Thu Oct 02 20:18:56 2014 +0100 +diff -r 29dda8a54371 src/share/classes/java/lang/System.java +--- openjdk/jdk/src/share/classes/java/lang/System.java Wed Oct 08 23:01:05 2014 +0100 ++++ openjdk/jdk/src/share/classes/java/lang/System.java Thu Oct 09 01:43:01 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2007, Oracle and/or its affiliates. All rights reserved. @@ -755,206 +410,9 @@ public <E extends Enum<E>> E[] getEnumConstantsShared(Class<E> klass) { return klass.getEnumConstantsShared(); -diff -r d1f592073a0e src/share/classes/java/lang/reflect/Constructor.java ---- openjdk/jdk/src/share/classes/java/lang/reflect/Constructor.java Fri Sep 12 22:39:32 2014 +0100 -+++ openjdk/jdk/src/share/classes/java/lang/reflect/Constructor.java Thu Oct 02 20:18:56 2014 +0100 -@@ -65,8 +65,8 @@ - - private Class<T> 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; -@@ -118,8 +118,8 @@ - * package via sun.reflect.LangReflectAccess. - */ - Constructor(Class<T> declaringClass, -- Class[] parameterTypes, -- Class[] checkedExceptions, -+ Class<?>[] parameterTypes, -+ Class<?>[] checkedExceptions, - int modifiers, - int slot, - String signature, -@@ -366,14 +366,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++) { -@@ -454,7 +454,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(","); -@@ -630,9 +630,9 @@ - return declaredAnnotations().values().toArray(EMPTY_ANNOTATION_ARRAY); - } - -- private transient Map<Class, Annotation> declaredAnnotations; -+ private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations; - -- private synchronized Map<Class, Annotation> declaredAnnotations() { -+ private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() { - if (declaredAnnotations == null) { - declaredAnnotations = AnnotationParser.parseAnnotations( - annotations, sun.misc.SharedSecrets.getJavaLangAccess(). -diff -r d1f592073a0e src/share/classes/java/lang/reflect/Field.java ---- openjdk/jdk/src/share/classes/java/lang/reflect/Field.java Fri Sep 12 22:39:32 2014 +0100 -+++ openjdk/jdk/src/share/classes/java/lang/reflect/Field.java Thu Oct 02 20:18:56 2014 +0100 -@@ -59,12 +59,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; -@@ -113,9 +113,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, -@@ -1090,10 +1090,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++; -@@ -1130,9 +1130,9 @@ - return declaredAnnotations().values().toArray(EMPTY_ANNOTATION_ARRAY); - } - -- private transient Map<Class, Annotation> declaredAnnotations; -+ private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations; - -- private synchronized Map<Class, Annotation> declaredAnnotations() { -+ private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() { - if (declaredAnnotations == null) { - declaredAnnotations = AnnotationParser.parseAnnotations( - annotations, sun.misc.SharedSecrets.getJavaLangAccess(). -diff -r d1f592073a0e src/share/classes/java/lang/reflect/Method.java ---- openjdk/jdk/src/share/classes/java/lang/reflect/Method.java Fri Sep 12 22:39:32 2014 +0100 -+++ openjdk/jdk/src/share/classes/java/lang/reflect/Method.java Thu Oct 02 20:18:56 2014 +0100 -@@ -62,14 +62,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; -@@ -121,11 +121,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, -@@ -366,8 +366,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]) -@@ -428,7 +428,7 @@ - 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++) { -@@ -723,9 +723,9 @@ - return declaredAnnotations().values().toArray(EMPTY_ANNOTATION_ARRAY); - } - -- private transient Map<Class, Annotation> declaredAnnotations; -+ private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations; - -- private synchronized Map<Class, Annotation> declaredAnnotations() { -+ private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() { - if (declaredAnnotations == null) { - declaredAnnotations = AnnotationParser.parseAnnotations( - annotations, sun.misc.SharedSecrets.getJavaLangAccess(). -@@ -752,7 +752,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), -diff -r d1f592073a0e src/share/classes/sun/misc/JavaLangAccess.java ---- openjdk/jdk/src/share/classes/sun/misc/JavaLangAccess.java Fri Sep 12 22:39:32 2014 +0100 -+++ openjdk/jdk/src/share/classes/sun/misc/JavaLangAccess.java Thu Oct 02 20:18:56 2014 +0100 +diff -r 29dda8a54371 src/share/classes/sun/misc/JavaLangAccess.java +--- openjdk/jdk/src/share/classes/sun/misc/JavaLangAccess.java Wed Oct 08 23:01:05 2014 +0100 ++++ openjdk/jdk/src/share/classes/sun/misc/JavaLangAccess.java Thu Oct 09 01:43:01 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. @@ -988,182 +446,9 @@ * Returns the elements of an enum class or null if the * Class object does not represent an enum type; * the result is uncloned, cached, and shared by all callers. -diff -r d1f592073a0e src/share/classes/sun/reflect/ReflectionFactory.java ---- openjdk/jdk/src/share/classes/sun/reflect/ReflectionFactory.java Fri Sep 12 22:39:32 2014 +0100 -+++ openjdk/jdk/src/share/classes/sun/reflect/ReflectionFactory.java Thu Oct 02 20:18:56 2014 +0100 -@@ -84,8 +84,8 @@ - * <code>AccessController.doPrivileged</code>. - */ - public static final class GetReflectionFactoryAction -- implements PrivilegedAction { -- public Object run() { -+ implements PrivilegedAction<ReflectionFactory> { -+ public ReflectionFactory run() { - return getReflectionFactory(); - } - } -@@ -164,7 +164,7 @@ - public ConstructorAccessor newConstructorAccessor(Constructor c) { - checkInitted(); - -- Class declaringClass = c.getDeclaringClass(); -+ Class<?> declaringClass = c.getDeclaringClass(); - if (Modifier.isAbstract(declaringClass.getModifiers())) { - return new InstantiationExceptionConstructorAccessorImpl(null); - } -@@ -203,10 +203,10 @@ - // - - /** Creates a new java.lang.reflect.Field. Access checks as per -- java.lang.reflect.AccessibleObject are not overridden. */ -- public Field newField(Class declaringClass, -+ java.lang.reflect.AccessibleObject are not overridden. */ -+ public Field newField(Class<?> declaringClass, - String name, -- Class type, -+ Class<?> type, - int modifiers, - int slot, - String signature, -@@ -223,11 +223,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, -@@ -250,9 +250,9 @@ - - /** 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, -+ public Constructor newConstructor(Class<?> declaringClass, -+ Class<?>[] parameterTypes, -+ Class<?>[] checkedExceptions, - int modifiers, - int slot, - String signature, -@@ -310,7 +310,7 @@ - /** Makes a copy of the passed constructor. The returned - constructor is a "child" of the passed one; see the comments - in Constructor.java for details. */ -- public Constructor copyConstructor(Constructor arg) { -+ public <T> Constructor<T> copyConstructor(Constructor<T> arg) { - return langReflectAccess().copyConstructor(arg); - } - -@@ -321,7 +321,7 @@ - // - - public Constructor newConstructorForSerialization -- (Class classToInstantiate, Constructor constructorToCall) -+ (Class<?> classToInstantiate, Constructor constructorToCall) - { - // Fast path - if (constructorToCall.getDeclaringClass() == classToInstantiate) { -@@ -366,8 +366,9 @@ - run, before the system properties are set up. */ - private static void checkInitted() { - if (initted) return; -- AccessController.doPrivileged(new PrivilegedAction() { -- public Object run() { -+ AccessController.doPrivileged( -+ new PrivilegedAction<Void>() { -+ public Void run() { - // Tests to ensure the system properties table is fully - // initialized. This is needed because reflection code is - // called very early in the initialization process (before -diff -r d1f592073a0e src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java ---- openjdk/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Fri Sep 12 22:39:32 2014 +0100 -+++ openjdk/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Thu Oct 02 20:18:56 2014 +0100 -@@ -41,17 +41,17 @@ - */ - class AnnotationInvocationHandler implements InvocationHandler, Serializable { - private static final long serialVersionUID = 6182022883658399397L; -- private final Class type; -+ private final Class<? extends Annotation> type; - private final Map<String, Object> memberValues; - -- AnnotationInvocationHandler(Class type, Map<String, Object> memberValues) { -+ AnnotationInvocationHandler(Class<? extends Annotation> type, Map<String, Object> 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 && -@@ -85,7 +85,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; -@@ -152,7 +152,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(); -@@ -230,7 +230,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 -@@ -302,7 +302,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(); -@@ -341,14 +341,14 @@ - throw new java.io.InvalidObjectException("Non-annotation type in annotation serial stream"); - } - -- Map<String, Class> memberTypes = annotationType.memberTypes(); -+ Map<String, Class<?>> memberTypes = annotationType.memberTypes(); - - - // If there are annotation members without values, that - // situation is handled by the invoke method. - for (Map.Entry<String, Object> 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) || -diff -r d1f592073a0e src/share/classes/sun/reflect/annotation/AnnotationParser.java ---- openjdk/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java Fri Sep 12 22:39:32 2014 +0100 -+++ openjdk/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java Thu Oct 02 20:18:56 2014 +0100 +diff -r 29dda8a54371 src/share/classes/sun/reflect/annotation/AnnotationParser.java +--- openjdk/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java Wed Oct 08 23:01:05 2014 +0100 ++++ openjdk/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java Thu Oct 09 01:43:01 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. @@ -1171,30 +456,20 @@ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it -@@ -59,15 +59,15 @@ - * @throws AnnotationFormatError if an annotation is found to be - * malformed. - */ -- public static Map<Class, Annotation> parseAnnotations( -+ public static Map<Class<? extends Annotation>, Annotation> parseAnnotations( - byte[] rawAnnotations, - ConstantPool constPool, -- Class container) { -+ Class<?> container) { - if (rawAnnotations == null) +@@ -67,7 +67,34 @@ return Collections.emptyMap(); try { - return parseAnnotations2(rawAnnotations, constPool, container); + return parseAnnotations2(rawAnnotations, constPool, container, null); - } catch(BufferUnderflowException e) { - throw new AnnotationFormatError("Unexpected end of annotations."); - } catch(IllegalArgumentException e) { -@@ -76,24 +76,53 @@ - } - } - -- private static Map<Class, Annotation> parseAnnotations2( ++ } catch(BufferUnderflowException e) { ++ throw new AnnotationFormatError("Unexpected end of annotations."); ++ } catch(IllegalArgumentException e) { ++ // Type mismatch in constant pool ++ throw new AnnotationFormatError(e); ++ } ++ } ++ + /** + * Like {@link #parseAnnotations(byte[], sun.reflect.ConstantPool, Class)} + * with an additional parameter {@code selectAnnotationClasses} which selects the @@ -1204,11 +479,9 @@ + * + * @param selectAnnotationClasses an array of annotation types to select when parsing + */ -+ static Map<Class<? extends Annotation>, Annotation> parseSelectAnnotations( - byte[] rawAnnotations, - ConstantPool constPool, -- Class container) { -- Map<Class, Annotation> result = new LinkedHashMap<Class, Annotation>(); ++ static Map<Class, Annotation> parseSelectAnnotations( ++ byte[] rawAnnotations, ++ ConstantPool constPool, + Class<?> container, + Class<? extends Annotation> ... selectAnnotationClasses) { + if (rawAnnotations == null) @@ -1216,32 +489,27 @@ + + try { + return parseAnnotations2(rawAnnotations, constPool, container, selectAnnotationClasses); -+ } catch(BufferUnderflowException e) { -+ throw new AnnotationFormatError("Unexpected end of annotations."); -+ } catch(IllegalArgumentException e) { -+ // Type mismatch in constant pool -+ throw new AnnotationFormatError(e); -+ } -+ } -+ -+ private static Map<Class<? extends Annotation>, Annotation> parseAnnotations2( -+ byte[] rawAnnotations, -+ ConstantPool constPool, + } catch(BufferUnderflowException e) { + throw new AnnotationFormatError("Unexpected end of annotations."); + } catch(IllegalArgumentException e) { +@@ -79,21 +106,22 @@ + private static Map<Class, Annotation> parseAnnotations2( + byte[] rawAnnotations, + ConstantPool constPool, +- Class container) { + Class<?> container, + Class<? extends Annotation>[] selectAnnotationClasses) { -+ Map<Class<? extends Annotation>, Annotation> result = -+ new LinkedHashMap<Class<? extends Annotation>, Annotation>(); + Map<Class, Annotation> result = new LinkedHashMap<Class, 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); + Annotation a = parseAnnotation2(buf, constPool, container, false, selectAnnotationClasses); 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) -+ Class<? extends Annotation> klass = a.annotationType(); + if (AnnotationType.getInstance(klass).retention() == RetentionPolicy.RUNTIME && + result.put(klass, a) != null) { throw new AnnotationFormatError( @@ -1252,30 +520,9 @@ return result; } -@@ -123,7 +152,7 @@ - public static Annotation[][] parseParameterAnnotations( - byte[] rawAnnotations, - ConstantPool constPool, -- Class container) { -+ Class<?> container) { - try { - return parseParameterAnnotations2(rawAnnotations, constPool, container); - } catch(BufferUnderflowException e) { -@@ -138,7 +167,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 +217,24 @@ - */ - private static Annotation parseAnnotation(ByteBuffer buf, +@@ -190,6 +218,15 @@ ConstantPool constPool, -- Class container, -+ Class<?> container, + Class container, boolean exceptionOnMissingAnnotationClass) { + return parseAnnotation2(buf, constPool, container, exceptionOnMissingAnnotationClass, null); + } @@ -1287,18 +534,9 @@ + boolean exceptionOnMissingAnnotationClass, + Class<? extends Annotation>[] selectAnnotationClasses) { int typeIndex = buf.getShort() & 0xFFFF; -- Class annotationClass = null; -+ Class<? extends Annotation> annotationClass = null; + Class annotationClass = null; String sig = "[unknown]"; - try { - try { - sig = constPool.getUTF8At(typeIndex); -- annotationClass = parseSig(sig, container); -+ annotationClass = (Class<? extends Annotation>)parseSig(sig, container); - } catch (IllegalArgumentException ex) { - // support obsolete early jsr175 format class files - annotationClass = constPool.getClassAt(typeIndex); -@@ -215,6 +253,10 @@ +@@ -215,6 +252,10 @@ skipAnnotation(buf, false); return null; } @@ -1309,159 +547,7 @@ AnnotationType type = null; try { type = AnnotationType.getInstance(annotationClass); -@@ -223,7 +265,7 @@ - return null; - } - -- Map<String, Class> memberTypes = type.memberTypes(); -+ Map<String, Class<?>> memberTypes = type.memberTypes(); - Map<String, Object> memberValues = - new LinkedHashMap<String, Object>(type.memberDefaults()); - -@@ -231,7 +273,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 +294,7 @@ - * member -> value map. - */ - public static Annotation annotationForMap( -- Class type, Map<String, Object> memberValues) -+ Class<? extends Annotation> type, Map<String, Object> memberValues) - { - return (Annotation) Proxy.newProxyInstance( - type.getClassLoader(), new Class[] { type }, -@@ -286,14 +328,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<? extends Enum<?>>)memberType, buf, constPool, container); - case 'c': - result = parseClassValue(buf, constPool, container); - break; -@@ -361,7 +404,7 @@ - */ - private static Object parseClassValue(ByteBuffer buf, - ConstantPool constPool, -- Class container) { -+ Class<?> container) { - int classIndex = buf.getShort() & 0xFFFF; - try { - try { -@@ -379,7 +422,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 +432,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 +452,9 @@ - * u2 const_name_index; - * } enum_const_value; - */ -- private static Object parseEnumValue(Class enumType, ByteBuffer buf, -+ private static Object parseEnumValue(Class<? extends Enum> 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 +492,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 +520,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<? extends Enum>)componentType, buf, - constPool, container); - } else { - assert componentType.isAnnotation(); -- return parseAnnotationArray(length, componentType, buf, -+ return parseAnnotationArray(length, (Class <? extends Annotation>)componentType, buf, - constPool, container); - } - } -@@ -660,8 +703,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 +720,10 @@ - return typeMismatch ? exceptionProxy(tag) : result; - } - -- private static Object parseEnumArray(int length, Class enumType, -+ private static Object parseEnumArray(int length, Class<? extends Enum> enumType, - ByteBuffer buf, - ConstantPool constPool, -- Class container) { -+ Class<?> container) { - Object[] result = (Object[]) Array.newInstance(enumType, length); - boolean typeMismatch = false; - int tag = 0; -@@ -698,10 +741,10 @@ - } - - private static Object parseAnnotationArray(int length, -- Class annotationType, -+ Class<? extends Annotation> annotationType, - ByteBuffer buf, - ConstantPool constPool, -- Class container) { -+ Class<?> container) { - Object[] result = (Object[]) Array.newInstance(annotationType, length); - boolean typeMismatch = false; - int tag = 0; -@@ -788,4 +831,16 @@ +@@ -788,4 +829,16 @@ for (int i = 0; i < length; i++) skipMemberValue(buf); } @@ -1478,9 +564,9 @@ + } + } -diff -r d1f592073a0e src/share/classes/sun/reflect/annotation/AnnotationType.java ---- openjdk/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java Fri Sep 12 22:39:32 2014 +0100 -+++ openjdk/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java Thu Oct 02 20:18:56 2014 +0100 +diff -r 29dda8a54371 src/share/classes/sun/reflect/annotation/AnnotationType.java +--- openjdk/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java Wed Oct 08 23:01:05 2014 +0100 ++++ openjdk/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java Thu Oct 09 01:43:01 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. @@ -1502,7 +588,7 @@ * dynamic proxy, allowing for a simple isInstance test. */ - private final Map<String, Class> memberTypes = new HashMap<String,Class>(); -+ private final Map<String, Class<?>> memberTypes; ++ private final Map<String, Class> memberTypes; /** * Member name -> default value mapping. @@ -1538,9 +624,8 @@ * does not represent a valid annotation type */ - public static synchronized AnnotationType getInstance( -- Class annotationClass) + public static AnnotationType getInstance( -+ Class<? extends Annotation> annotationClass) + Class annotationClass) { - AnnotationType result = sun.misc.SharedSecrets.getJavaLangAccess(). - getAnnotationType(annotationClass); @@ -1552,7 +637,7 @@ + result = new AnnotationType(annotationClass); + // try to CAS the AnnotationType: null -> result + if (!jla.casAnnotationType(annotationClass, null, result)) { -+ // somebody was quicker -> read its result ++ // somebody was quicker -> read it's result + result = jla.getAnnotationType(annotationClass); + assert result != null; + } @@ -1560,32 +645,17 @@ return result; } -@@ -93,7 +101,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<? extends Annotation> annotationClass) { - if (!annotationClass.isAnnotation()) - throw new IllegalArgumentException("Not an annotation type"); - -@@ -105,32 +113,42 @@ +@@ -105,6 +113,9 @@ } }); -+ memberTypes = new HashMap<String,Class<?>>(methods.length+1, 1.0f); ++ memberTypes = new HashMap<String,Class>(methods.length+1, 1.0f); + memberDefaults = new HashMap<String, Object>(0); + members = new HashMap<String, Method>(methods.length+1, 1.0f); 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); - +@@ -117,20 +128,27 @@ Object defaultValue = method.getDefaultValue(); if (defaultValue != null) memberDefaults.put(name, defaultValue); @@ -1602,7 +672,7 @@ annotationClass != Inherited.class) { - Retention ret = annotationClass.getAnnotation(Retention.class); + JavaLangAccess jla = sun.misc.SharedSecrets.getJavaLangAccess(); -+ Map<Class<? extends Annotation>, Annotation> metaAnnotations = ++ Map<Class, Annotation> metaAnnotations = + AnnotationParser.parseSelectAnnotations( + jla.getRawClassAnnotations(annotationClass), + jla.getConstantPool(annotationClass), @@ -1620,24 +690,6 @@ } } -@@ -140,7 +158,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 +185,7 @@ - * Returns member types for this annotation type - * (member name -> type mapping). - */ -- public Map<String, Class> memberTypes() { -+ public Map<String, Class<?>> memberTypes() { - return memberTypes; - } - @@ -205,11 +223,10 @@ * For debugging. */ @@ -1655,9 +707,9 @@ + " Inherited: " + inherited; } } -diff -r d1f592073a0e test/java/lang/annotation/AnnotationType/AnnotationTypeDeadlockTest.java +diff -r 29dda8a54371 test/java/lang/annotation/AnnotationType/AnnotationTypeDeadlockTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ openjdk/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeDeadlockTest.java Thu Oct 02 20:18:56 2014 +0100 ++++ openjdk/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeDeadlockTest.java Thu Oct 09 01:43:01 2014 +0100 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. @@ -1760,9 +812,9 @@ + } + } +} -diff -r d1f592073a0e test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java +diff -r 29dda8a54371 test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ openjdk/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java Thu Oct 02 20:18:56 2014 +0100 ++++ openjdk/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java Thu Oct 09 01:43:01 2014 +0100 @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.