deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject [1/2] deltaspike git commit: DELTASPIKE-878 support literal instances in AnnotationUtils
Date Tue, 21 Apr 2015 21:07:32 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 750063112 -> 0752f78aa


DELTASPIKE-878 support literal instances in AnnotationUtils


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

Branch: refs/heads/master
Commit: aaa5526976b35661e807c3e9465f500cf5b19543
Parents: 7500631
Author: gpetracek <gpetracek@apache.org>
Authored: Tue Apr 21 22:49:29 2015 +0200
Committer: gpetracek <gpetracek@apache.org>
Committed: Tue Apr 21 22:49:29 2015 +0200

----------------------------------------------------------------------
 .../org/apache/deltaspike/core/util/AnnotationUtils.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/aaa55269/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/AnnotationUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/AnnotationUtils.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/AnnotationUtils.java
index d59a743..e619649 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/AnnotationUtils.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/AnnotationUtils.java
@@ -93,11 +93,14 @@ public abstract class AnnotationUtils
                 continue;
             }
 
-            final Object annotationMemberValue;
-            annotationMemberValue = ReflectionUtils.invokeMethod(annotation, member, Object.class,
true);
+            final Object annotationMemberValue = ReflectionUtils.invokeMethod(annotation,
member, Object.class, true);
 
             final int arrayValue;
-            if (annotationMemberValue.getClass().isArray())
+            if (annotationMemberValue == null /*possible with literals*/)
+            {
+                arrayValue = 0;
+            }
+            else if (annotationMemberValue.getClass().isArray())
             {
                 Class<?> annotationMemberType = annotationMemberValue.getClass().getComponentType();
                 if (annotationMemberType.isPrimitive())


Mime
View raw message