openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1081748 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util: ClassUtil.java SecurityUtil.java WebBeansUtil.java
Date Tue, 15 Mar 2011 12:38:37 GMT
Author: struberg
Date: Tue Mar 15 12:38:36 2011
New Revision: 1081748

URL: http://svn.apache.org/viewvc?rev=1081748&view=rev
Log:
OWB-545 drop SecurityUtil#doPrivilegedGetDeclaredConstructors

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=1081748&r1=1081747&r2=1081748&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
Tue Mar 15 12:38:36 2011
@@ -588,20 +588,6 @@ public final class ClassUtil
     }
 
     /**
-     * Returns class constructor array.
-     * 
-     * @param <T> class type arfument
-     * @param clazz class that is searched for constructor.
-     * @return class constructor array
-     */
-    public static <T> Constructor<T>[] getConstructors(Class<T> clazz)
-    {
-        Asserts.nullCheckForClass(clazz);
-        
-        return (Constructor<T>[])SecurityUtil.doPrivilegedGetDeclaredConstructors(clazz);
-    }
-
-    /**
      * See specification 5.2.3.
      * @param beanType bean type
      * @param requiredType required type

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java?rev=1081748&r1=1081747&r2=1081748&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java
Tue Mar 15 12:38:36 2011
@@ -49,15 +49,6 @@ public class SecurityUtil
     
     private static final PrivilegedActionGetSystemProperties SYSTEM_PROPERTY_ACTION = new
PrivilegedActionGetSystemProperties();
 
-    @SuppressWarnings("unchecked")
-    public static <T> Constructor<T>[] doPrivilegedGetDeclaredConstructors(Class<T>
clazz)
-    {
-        Object obj = AccessController.doPrivileged(
-                new PrivilegedActionForClass(clazz, null, METHOD_CLASS_GETDECLAREDCONSTRUCTORS));
-        return (Constructor<T>[])obj;
-    }
-
-
     public static <T> Method[] doPrivilegedGetDeclaredMethods(Class<T> clazz)
     {
         Object obj = AccessController.doPrivileged(

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1081748&r1=1081747&r2=1081748&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Tue Mar 15 12:38:36 2011
@@ -428,21 +428,21 @@ public final class WebBeansUtil
     public <T> Constructor<T> defineConstructor(Class<T> clazz) throws
WebBeansConfigurationException
     {
         Asserts.nullCheckForClass(clazz);
-        Constructor<T>[] constructors = ClassUtil.getConstructors(clazz);
+        Constructor<?>[] constructors = webBeansContext.getSecurityService().doPrivilegedGetDeclaredConstructors(clazz);
 
         return defineConstructor(constructors, clazz);
 
     }
 
 
-    public <T> Constructor<T> defineConstructor(Constructor<T>[] constructors,
Class<T> clazz)
+    public <T> Constructor<T> defineConstructor(Constructor<?>[] constructors,
Class<T> clazz)
     {
         Constructor<T> result = null;
 
         boolean inAnnotation = false;
 
         /* Check for @Initializer */
-        for (Constructor<T> constructor : constructors)
+        for (Constructor<?> constructor : constructors)
         {
             if (constructor.getAnnotation(Inject.class) != null)
             {
@@ -452,7 +452,7 @@ public final class WebBeansUtil
                                                              + "Initializer annotation in
class " + clazz.getName());
                 }
                 inAnnotation = true;
-                result = constructor;
+                result = (Constructor<T>) constructor;
             }
         }
 
@@ -506,7 +506,7 @@ public final class WebBeansUtil
             return true;
         }
 
-        Constructor<?>[] constructors = ClassUtil.getConstructors(clazz);
+        Constructor<?>[] constructors = webBeansContext.getSecurityService().doPrivilegedGetDeclaredConstructors(clazz);
 
         for (Constructor<?> constructor : constructors)
         {



Mime
View raw message