openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1429701 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java main/java/org/apache/webbeans/util/WebBeansUtil.java test/java/org/apache/webbeans/test/TestContext.java
Date Mon, 07 Jan 2013 08:22:01 GMT
Author: arne
Date: Mon Jan  7 08:22:01 2013
New Revision: 1429701

URL: http://svn.apache.org/viewvc?rev=1429701&view=rev
Log:
OWB-745: Delayed setting of full init

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java?rev=1429701&r1=1429700&r2=1429701&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
Mon Jan  7 08:22:01 2013
@@ -70,6 +70,8 @@ import org.apache.webbeans.util.WebBeans
 public class ManagedBeanCreatorImpl<T> extends AbstractInjecionTargetBeanCreator<T>
 {
     private final WebBeansContext webBeansContext;
+    
+    private boolean fullInit = true;
 
     /**
      * Creates a new creator.
@@ -92,7 +94,7 @@ public class ManagedBeanCreatorImpl<T> e
     public void checkCreateConditions()
     {
         webBeansContext.getWebBeansUtil().checkManagedBeanCondition(getAnnotated());
-        WebBeansUtil.checkGenericType(getBean());
+        WebBeansUtil.checkGenericType(getBeanType(), getScope());
         //Check Unproxiable
         checkUnproxiableApiType();
     }
@@ -111,7 +113,9 @@ public class ManagedBeanCreatorImpl<T> e
      */
     public ManagedBean<T> getBean()
     {
-        return (ManagedBean<T>)super.getBean();
+        ManagedBean<T> bean = (ManagedBean<T>)super.getBean();
+        bean.setFullInit(fullInit);
+        return bean;
     }
 
     public static <T> void lazyInitializeManagedBean(ManagedBean<T> bean)
@@ -381,7 +385,7 @@ public class ManagedBeanCreatorImpl<T> e
 
     public void addConstructorInjectionPointMetaData(Constructor<T> constructor)
     {
-        List<InjectionPoint> injectionPoints = getBean().getWebBeansContext().getInjectionPointFactory().getConstructorInjectionPointData(getBean(),
constructor);
+        List<InjectionPoint> injectionPoints = webBeansContext.getInjectionPointFactory().getConstructorInjectionPointData(getBean(),
constructor);
         for (InjectionPoint injectionPoint : injectionPoints)
         {
             addImplicitComponentForInjectionPoint(injectionPoint);
@@ -426,7 +430,7 @@ public class ManagedBeanCreatorImpl<T> e
     @Override
     protected void defineLazyInit()
     {
-        getBean().setFullInit(false);
+        fullInit = false;
     }
 
     private ManagedBean<T> defineAbstractDecorator(ProcessInjectionTarget<T>
processInjectionTargetEvent)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1429701&r1=1429700&r2=1429701&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Mon Jan  7 08:22:01 2013
@@ -231,15 +231,13 @@ public final class WebBeansUtil
      *
      * @param bean managed bean instance
      */
-    public static void checkGenericType(Bean<?> bean)
+    public static void checkGenericType(Class<?> clazz, Class<? extends Annotation>
scope)
     {
-        Asserts.assertNotNull(bean);
-
-        Class<?> clazz = bean.getBeanClass();
+        Asserts.assertNotNull(clazz);
 
         if (ClassUtil.isDefinitionContainsTypeVariables(clazz))
         {
-            if(!bean.getScope().equals(Dependent.class))
+            if(!scope.equals(Dependent.class))
             {
                 throw new WebBeansConfigurationException("Generic type may only defined with
scope @Dependent " +
                         "for ManagedBean class : " + clazz.getName());

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java?rev=1429701&r1=1429700&r2=1429701&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
Mon Jan  7 08:22:01 2013
@@ -539,7 +539,8 @@ public abstract class TestContext implem
         // we fully initialize the bean in this case.
         component.setFullInit(true);
 
-        WebBeansUtil.checkGenericType(managedBeanCreator.getBean());
+        ManagedBean<T> bean = managedBeanCreator.getBean();
+        WebBeansUtil.checkGenericType(bean.getReturnType(), bean.getScope());
         managedBeanCreator.defineName();
         managedBeanCreator.defineQualifiers();
 



Mime
View raw message