Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 1d802c274 -> 807605c33


handle arrays of generics


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

Branch: refs/heads/3.0.x-fixes
Commit: 51223721d3b3e0b980b804971f510ad7c0d14186
Parents: 1d802c2
Author: Chris Dolphy <[email protected]>
Authored: Thu Feb 25 22:33:32 2016 -0600
Committer: Alessio Soldano <[email protected]>
Committed: Wed Mar 2 17:26:46 2016 +0100

----------------------------------------------------------------------
 .../apache/cxf/jaxb/JAXBContextInitializer.java    | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/51223721/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
----------------------------------------------------------------------
diff --git 
a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
 
b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
index 902d0a8..62a14a6 100644
--- 
a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
+++ 
b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
@@ -251,6 +251,21 @@ class JAXBContextInitializer extends ServiceModelVisitor {
             Type componentType = gt.getGenericComponentType();
             if (componentType instanceof Class) {
                 ct = (Class<?>)componentType;
+            } else if (componentType instanceof ParameterizedType) {
+                final ParameterizedType parameterizedType = 
(ParameterizedType)componentType;
+                final Type rawType = parameterizedType.getRawType();
+                if (rawType instanceof Class) {
+                    ct = (Class<?>)rawType;
+                } else {
+                    throw new IllegalArgumentException("Unable to determine 
type for " + rawType);
+                }
+                if (!parameterizedType.getRawType().equals(Enum.class)) {
+                    for (Type t2 : parameterizedType.getActualTypeArguments()) 
{
+                        if (shouldTypeBeAdded(t2, parameterizedType)) {
+                            addType(t2);
+                        }
+                    }
+                }
             } else {
                 TypeVariable<?> tv = (TypeVariable<?>)componentType;
                 Type[] bounds = tv.getBounds();
@@ -592,4 +607,4 @@ class JAXBContextInitializer extends ServiceModelVisitor {
     }
     
     
-}
\ No newline at end of file
+}

Reply via email to