openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1520132 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/creation/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/decorator/ main/java/org/apache/webbeans/inject/instance/ main/jav...
Date Wed, 04 Sep 2013 20:21:20 GMT
Author: struberg
Date: Wed Sep  4 20:21:19 2013
New Revision: 1520132

URL: http://svn.apache.org/r1520132
Log:
OWB-896 different injetion point handling for Delegates

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/GenericClassTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java?rev=1520132&r1=1520131&r2=1520132&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java
Wed Sep  4 20:21:19 2013
@@ -98,7 +98,7 @@ public class MethodProducerFactory<P> im
                 {
                     if (annotatedParameter.isAnnotationPresent(Disposes.class))
                     {
-                        if (!GenericsUtil.satisfiesDependency(producerMethod.getBaseType(),
annotatedParameter.getBaseType()))
+                        if (!GenericsUtil.satisfiesDependency(false, producerMethod.getBaseType(),
annotatedParameter.getBaseType()))
                         {
                             continue;
                         }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java?rev=1520132&r1=1520131&r2=1520132&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
Wed Sep  4 20:21:19 2013
@@ -123,7 +123,7 @@ public class ProducerMethodBeansBuilder<
                     boolean found = false;
                     for (final ProducerMethodBean<?> producer : producerBeans)
                     {
-                        if (GenericsUtil.satisfiesDependency(producer.getCreatorMethod().getGenericReturnType(),
param.getBaseType()))
+                        if (GenericsUtil.satisfiesDependency(false, producer.getCreatorMethod().getGenericReturnType(),
param.getBaseType()))
                         {
                             found = true;
                             break;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1520132&r1=1520131&r2=1520132&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Wed Sep  4 20:21:19 2013
@@ -150,7 +150,7 @@ public class BeanManagerImpl extends Abs
 
     /**
      * This list contains additional interceptor bindings which got set via the
-     * {@link javax.enterprise.inject.spi.BeforeBeanDiscovery#addInterceptorBinding(Class)}
+     * {@link javax.enterprise.inject.spi.BeforeBeanDiscovery#addInterceptorBinding(Class,
java.lang.annotation.Annotation...)}
      * event function.
      */
     private List<Class<? extends Annotation>> additionalInterceptorBindings =
new ArrayList<Class<? extends Annotation>>();
@@ -565,7 +565,7 @@ public class BeanManagerImpl extends Abs
 
         webBeansContext.getAnnotationManager().checkQualifierConditions(bindings);
 
-        return injectionResolver.implResolveByType(beanType, bindings);
+        return injectionResolver.implResolveByType(false, beanType, bindings);
 
     }
 
@@ -689,7 +689,8 @@ public class BeanManagerImpl extends Abs
         //Check type if bean type is given
         if(beanType != null)
         {
-            if(!isBeanTypeAssignableToGivenType(bean.getTypes(), beanType, bean instanceof
NewBean) && !GenericsUtil.satisfiesDependency(beanType, bean.getBeanClass()))
+            if(!isBeanTypeAssignableToGivenType(bean.getTypes(), beanType, bean instanceof
NewBean) &&
+               !GenericsUtil.satisfiesDependency(false, beanType, bean.getBeanClass()))
             {
                 throw new IllegalArgumentException("Given bean type : " + beanType + " is
not applicable for the bean instance : " + bean);
             }
@@ -748,7 +749,7 @@ public class BeanManagerImpl extends Abs
         {
             Type beanApiType = itBeanApiTypes.next();
 
-            if(GenericsUtil.satisfiesDependency(givenType, beanApiType))
+            if(GenericsUtil.satisfiesDependency(false, givenType, beanApiType))
             {
                 return true;
             }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=1520132&r1=1520131&r2=1520132&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Wed Sep  4 20:21:19 2013
@@ -178,7 +178,7 @@ public class InjectionResolver
             injectionPointClass = (Class) type;
         }
 
-        Set<Bean<?>> beanSet = implResolveByType(type, injectionPointClass, qualifiers);
+        Set<Bean<?>> beanSet = implResolveByType(injectionPoint.isDelegate(),
type, injectionPointClass, qualifiers);
 
         if (beanSet.isEmpty())
         {
@@ -237,12 +237,7 @@ public class InjectionResolver
             qualifiers = AnyLiteral.ARRAY;
         }
 
-        Class injectionPointClass = null;
-        if (injectionPoint.getBean() != null)
-        {
-            injectionPointClass = injectionPoint.getBean().getBeanClass();
-        }
-        Set<Bean<?>> beanSet = implResolveByType(type, clazz, qualifiers);
+        Set<Bean<?>> beanSet = implResolveByType(injectionPoint.isDelegate(),
type, clazz, qualifiers);
 
         if (beanSet.isEmpty())
         {
@@ -271,7 +266,7 @@ public class InjectionResolver
         {
             newType = newQualifier.value();
         }
-        Set<Bean<?>> beans = implResolveByType(newType, injectionPoint.getBean().getBeanClass(),
AnyLiteral.INSTANCE);
+        Set<Bean<?>> beans = implResolveByType(injectionPoint.isDelegate(), newType,
injectionPoint.getBean().getBeanClass(), AnyLiteral.INSTANCE);
         if (beans.isEmpty())
         {
             beanSet.add(webBeansContext.getWebBeansUtil().createNewComponent(newType));
@@ -430,13 +425,14 @@ public class InjectionResolver
     /**
      * Resolution by type.
      *
+     * @param isDelegate whether the InjectionPoint is for a {@link javax.decorator.Delegate}
      * @param injectionPointType injection point api type
      * @param qualifiers         qualifiers of the injection point
      * @return set of resolved beans
      */
-    public Set<Bean<?>> implResolveByType(Type injectionPointType, Annotation...
qualifiers)
+    public Set<Bean<?>> implResolveByType(boolean isDelegate, Type injectionPointType,
Annotation... qualifiers)
     {
-        return implResolveByType(injectionPointType, null, qualifiers);
+        return implResolveByType(isDelegate, injectionPointType, null, qualifiers);
     }
 
     private String getBDABeansXMLPath(Class<?> injectionPointBeanClass)
@@ -454,11 +450,13 @@ public class InjectionResolver
     /**
      * Resolution by type.
      *
+     * @param isDelegate whether the InjectionPoint is for a {@link javax.decorator.Delegate}
      * @param injectionPointType injection point api type
      * @param qualifiers         qualifiers of the injection point
      * @return set of resolved beans
      */
-    public Set<Bean<?>> implResolveByType(Type injectionPointType, Class<?>
injectionPointClass, Annotation... qualifiers)
+    public Set<Bean<?>> implResolveByType(boolean isDelegate, Type injectionPointType,
+                                          Class<?> injectionPointClass, Annotation...
qualifiers)
     {
         ScannerService scannerService = webBeansContext.getScannerService();
         String bdaBeansXMLFilePath = null;
@@ -519,7 +517,7 @@ public class InjectionResolver
                 for (Type componentApiType : component.getTypes())
                 {
 
-                    if (GenericsUtil.satisfiesDependency(injectionPointType, componentApiType))
+                    if (GenericsUtil.satisfiesDependency(isDelegate, injectionPointType,
componentApiType))
                     {
                         resolvedComponents.add(component);
                         break;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java?rev=1520132&r1=1520131&r2=1520132&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
Wed Sep  4 20:21:19 2013
@@ -220,7 +220,7 @@ public class DecoratorsManager
         boolean ok = false;
         for (Type apiType : apiTypes)
         {
-            if (GenericsUtil.satisfiesDependency(decorator.getDelegateType(), apiType))
+            if (GenericsUtil.satisfiesDependency(true, decorator.getDelegateType(), apiType))
             {
                 ok = true;
                 break;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=1520132&r1=1520131&r2=1520132&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
Wed Sep  4 20:21:19 2013
@@ -161,7 +161,7 @@ public class InstanceImpl<T> implements 
         {
             injectionPointClass = injectionPointBean.getBeanClass();
         }
-        Set<Bean<?>> beans = resolver.implResolveByType(injectionClazz, injectionPointClass,
anns);
+        Set<Bean<?>> beans = resolver.implResolveByType(false, injectionClazz,
injectionPointClass, anns);
         return resolver.resolveAll(beans);
     }
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java?rev=1520132&r1=1520131&r2=1520132&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
Wed Sep  4 20:21:19 2013
@@ -40,11 +40,11 @@ import org.apache.webbeans.config.OwbPar
  */
 public final class GenericsUtil
 {
-    public static boolean satisfiesDependency(Type injectionPointType, Type beanType)
+    public static boolean satisfiesDependency(boolean isDelegate, Type injectionPointType,
Type beanType)
     {
         if (beanType instanceof TypeVariable || beanType instanceof WildcardType || beanType
instanceof GenericArrayType)
         {
-            return isAssignableFrom(injectionPointType, beanType);
+            return isAssignableFrom(isDelegate, injectionPointType, beanType);
         }
         else
         {
@@ -53,7 +53,7 @@ public final class GenericsUtil
             
             if  (ClassUtil.isSame(injectionPointRawType, beanRawType))
             {
-                return isAssignableFrom(injectionPointType, beanType);
+                return isAssignableFrom(isDelegate, injectionPointType, beanType);
             }
         }
 
@@ -63,27 +63,27 @@ public final class GenericsUtil
     /**
      * 5.2.3 and 5.2.4
      */
-    public static boolean isAssignableFrom(Type requiredType, Type beanType)
+    public static boolean isAssignableFrom(boolean isDelegate, Type requiredType, Type beanType)
     {
         if (requiredType instanceof Class)
         {
-            return isAssignableFrom((Class<?>)requiredType, beanType);
+            return isAssignableFrom(isDelegate, (Class<?>)requiredType, beanType);
         }
         else if (requiredType instanceof ParameterizedType)
         {
-            return isAssignableFrom((ParameterizedType)requiredType, beanType);
+            return isAssignableFrom(isDelegate, (ParameterizedType)requiredType, beanType);
         }
         else if (requiredType instanceof TypeVariable)
         {
-            return isAssignableFrom((TypeVariable<?>)requiredType, beanType);
+            return isAssignableFrom(isDelegate, (TypeVariable<?>)requiredType, beanType);
         }
         else if (requiredType instanceof GenericArrayType)
         {
-            return isAssignableFrom((GenericArrayType)requiredType, beanType);
+            return isAssignableFrom(isDelegate, (GenericArrayType)requiredType, beanType);
         }
         else if (requiredType instanceof WildcardType)
         {
-            return isAssignableFrom((WildcardType)requiredType, beanType);
+            return isAssignableFrom(isDelegate, (WildcardType)requiredType, beanType);
         }
         else
         {
@@ -91,27 +91,27 @@ public final class GenericsUtil
         }
     }
 
-    private static boolean isAssignableFrom(Class<?> injectionPointType, Type beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, Class<?> injectionPointType,
Type beanType)
     {
         if (beanType instanceof Class)
         {
-            return isAssignableFrom(injectionPointType, (Class<?>)beanType);
+            return isAssignableFrom(isDelegate, injectionPointType, (Class<?>)beanType);
         }
         else if (beanType instanceof TypeVariable)
         {
-            return isAssignableFrom(injectionPointType, (TypeVariable<?>)beanType);
+            return isAssignableFrom(isDelegate, injectionPointType, (TypeVariable<?>)beanType);
         }
         else if (beanType instanceof ParameterizedType)
         {
-            return isAssignableFrom(injectionPointType, (ParameterizedType)beanType);
+            return isAssignableFrom(isDelegate, injectionPointType, (ParameterizedType)beanType);
         }
         else if (beanType instanceof GenericArrayType)
         {
-            return isAssignableFrom(injectionPointType, (GenericArrayType)beanType);
+            return isAssignableFrom(isDelegate, injectionPointType, (GenericArrayType)beanType);
         }
         else if (beanType instanceof WildcardType)
         {
-            return isAssignableFrom((Type)injectionPointType, (WildcardType)beanType);
+            return isAssignableFrom(isDelegate, (Type)injectionPointType, (WildcardType)beanType);
         }
         else
         {
@@ -119,16 +119,16 @@ public final class GenericsUtil
         }
     }
 
-    private static boolean isAssignableFrom(Class<?> injectionPointType, Class<?>
beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, Class<?> injectionPointType,
Class<?> beanType)
     {
         return ClassUtil.isClassAssignable(injectionPointType, beanType);
     }
 
-    private static boolean isAssignableFrom(Class<?> injectionPointType, TypeVariable<?>
beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, Class<?> injectionPointType,
TypeVariable<?> beanType)
     {
         for (Type bounds: beanType.getBounds())
         {
-            if (isAssignableFrom(injectionPointType, bounds))
+            if (isAssignableFrom(isDelegate, injectionPointType, bounds))
             {
                 return true;
             }
@@ -140,7 +140,7 @@ public final class GenericsUtil
      * CDI Spec. 5.2.4: "A parameterized bean type is considered assignable to a raw required
type
      * if the raw types are identical and all type parameters of the bean type are either
unbounded type variables or java.lang.Object." 
      */
-    private static boolean isAssignableFrom(Class<?> injectionPointType, ParameterizedType
beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, Class<?> injectionPointType,
ParameterizedType beanType)
     {
         if (beanType.getRawType() != injectionPointType)
         {
@@ -168,27 +168,27 @@ public final class GenericsUtil
         return true;
     }
 
-    private static boolean isAssignableFrom(Class<?> injectionPointType, GenericArrayType
beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, Class<?> injectionPointType,
GenericArrayType beanType)
     {
         if (!injectionPointType.isArray())
         {
             return false;
         }
-        return isAssignableFrom(injectionPointType.getComponentType(), beanType.getGenericComponentType());
+        return isAssignableFrom(isDelegate, injectionPointType.getComponentType(), beanType.getGenericComponentType());
     }
     
-    private static boolean isAssignableFrom(Type injectionPointType, WildcardType beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, Type injectionPointType,
WildcardType beanType)
     {
         for (Type bounds: beanType.getLowerBounds())
         {
-            if (!isAssignableFrom(bounds, injectionPointType))
+            if (!isAssignableFrom(isDelegate, bounds, injectionPointType))
             {
                 return false;
             }
         }
         for (Type bounds: beanType.getUpperBounds())
         {
-            if (isAssignableFrom(injectionPointType, bounds))
+            if (isAssignableFrom(isDelegate, injectionPointType, bounds))
             {
                 return true;
             }
@@ -196,23 +196,23 @@ public final class GenericsUtil
         return false;
     }
 
-    private static boolean isAssignableFrom(ParameterizedType injectionPointType, Type beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, ParameterizedType injectionPointType,
Type beanType)
     {
         if (beanType instanceof Class)
         {
-            return isAssignableFrom(injectionPointType, (Class<?>)beanType);
+            return isAssignableFrom(isDelegate, injectionPointType, (Class<?>)beanType);
         }
         else if (beanType instanceof TypeVariable)
         {
-            return isAssignableFrom(injectionPointType, (TypeVariable<?>)beanType);
+            return isAssignableFrom(isDelegate, injectionPointType, (TypeVariable<?>)beanType);
         }
         else if (beanType instanceof ParameterizedType)
         {
-            return isAssignableFrom(injectionPointType, (ParameterizedType)beanType);
+            return isAssignableFrom(isDelegate, injectionPointType, (ParameterizedType)beanType);
         }
         else if (beanType instanceof WildcardType)
         {
-            return isAssignableFrom((Type)injectionPointType, (WildcardType)beanType);
+            return isAssignableFrom(isDelegate, (Type)injectionPointType, (WildcardType)beanType);
         }
         else if (beanType instanceof GenericArrayType)
         {
@@ -224,16 +224,16 @@ public final class GenericsUtil
         }
     }
 
-    private static boolean isAssignableFrom(ParameterizedType injectionPointType, Class<?>
beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, ParameterizedType injectionPointType,
Class<?> beanType)
     {
-        return isAssignableFrom(injectionPointType.getRawType(), beanType);
+        return isAssignableFrom(isDelegate, injectionPointType.getRawType(), beanType);
     }
 
-    private static boolean isAssignableFrom(ParameterizedType injectionPointType, TypeVariable<?>
beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, ParameterizedType injectionPointType,
TypeVariable<?> beanType)
     {
         for (Type bounds: beanType.getBounds())
         {
-            if (isAssignableFrom(injectionPointType, bounds))
+            if (isAssignableFrom(isDelegate, injectionPointType, bounds))
             {
                 return true;
             }
@@ -244,7 +244,7 @@ public final class GenericsUtil
     /**
      * CDI Spec. 5.2.4
      */
-    private static boolean isAssignableFrom(ParameterizedType injectionPointType, ParameterizedType
beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, ParameterizedType injectionPointType,
ParameterizedType beanType)
     {
         if (injectionPointType.getRawType() != beanType.getRawType())
         {
@@ -258,19 +258,21 @@ public final class GenericsUtil
             Type beanTypeArgument = beanTypeArguments[i];
 
             // for this special case it's actually an 'assignable to', thus we swap the params,
see CDI-389
-            if (injectionPointTypeArgument instanceof Class &&
+            // but this special rule does not apply to Delegate injection points...
+            if (!isDelegate &&
+                injectionPointTypeArgument instanceof Class &&
                 beanTypeArgument instanceof TypeVariable)
             {
                 for (Type upperBound: ((TypeVariable) beanTypeArgument).getBounds())
                 {
-                    if (!isAssignableFrom(upperBound, injectionPointTypeArgument))
+                    if (!isAssignableFrom(isDelegate, upperBound, injectionPointTypeArgument))
                     {
                         return false;
                     }
                 }
 
             }
-            else if (!isAssignableFrom(injectionPointTypeArgument, beanTypeArgument))
+            else if (!isAssignableFrom(isDelegate, injectionPointTypeArgument, beanTypeArgument))
             {
                 return false;
             }
@@ -278,11 +280,11 @@ public final class GenericsUtil
         return true;
     }
 
-    private static boolean isAssignableFrom(TypeVariable<?> injectionPointType, Type
beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, TypeVariable<?> injectionPointType,
Type beanType)
     {
         for (Type bounds: injectionPointType.getBounds())
         {
-            if (!isAssignableFrom(bounds, beanType))
+            if (!isAssignableFrom(isDelegate, bounds, beanType))
             {
                 return false;
             }
@@ -290,23 +292,23 @@ public final class GenericsUtil
         return true;
     }
 
-    private static boolean isAssignableFrom(GenericArrayType injectionPointType, Type beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, GenericArrayType injectionPointType,
Type beanType)
     {
         throw new UnsupportedOperationException("Not yet implementeds");
     }
 
-    private static boolean isAssignableFrom(WildcardType injectionPointType, Type beanType)
+    private static boolean isAssignableFrom(boolean isDelegate, WildcardType injectionPointType,
Type beanType)
     {
         for (Type bounds: injectionPointType.getLowerBounds())
         {
-            if (!isAssignableFrom(beanType, bounds))
+            if (!isAssignableFrom(isDelegate, beanType, bounds))
             {
                 return false;
             }
         }
         for (Type bounds: injectionPointType.getUpperBounds())
         {
-            if (!isAssignableFrom(bounds, beanType))
+            if (!isAssignableFrom(isDelegate, bounds, beanType))
             {
                 return false;
             }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java?rev=1520132&r1=1520131&r2=1520132&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
Wed Sep  4 20:21:19 2013
@@ -60,7 +60,7 @@ public class TypedComponentTest extends 
 
         InjectionResolver injectionResolver = WebBeansContext.getInstance().getBeanManagerImpl().getInjectionResolver();
 
-        Set<Bean<?>> beans= injectionResolver.implResolveByType(TypedComponentTest.class.getDeclaredField("s").getGenericType(),
new Default()
+        Set<Bean<?>> beans= injectionResolver.implResolveByType(false, TypedComponentTest.class.getDeclaredField("s").getGenericType(),
new Default()
         {
 
             @Override

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/GenericClassTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/GenericClassTest.java?rev=1520132&r1=1520131&r2=1520132&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/GenericClassTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/GenericClassTest.java
Wed Sep  4 20:21:19 2013
@@ -30,7 +30,6 @@ import org.apache.webbeans.test.TestCont
 import org.apache.webbeans.test.component.inject.parametrized.Dao;
 import org.apache.webbeans.test.component.inject.parametrized.UserDao;
 import org.apache.webbeans.test.component.inject.parametrized.WithTypeVariable;
-import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.GenericsUtil;
 import org.junit.Assert;
 import org.junit.Test;
@@ -53,10 +52,10 @@ public class GenericClassTest extends Te
             Field check22Bound = Dao.class.getField("check22WithBound");
             Field check4 = WithTypeVariable.class.getField("check4");
             
-            Assert.assertFalse(GenericsUtil.satisfiesDependency(raw.getGenericType(), t.getGenericType()));
-            Assert.assertTrue(GenericsUtil.satisfiesDependency(check4.getGenericType(), t.getGenericType()));
-            Assert.assertTrue(GenericsUtil.satisfiesDependency(check22.getGenericType(),
t.getGenericType()));
-            Assert.assertTrue(GenericsUtil.satisfiesDependency(check22Bound.getGenericType(),
t.getGenericType()));
+            Assert.assertFalse(GenericsUtil.satisfiesDependency(false, raw.getGenericType(),
t.getGenericType()));
+            Assert.assertTrue(GenericsUtil.satisfiesDependency(false, check4.getGenericType(),
t.getGenericType()));
+            Assert.assertTrue(GenericsUtil.satisfiesDependency(false, check22.getGenericType(),
t.getGenericType()));
+            Assert.assertTrue(GenericsUtil.satisfiesDependency(false, check22Bound.getGenericType(),
t.getGenericType()));
             
         }catch(Exception e)
         {
@@ -76,8 +75,8 @@ public class GenericClassTest extends Te
             Field f4 = UserDao.class.getField("field4");
             
 
-            Assert.assertTrue(GenericsUtil.satisfiesDependency(f3.getGenericType(), f1.getGenericType()));
-            Assert.assertTrue(GenericsUtil.satisfiesDependency(f4.getGenericType(), f1.getGenericType()));
+            Assert.assertTrue(GenericsUtil.satisfiesDependency(false, f3.getGenericType(),
f1.getGenericType()));
+            Assert.assertTrue(GenericsUtil.satisfiesDependency(false, f4.getGenericType(),
f1.getGenericType()));
             
         }catch(Exception e)
         {
@@ -97,8 +96,8 @@ public class GenericClassTest extends Te
         Type pigStableType = this.getClass().getDeclaredField("pigStable").getType().getGenericSuperclass();
         Type horseStableType = this.getClass().getDeclaredField("horseStable").getType().getGenericSuperclass();
 
-        Assert.assertTrue(GenericsUtil.satisfiesDependency(horseStableType, parameterizedHorseStableType));
-        Assert.assertTrue(GenericsUtil.satisfiesDependency(parameterizedPigStableType, pigStableType));
+        Assert.assertTrue(GenericsUtil.satisfiesDependency(false, horseStableType, parameterizedHorseStableType));
+        Assert.assertTrue(GenericsUtil.satisfiesDependency(false, parameterizedPigStableType,
pigStableType));
     }
     // fields for {@link #testStable}
     private Stable<Horse> parameterizedHorseStable;
@@ -114,8 +113,8 @@ public class GenericClassTest extends Te
         Type parameterizedHorseStableType = this.getClass().getDeclaredField("parameterizedHorseStable").getGenericType();
         Type stableProducerMethodType = this.getClass().getDeclaredMethod("stableProducer").getGenericReturnType();
 
-        Assert.assertTrue(GenericsUtil.satisfiesDependency(parameterizedPigStableType, stableProducerMethodType));
-        Assert.assertTrue(GenericsUtil.satisfiesDependency(parameterizedHorseStableType,
stableProducerMethodType));
+        Assert.assertTrue(GenericsUtil.satisfiesDependency(false, parameterizedPigStableType,
stableProducerMethodType));
+        Assert.assertTrue(GenericsUtil.satisfiesDependency(false, parameterizedHorseStableType,
stableProducerMethodType));
 
     }
     // method and field for {@link #testGenericProducerType}



Mime
View raw message