You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/10/30 17:10:35 UTC

svn commit: r831366 - in /cxf/branches/2.2.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/util/ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/test/java/...

Author: dkulp
Date: Fri Oct 30 16:10:34 2009
New Revision: 831366

URL: http://svn.apache.org/viewvc?rev=831366&view=rev
Log:
Merged revisions 831364 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r831364 | dkulp | 2009-10-30 12:08:44 -0400 (Fri, 30 Oct 2009) | 1 line
  
  [CXF-2509] Testcase and fixes for wacky generics things
........

Added:
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Entity.java
      - copied unchanged from r831364, cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Entity.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GenericsService.java
      - copied unchanged from r831364, cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GenericsService.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QueryResult.java
      - copied unchanged from r831364, cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QueryResult.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QuerySummary.java
      - copied unchanged from r831364, cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QuerySummary.java
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java
    cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java?rev=831366&r1=831365&r2=831366&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java (original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java Fri Oct 30 16:10:34 2009
@@ -25,6 +25,7 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -118,6 +119,20 @@
             }
             a.append(">;");
             return a.toString();
+        } else if (type instanceof WildcardType) {
+            WildcardType wt = (WildcardType)type;
+            StringBuilder a = new StringBuilder();
+            Type[] lowBounds = wt.getLowerBounds();
+            Type[] upBounds = wt.getUpperBounds();
+            for (Type t : upBounds) {
+                a.append("+");
+                a.append(getClassCode(t));
+            }
+            for (Type t : lowBounds) {
+                a.append("-");
+                a.append(getClassCode(t));
+            }
+            return a.toString();
         }
         return null;
     }

Modified: cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?rev=831366&r1=831365&r2=831366&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java (original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java Fri Oct 30 16:10:34 2009
@@ -28,6 +28,7 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
 import java.util.Collection;
 import java.util.Set;
 
@@ -178,6 +179,7 @@
                 addClass((Class)cls);
             }
         } else if (cls instanceof ParameterizedType) {
+            addType(((ParameterizedType)cls).getRawType());
             for (Type t2 : ((ParameterizedType)cls).getActualTypeArguments()) {
                 addType(t2);
             }
@@ -203,6 +205,17 @@
             ct = Array.newInstance(ct, 0).getClass();
 
             addClass(ct);
+        } else if (cls instanceof WildcardType) {
+            for (Type t : ((WildcardType)cls).getUpperBounds()) {
+                addType(t);
+            }
+            for (Type t : ((WildcardType)cls).getLowerBounds()) {
+                addType(t);
+            }
+        } else if (cls instanceof TypeVariable) {
+            for (Type t : ((TypeVariable)cls).getBounds()) {
+                addType(t);
+            }
         }
     }
 

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java?rev=831366&r1=831365&r2=831366&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java Fri Oct 30 16:10:34 2009
@@ -38,9 +38,13 @@
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.service.ArrayService;
 import org.apache.cxf.jaxws.service.ArrayServiceImpl;
+import org.apache.cxf.jaxws.service.Entity;
 import org.apache.cxf.jaxws.service.FooServiceImpl;
+import org.apache.cxf.jaxws.service.GenericsService;
 import org.apache.cxf.jaxws.service.Hello;
 import org.apache.cxf.jaxws.service.HelloInterface;
+import org.apache.cxf.jaxws.service.QueryResult;
+import org.apache.cxf.jaxws.service.QuerySummary;
 import org.apache.cxf.jaxws.service.SayHi;
 import org.apache.cxf.jaxws.service.SayHiImpl;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
@@ -310,4 +314,23 @@
         assertValid("//xsd:schema[@targetNamespace='http://namespace5']", doc);
     }
     
+    @Test
+    public void testCXF2509() throws Exception {
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); 
+        //factory.setServiceClass(serviceInterface); 
+        factory.setServiceBean(new GenericsServiceImpl()); 
+        factory.setAddress("local://localhost/test"); 
+        Server server = factory.create();
+        Document doc = getWSDLDocument(server);
+        //XMLUtils.printDOM(doc);
+        assertValid("//xsd:schema/xsd:complexType[@name='entity']", doc);
+    }
+    
+    public static class GenericsServiceImpl implements GenericsService<Entity<String>, QuerySummary> {
+
+        public QueryResult<Entity<String>, QuerySummary> read(String query, String uc) {
+            return null;
+        }
+        
+    }
 }