openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1606580 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadataImpl.java webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java webbeans-tck/testng-dev.xml
Date Sun, 29 Jun 2014 19:39:07 GMT
Author: rmannibucau
Date: Sun Jun 29 19:39:07 2014
New Revision: 1606580

URL: http://svn.apache.org/r1606580
Log:
avoid NPE in Instance + removing constraint on Event types since it was too restrictive

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadataImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
    openwebbeans/trunk/webbeans-tck/testng-dev.xml

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadataImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadataImpl.java?rev=1606580&r1=1606579&r2=1606580&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadataImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadataImpl.java
Sun Jun 29 19:39:07 2014
@@ -34,7 +34,6 @@ import javax.enterprise.util.TypeLiteral
 import org.apache.webbeans.annotation.AnyLiteral;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.util.ArrayUtil;
-import org.apache.webbeans.util.GenericsUtil;
 
 public class EventMetadataImpl implements EventMetadata, Serializable
 {
@@ -47,10 +46,6 @@ public class EventMetadataImpl implement
     
     public EventMetadataImpl(Type type, InjectionPoint injectionPoint, Annotation[] qualifiers,
WebBeansContext context)
     {
-        if (GenericsUtil.containsTypeVariable(type))
-        {
-            throw new IllegalArgumentException("event type may not contain type variable:
" + type);
-        }
         context.getAnnotationManager().checkQualifierConditions(qualifiers);
         this.type = type;
         this.injectionPoint = injectionPoint;

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=1606580&r1=1606579&r2=1606580&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
Sun Jun 29 19:39:07 2014
@@ -25,14 +25,13 @@ import java.io.Serializable;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
+import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import javax.enterprise.context.Dependent;
 import javax.enterprise.context.spi.AlterableContext;
 import javax.enterprise.context.spi.Context;
 import javax.enterprise.context.spi.CreationalContext;
@@ -124,16 +123,8 @@ public class InstanceImpl<T> implements 
             InjectionExceptionUtil.throwUnsatisfiedResolutionException(ClassUtil.getClazz(injectionClazz),
injectionPoint, anns);
         }
 
-        // since Instance<T> is Dependent, we we gonna use the parent CreationalContext
by default
-        CreationalContextImpl<?> creationalContext = beanManager.createCreationalContext(parentCreationalContext.getContextual());
+        CreationalContextImpl<?> creationalContext = beanManager.createCreationalContext(bean);
 
-        boolean isDependentBean = WebBeansUtil.isDependent(bean);
-
-        if (!isDependentBean)
-        {
-            // but for all NormalScoped beans we will need to create a fresh CreationalContext
-            creationalContext = beanManager.createCreationalContext(bean);
-        }
         if (!(creationalContext instanceof CreationalContextImpl))
         {
             creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext,
bean);
@@ -145,10 +136,10 @@ public class InstanceImpl<T> implements 
             final T reference = (T) beanManager.getReference(bean, injectionClazz, creationalContext);
             if (creationalContexts == null)
             {
-                creationalContexts = new HashMap<Object, CreationalContextImpl<?>>();
+                creationalContexts = new IdentityHashMap<Object, CreationalContextImpl<?>>();
             }
             creationalContexts.put(reference, creationalContext);
-            if (Dependent.class == bean.getScope())
+            if (WebBeansUtil.isDependent(bean))
             {
                 parentCreationalContext.addDependent(bean, reference);
             }
@@ -348,6 +339,7 @@ public class InstanceImpl<T> implements 
         injectionClazz = (Type)inputStream.readObject();
         qualifierAnnotations = (Set<Annotation>)inputStream.readObject();
         injectionPoint = (InjectionPoint) inputStream.readObject();
+        parentCreationalContext = webBeansContext.getBeanManagerImpl().createCreationalContext(null);
// TODO: check what we can do
     }
     
     public String toString()

Modified: openwebbeans/trunk/webbeans-tck/testng-dev.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/testng-dev.xml?rev=1606580&r1=1606579&r2=1606580&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/testng-dev.xml (original)
+++ openwebbeans/trunk/webbeans-tck/testng-dev.xml Sun Jun 29 19:39:07 2014
@@ -19,7 +19,7 @@
   <test name="JSR-346 TCK">
     <classes>
       <class
-          name="org.jboss.cdi.tck.tests.lookup.dynamic.destroy.dependent.DestroyingDependentInstanceTest"
/>
+          name="org.jboss.cdi.tck.tests.lookup.dynamic.builtin.BuiltinInstanceTest" />
     </classes>
     <groups>
       <run>



Mime
View raw message