openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1798914 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/configurator/ webbeans-impl/src/main/java/org/apache/webbeans/container/ webbeans-tck/
Date Fri, 16 Jun 2017 11:50:12 GMT
Author: rmannibucau
Date: Fri Jun 16 11:50:12 2017
New Revision: 1798914

URL: http://svn.apache.org/viewvc?rev=1798914&view=rev
Log:
wiring interception factory in bean manager

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/configurator/BeanConfiguratorImpl.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/InjectableBeanManager.java
    openwebbeans/trunk/webbeans-tck/testng-dev.xml

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/configurator/BeanConfiguratorImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/configurator/BeanConfiguratorImpl.java?rev=1798914&r1=1798913&r2=1798914&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/configurator/BeanConfiguratorImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/configurator/BeanConfiguratorImpl.java
Fri Jun 16 11:50:12 2017
@@ -33,6 +33,7 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Set;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
@@ -56,7 +57,7 @@ public class BeanConfiguratorImpl<T> imp
     private String name = null;
     private boolean alternative;
 
-    private Set<Type> typeClosures = new HashSet<>();
+    private Set<Type> typeClosures = new LinkedHashSet<>();
     private Set<InjectionPoint> injectionPoints = new HashSet<>();
     private Set<Annotation> qualifiers = new HashSet<>();
     private Set<Class<? extends Annotation>> stereotypes = new HashSet<>();
@@ -337,7 +338,9 @@ public class BeanConfiguratorImpl<T> imp
 
         public ConstructedBean()
         {
-            this.returnType = null; //X TODO calculate return type from the typeClosures
+            //X TODO calculate return type from the typeClosures properly
+            this.returnType = beanClass != null ? Class.class.cast(beanClass) : (typeClosures.isEmpty()
? null :
+                    Class.class.cast(typeClosures.stream().filter(Class.class::isInstance).findFirst().orElse(null)));
 
             dependent = !webBeansContext.getBeanManagerImpl().isNormalScope(scope);
 
@@ -381,7 +384,7 @@ public class BeanConfiguratorImpl<T> imp
         @Override
         public Class<?> getBeanClass()
         {
-            return beanClass;
+            return beanClass == null ? returnType : beanClass;
         }
 
         @Override
@@ -405,7 +408,7 @@ public class BeanConfiguratorImpl<T> imp
         @Override
         public Class<T> getReturnType()
         {
-            return (Class<T>) beanClass;
+            return returnType;
         }
 
         @Override

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=1798914&r1=1798913&r2=1798914&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
Fri Jun 16 11:50:12 2017
@@ -1188,11 +1188,13 @@ public class BeanManagerImpl implements
         return injectionResolver.resolve(beans, null);
     }
 
-    //X TODO OWB-1182 CDI 2.0
     @Override
     public <T> InterceptionFactory<T> createInterceptionFactory(CreationalContext<T>
creationalContext, Class<T> clazz)
     {
-        throw new UnsupportedOperationException("CDI 2.0 not yet implemented");
+        return new InterceptionFactoryImpl(
+                webBeansContext, createAnnotatedType(clazz), AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION,
+                // ok, we can need to not cast that brutally
+                CreationalContextImpl.class.cast(creationalContext));
     }
 
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java?rev=1798914&r1=1798913&r2=1798914&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java
Fri Jun 16 11:50:12 2017
@@ -232,11 +232,10 @@ public class InjectableBeanManager imple
         return bm.resolve(beans);
     }
 
-    //X TODO OWB-1182 CDI 2.0
     @Override
     public <T> InterceptionFactory<T> createInterceptionFactory(CreationalContext<T>
creationalContext, Class<T> aClass)
     {
-        throw new UnsupportedOperationException("CDI 2.0 not yet imlemented");
+        return bm.createInterceptionFactory(creationalContext, aClass);
     }
 
     @Override

Modified: openwebbeans/trunk/webbeans-tck/testng-dev.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/testng-dev.xml?rev=1798914&r1=1798913&r2=1798914&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/testng-dev.xml (original)
+++ openwebbeans/trunk/webbeans-tck/testng-dev.xml Fri Jun 16 11:50:12 2017
@@ -18,7 +18,7 @@
 <suite name="JSR-346-TCK" verbose="2" configfailurepolicy="continue">
   <test name="JSR-346 TCK">
     <classes>
-          <class name="org.jboss.cdi.tck.tests.extensions.lifecycle.bbd.broken.passivatingScope.AddingPassivatingScopeTest"
/>
+          <class name="org.jboss.cdi.tck.tests.extensions.interceptionFactory.customBean.CustomBeanWithInterceptorTest"
/>
       <!--
 
       <class name="org.jboss.cdi.tck.tests.event.parameterized.ParameterizedEventTest"
/>



Mime
View raw message