Author: sergeyb
Date: Wed Nov 25 17:38:01 2009
New Revision: 884213

URL: http://svn.apache.org/viewvc?rev=884213&view=rev
Log:
Fixing failing JAXRS tests on 2.2.x by adding a code which was not merged from 
2.3-SNAPSHOT for some reasons

Modified:
    
cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java

Modified: 
cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=884213&r1=884212&r2=884213&view=diff
==============================================================================
--- 
cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
 (original)
+++ 
cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
 Wed Nov 25 17:38:01 2009
@@ -23,6 +23,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -218,6 +219,19 @@
                 ParameterizedType pt = (ParameterizedType)t;
                 Type[] args = pt.getActualTypeArguments();
                 for (int i = 0; i < args.length; i++) {
+                    Type arg = args[i];
+                    if (arg instanceof TypeVariable) {
+                        // give or take wildcards, this implies that the 
provider is generic, and 
+                        // is willing to take whatever we throw at it. We 
could, I suppose,
+                        // do wildcard analysis. It would be more correct to 
look at the bounds
+                        // and check that they are Object or compatible.
+                        if (m != null) {
+                            
InjectionUtils.injectContextFields(em.getProvider(), em, m);
+                            
InjectionUtils.injectContextMethods(em.getProvider(), em, m);
+                        }
+                        candidates.add(em.getProvider());
+                        return;
+                    }
                     Class<?> actualClass = InjectionUtils.getRawType(args[i]);
                     if (actualClass == null) {
                         continue;


Reply via email to