openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1613393 - in /openwebbeans/branches/owb_1.2.x: ./ webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Date Fri, 25 Jul 2014 11:31:11 GMT
Author: struberg
Date: Fri Jul 25 11:31:11 2014
New Revision: 1613393

URL: http://svn.apache.org/r1613393
Log:
OWB-987 improve getReference type handling

backport to owb-1.2.x

Modified:
    openwebbeans/branches/owb_1.2.x/   (props changed)
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java

Propchange: openwebbeans/branches/owb_1.2.x/
------------------------------------------------------------------------------
  Merged /openwebbeans/trunk:r1613390

Modified: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1613393&r1=1613392&r2=1613393&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Fri Jul 25 11:31:11 2014
@@ -695,7 +695,7 @@ public class BeanManagerImpl extends Abs
         }
 
         //Check type if bean type is given
-        if(beanType != null)
+        if(beanType != null && beanType != Object.class)
         {
             if(!isBeanTypeAssignableToGivenType(bean.getTypes(), beanType, bean instanceof
NewBean) &&
                !GenericsUtil.satisfiesDependency(false, beanType, bean.getBeanClass()))
@@ -703,7 +703,13 @@ public class BeanManagerImpl extends Abs
                 throw new IllegalArgumentException("Given bean type : " + beanType + " is
not applicable for the bean instance : " + bean);
             }
         }
-        else
+        else if (bean instanceof OwbBean)
+        {
+            // we cannot always use getBeanClass() as this will
+            // return the containing class for producer methods and fields
+            beanType = ((OwbBean) bean).getReturnType();
+        }
+        else 
         {
             beanType = bean.getBeanClass();
         }
@@ -723,7 +729,6 @@ public class BeanManagerImpl extends Abs
             if (instance == null)
             {
                 //Create Managed Bean Proxy
-                //X old approach: instance = webBeansContext.getProxyFactoryRemove().createNormalScopedBeanProxyRemove((AbstractOwbBean<?>)
bean, creationalContext);
                 instance = webBeansContext.getNormalScopeProxyFactory().createNormalScopeProxy(bean);
 
                 //Cached instance



Mime
View raw message