/hg/icedtea6: Re-enable 7122142 backport with more minimal version.

andrew at icedtea.classpath.org andrew at icedtea.classpath.org
Sun Oct 12 19:21:19 UTC 2014


changeset 3a715e42ffe4 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=3a715e42ffe4
author: Andrew John Hughes <gnu.andrew at redhat.com>
date: Sun Oct 12 20:20:59 2014 +0100

	Re-enable 7122142 backport with more minimal version.

	2014-10-09  Andrew John Hughes  <gnu.andrew at 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.


diffstat:

 ChangeLog                                               |     9 +
 Makefile.am                                             |     6 +-
 patches/openjdk/7122142-annotation_race_condition.patch |  1094 +-------------
 3 files changed, 84 insertions(+), 1025 deletions(-)

diffs (truncated from 1403 to 500 lines):

diff -r 09cb54af2f31 -r 3a715e42ffe4 ChangeLog
--- 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 at 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 at member.fsf.org>
 
 	* NEWS: Update OpenJDK bug URL.
diff -r 09cb54af2f31 -r 3a715e42ffe4 Makefile.am
--- 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 += \
diff -r 09cb54af2f31 -r 3a715e42ffe4 patches/openjdk/7122142-annotation_race_condition.patch
--- 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 @@


More information about the distro-pkg-dev mailing list