incubator-deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-85 cleanup
Date Fri, 23 Mar 2012 01:03:07 GMT
Updated Branches:
  refs/heads/master a66fa0288 -> f102e93b6


DELTASPIKE-85 cleanup


Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/f102e93b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/f102e93b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/f102e93b

Branch: refs/heads/master
Commit: f102e93b6e4dd05ef3555f999f27d7e732952932
Parents: a66fa02
Author: gpetracek <gpetracek@apache.org>
Authored: Fri Mar 23 01:51:00 2012 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Fri Mar 23 01:51:00 2012 +0100

----------------------------------------------------------------------
 .../deltaspike/core/util/ReflectionUtils.java      |   34 +++-----------
 1 files changed, 8 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/f102e93b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
index 921a631..9b743b6 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
@@ -44,14 +44,6 @@ import java.util.Set;
 @Typed()
 public abstract class ReflectionUtils
 {
-    /**
-     * An empty array of type {@link Object}, useful for converting lists to
-     * arrays.
-     */
-    public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
-
-    public static final Type[] EMPTY_TYPES = {};
-
     private ReflectionUtils()
     {
         // prevent instantiation
@@ -378,17 +370,12 @@ public abstract class ReflectionUtils
      */
     public static Type[] getActualTypeArguments(Class<?> clazz)
     {
-        //X TODO discuss direct usage: return clazz.getTypeParameters();
-
-        Type type = new HierarchyDiscovery(clazz).getResolvedType();
-        if (type instanceof ParameterizedType)
-        {
-            return ((ParameterizedType) type).getActualTypeArguments();
-        }
-        else
+        if (clazz == null)
         {
-            return EMPTY_TYPES;
+            throw new IllegalArgumentException("null isn't supported");
         }
+
+        return clazz.getTypeParameters();
     }
 
     /**
@@ -399,17 +386,12 @@ public abstract class ReflectionUtils
      */
     public static Type[] getActualTypeArguments(Type type)
     {
-        //X TODO discuss delegation to getActualTypeArguments(Class) if type is an instance
of Class
-
-        Type resolvedType = new HierarchyDiscovery(type).getResolvedType();
-        if (resolvedType instanceof ParameterizedType)
+        if (type instanceof Class)
         {
-            return ((ParameterizedType) resolvedType).getActualTypeArguments();
-        }
-        else
-        {
-            return EMPTY_TYPES;
+            return getActualTypeArguments((Class)type);
         }
+
+        throw new IllegalArgumentException((type != null ? type.getClass().getName() : "null")
+ " isn't supported");
     }
 
     /**


Mime
View raw message