[webbeans-commits] Webbeans SVN: r3231 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap and 1 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sat Jul 25 17:19:28 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-07-25 17:19:28 -0400 (Sat, 25 Jul 2009)
New Revision: 3231

Added:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractReceiverBean.java
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java
Log:
Fix disposal methods for enterprise beans, use OO for DisposalMethodBean

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-07-25 21:18:10 UTC (rev 3230)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-07-25 21:19:28 UTC (rev 3231)
@@ -234,13 +234,6 @@
    }
 
    /**
-    * Gets the default deployment type
-    * 
-    * @return The default deployment type
-    */
-   protected abstract Class<? extends Annotation> getDefaultDeploymentType();
-
-   /**
     * Initializes the name
     */
    protected void initName()

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java	2009-07-25 21:18:10 UTC (rev 3230)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java	2009-07-25 21:19:28 UTC (rev 3231)
@@ -426,12 +426,6 @@
       return "AbstractClassBean " + getName();
    }
 
-   @Override
-   /*
-    * Gets the default deployment type
-    * 
-    * @return The default deployment type
-    */
    protected Class<? extends Annotation> getDefaultDeploymentType()
    {
       return Production.class;
@@ -442,5 +436,6 @@
    {
       return id;
    }
+   
 
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-07-25 21:18:10 UTC (rev 3230)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-07-25 21:19:28 UTC (rev 3231)
@@ -40,7 +40,6 @@
 import org.jboss.webbeans.BeanManagerImpl;
 import org.jboss.webbeans.DefinitionException;
 import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
-import org.jboss.webbeans.context.CreationalContextImpl;
 import org.jboss.webbeans.introspector.WBMember;
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;
@@ -57,11 +56,8 @@
  * @param <T>
  * @param <S>
  */
-public abstract class AbstractProducerBean<T, S extends Member> extends AbstractBean<T, S>
+public abstract class AbstractProducerBean<T, S extends Member> extends AbstractReceiverBean<T, S>
 {
-   // The declaring bean
-   protected AbstractClassBean<?> declaringBean;
-
    private static final LogProvider log = Logging.getLogProvider(AbstractProducerBean.class);
 
    /**
@@ -72,8 +68,7 @@
     */
    public AbstractProducerBean(AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
    {
-      super(manager);
-      this.declaringBean = declaringBean;
+      super(declaringBean, manager);
    }
 
    @Override
@@ -86,28 +81,9 @@
       return getDeclaringBean().getBeanClass();
    }
 
-   @Override
-   public String getId()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-
-   public void destroy(T instance, CreationalContext<T> creationalContext)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-   /**
-    * Gets the deployment types
-    * 
-    * @return The deployment types of the declaring bean
-    */
-   @Override
    protected Class<? extends Annotation> getDefaultDeploymentType()
    {
-      return deploymentType = declaringBean.getDeploymentType();
+      return getDeclaringBean().getDeploymentType();
    }
 
    /**
@@ -172,16 +148,6 @@
    }
 
    /**
-    * Returns the declaring bean
-    * 
-    * @return The bean representation
-    */
-   public AbstractClassBean<?> getDeclaringBean()
-   {
-      return declaringBean;
-   }
-
-   /**
     * Validates the producer method
     */
    protected void checkProducerReturnType()
@@ -209,7 +175,7 @@
    @Override
    public void initialize(BeanDeployerEnvironment environment)
    {
-      declaringBean.initialize(environment);
+      getDeclaringBean().initialize(environment);
       super.initialize(environment);
       checkProducerReturnType();
    }
@@ -322,35 +288,6 @@
    }
 
    /**
-    * Gets the receiver of the product
-    * 
-    * @return The receiver
-    */
-   protected Object getReceiver(CreationalContext<?> creationalContext)
-   {
-      // This is a bit dangerous, as it means that producer methods can end of
-      // executing on partially constructed instances. Also, it's not required
-      // by the spec...
-      if (getAnnotatedItem().isStatic())
-      {
-         return null;
-      }
-      else
-      {
-         if (creationalContext instanceof CreationalContextImpl)
-         {
-            CreationalContextImpl<?> creationalContextImpl = (CreationalContextImpl<?>) creationalContext;
-            if (creationalContextImpl.containsIncompleteInstance(getDeclaringBean()))
-            {
-               log.warn("Executing producer field or method " + getAnnotatedItem() + " on incomplete declaring bean " + getDeclaringBean() + " due to circular injection");
-               return creationalContextImpl.getIncompleteInstance(getDeclaringBean());
-            }
-         }
-         return manager.getReference(getDeclaringBean(), Object.class, creationalContext);
-      }
-   }
-
-   /**
     * Creates an instance of the bean
     * 
     * @returns The instance

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractReceiverBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractReceiverBean.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractReceiverBean.java	2009-07-25 21:19:28 UTC (rev 3231)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean;
+
+import java.lang.reflect.Member;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
+import org.jboss.webbeans.context.CreationalContextImpl;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class AbstractReceiverBean<T, S extends Member> extends AbstractBean<T, S>
+{
+
+   private static final LogProvider log = Logging.getLogProvider(AbstractReceiverBean.class);
+   
+   private AbstractClassBean<?> declaringBean;
+
+   public AbstractReceiverBean(AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+   {
+      super(manager);
+      this.declaringBean = declaringBean;
+   }
+   
+   @Override
+   public void initialize(BeanDeployerEnvironment environment)
+   {
+      super.initialize(environment);
+   }
+
+   /**
+    * Gets the receiver of the product
+    * 
+    * @return The receiver
+    */
+   protected Object getReceiver(CreationalContext<?> creationalContext)
+   {
+      // This is a bit dangerous, as it means that producer methods can end of
+      // executing on partially constructed instances. Also, it's not required
+      // by the spec...
+      if (getAnnotatedItem().isStatic())
+      {
+         return null;
+      }
+      else
+      {
+         if (creationalContext instanceof CreationalContextImpl<?>)
+         {
+            CreationalContextImpl<?> creationalContextImpl = (CreationalContextImpl<?>) creationalContext;
+            if (creationalContextImpl.containsIncompleteInstance(getDeclaringBean()))
+            {
+               log.warn("Executing producer field or method " + getAnnotatedItem() + " on incomplete declaring bean " + getDeclaringBean() + " due to circular injection");
+               return creationalContextImpl.getIncompleteInstance(getDeclaringBean());
+            }
+         }
+         return manager.getReference(getDeclaringBean(), Object.class, creationalContext);
+      }
+   }
+   
+
+   /**
+    * Returns the declaring bean
+    * 
+    * @return The bean representation
+    */
+   public AbstractClassBean<?> getDeclaringBean()
+   {
+      return declaringBean;
+   }
+
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractReceiverBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java	2009-07-25 21:18:10 UTC (rev 3230)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java	2009-07-25 21:19:28 UTC (rev 3231)
@@ -20,51 +20,44 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.ScopeType;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Disposes;
 import javax.enterprise.inject.Initializer;
 import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.deployment.DeploymentType;
 
 import org.jboss.webbeans.BeanManagerImpl;
 import org.jboss.webbeans.DefinitionException;
 import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
 import org.jboss.webbeans.injection.MethodInjectionPoint;
-import org.jboss.webbeans.injection.ParameterInjectionPoint;
 import org.jboss.webbeans.injection.WBInjectionPoint;
 import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.WBParameter;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
 
-public class DisposalMethodBean<T> extends AbstractBean<T, Method>
+public class DisposalMethodBean<T> extends AbstractReceiverBean<T, Method>
 {
 
-   private static final LogProvider log = Logging.getLogProvider(AbstractProducerBean.class);
-   protected AbstractClassBean<?> declaringBean;
-   private DisposalMethodBean<?> specializedBean;
    protected MethodInjectionPoint<T> disposalMethodInjectionPoint;
-   protected Set<WBInjectionPoint<?, ?>> disposalInjectionPoints;
    private final String id;
 
    protected DisposalMethodBean(BeanManagerImpl manager, WBMethod<T> disposalMethod, AbstractClassBean<?> declaringBean)
    {
-      super(manager);
+      super(declaringBean, manager);
       this.disposalMethodInjectionPoint = MethodInjectionPoint.of(this, disposalMethod);
-      this.declaringBean = declaringBean;
-      checkDisposalMethod();
+      this.id = createId("DisposalMethod-" + declaringBean.getName() + "-" + disposalMethod.getSignature().toString());
       initBindings();
       initType();
       initTypes();
-      this.id = createId("DisposalMethod-" + declaringBean.getName() + "-" + disposalMethod.getSignature().toString());
-
    }
+   
+   @Override
+   public void initialize(BeanDeployerEnvironment environment)
+   {
+      // TODO Auto-generated method stub
+      super.initialize(environment);
+      checkDisposalMethod();
+   }
 
    @SuppressWarnings("unchecked")
    protected void initType()
@@ -85,22 +78,7 @@
 
    protected void initInjectionPoints()
    {
-      disposalInjectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
-
-      List<? extends WBParameter<?>> disposalMethodParameters = disposalMethodInjectionPoint.getParameters();
-
-      // First one must be @Disposes, if more, register injectionpoints
-      if (disposalMethodParameters.size() > 1)
-      {
-         for (int i = 1; i < disposalMethodParameters.size(); i++)
-         {
-            WBParameter<?> parameter = disposalMethodParameters.get(i);
-            disposalInjectionPoints.add(ParameterInjectionPoint.of(declaringBean, parameter));
-         }
-      }
-
-      injectionPoints.add(MethodInjectionPoint.of(declaringBean, disposalMethodInjectionPoint));
-
+      injectionPoints.add(disposalMethodInjectionPoint);
    }
 
    @Override
@@ -112,12 +90,6 @@
       initDefaultBindings();
    }
 
-   @Override
-   public Class<? extends Annotation> getDeploymentType()
-   {
-      return declaringBean.getDeploymentType();
-   }
-
    /**
     * Initializes the API types
     */
@@ -127,7 +99,6 @@
       Set<Type> types = new HashSet<Type>();
       types = new HashSet<Type>();
       types.addAll(disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).get(0).getTypeClosure());
-      types.add(getType());
       types.add(Object.class);
       super.types = types;
    }
@@ -141,13 +112,13 @@
    @Override
    public String getName()
    {
-      return disposalMethodInjectionPoint.getPropertyName();
+      return null;
    }
 
    @Override
    public Class<? extends Annotation> getScopeType()
    {
-      return declaringBean.getScopeType();
+      return null;
    }
 
    @Override
@@ -165,13 +136,15 @@
    @Override
    public boolean isNullable()
    {
+      // Not relevant
       return false;
    }
 
    @Override
    public boolean isSerializable()
    {
-      return declaringBean.isSerializable();
+      // Not relevant
+      return false;
    }
 
    @Override
@@ -182,14 +155,21 @@
 
    public T create(CreationalContext<T> creationalContext)
    {
+      // Not Relevant
       return null;
    }
 
    public void invokeDisposeMethod(Object instance, CreationalContext<?> creationalContext)
    {
-      // TODO WTF - why isn't this using getReceiver!? Why is it assigning the beanInstance as the beanObject!?!
-      Object beanInstance = disposalMethodInjectionPoint.isStatic() ? declaringBean : getManager().getReference(declaringBean, declaringBean.getType(), creationalContext);
-      disposalMethodInjectionPoint.invokeWithSpecialValue(beanInstance, Disposes.class, instance, manager, creationalContext, IllegalArgumentException.class);
+      Object receiverInstance = getReceiver(creationalContext);
+      if (receiverInstance == null)
+      {
+         disposalMethodInjectionPoint.invokeWithSpecialValue(null, Disposes.class, instance, manager, creationalContext, IllegalArgumentException.class);
+      }
+      else
+      {
+         disposalMethodInjectionPoint.invokeOnInstanceWithSpecialValue(receiverInstance, Disposes.class, instance, manager, creationalContext, IllegalArgumentException.class);
+      }
    }
 
    private void checkDisposalMethod()
@@ -214,13 +194,13 @@
       {
          throw new DefinitionException("@Produces is not allowed on a disposal method, see " + disposalMethodInjectionPoint.toString());
       }
-      if (declaringBean instanceof EnterpriseBean)
+      if (getDeclaringBean() instanceof EnterpriseBean<?>)
       {
          boolean methodDeclaredOnTypes = false;
          // TODO use annotated item?
-         for (Type type : declaringBean.getTypes())
+         for (Type type : getDeclaringBean().getTypes())
          {
-            if (type instanceof Class)
+            if (type instanceof Class<?>)
             {
                Class<?> clazz = (Class<?>) type;
                try
@@ -236,118 +216,68 @@
          }
          if (!methodDeclaredOnTypes)
          {
-            throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + declaringBean);
+            throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + getDeclaringBean());
          }
       }
    }
 
    @Override
-   protected void preSpecialize(BeanDeployerEnvironment environment)
+   public Class<T> getType()
    {
-      if (declaringBean.getAnnotatedItem().getSuperclass().getDeclaredMethod(getAnnotatedItem().getAnnotatedMethod()) == null)
-      {
-         throw new DefinitionException("Specialized disposal method does not override a method on the direct superclass");
-      }
+      return type;
    }
 
    @Override
-   protected void specialize(BeanDeployerEnvironment environment)
+   protected String getDefaultName()
    {
-      WBMethod<?> superClassMethod = declaringBean.getAnnotatedItem().getSuperclass().getMethod(getAnnotatedItem().getAnnotatedMethod());
-      if (environment.getProducerMethod(superClassMethod) == null)
-      {
-         throw new IllegalStateException(toString() + " does not specialize a bean");
-      }
-      this.specializedBean = environment.getDisposalMethod(superClassMethod);
+      return disposalMethodInjectionPoint.getPropertyName();
    }
 
-   @Override
-   public Class<T> getType()
+   public void destroy(T instance, CreationalContext<T> creationalContext)
    {
-      return type;
+      // No-op. Producer method dependent objects are destroyed in producer method bean  
    }
 
    @Override
-   protected Class<? extends Annotation> getDefaultDeploymentType()
+   public String getId()
    {
-      return declaringBean.getDeploymentType();
+      return id;
    }
 
-   @Override
-   protected String getDefaultName()
+   public boolean isPolicy()
    {
-      return disposalMethodInjectionPoint.getPropertyName();
+      return false;
    }
 
    @Override
-   protected void initDeploymentType()
+   public AbstractBean<?, ?> getSpecializedBean()
    {
-      Set<Annotation> deploymentTypes = getAnnotatedItem().getMetaAnnotations(DeploymentType.class);
-      if (deploymentTypes.size() > 1)
-      {
-         throw new DefinitionException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + getAnnotatedItem().toString());
-      }
-      else if (deploymentTypes.size() == 1)
-      {
-         this.deploymentType = deploymentTypes.iterator().next().annotationType();
-         log.trace("Deployment type " + deploymentType + " specified by annotation");
-         return;
-      }
-
-      initDeploymentTypeFromStereotype();
-
-      if (this.deploymentType == null)
-      {
-         this.deploymentType = getDefaultDeploymentType();
-         log.trace("Using default " + this.deploymentType + " deployment type");
-         return;
-      }
+      // Doesn't support specialization
+      return null;
    }
-
+   
    @Override
    protected void initScopeType()
    {
-      Set<Annotation> scopeAnnotations = getAnnotatedItem().getMetaAnnotations(ScopeType.class);
-      if (scopeAnnotations.size() > 1)
-      {
-         throw new DefinitionException("At most one scope may be specified");
-      }
-      if (scopeAnnotations.size() == 1)
-      {
-         this.scopeType = scopeAnnotations.iterator().next().annotationType();
-         log.trace("Scope " + scopeType + " specified by annotation");
-         return;
-      }
-
-      initScopeTypeFromStereotype();
-
-      if (this.scopeType == null)
-      {
-         this.scopeType = Dependent.class;
-         log.trace("Using default @Dependent scope");
-      }      
+      // Disposal methods aren't scoped
    }
 
    @Override
-   public AbstractBean<?, ?> getSpecializedBean()
+   public Class<? extends Annotation> getDeploymentType()
    {
-      return specializedBean;
+      return getDeclaringBean().getDeploymentType();
    }
 
-   public void destroy(T instance, CreationalContext<T> creationalContext)
+   @Override
+   protected void initDeploymentType()
    {
-      // No-op. Producer method dependent objects are destroyed in producer method bean  
+      // Not used
    }
-
+   
    @Override
-   public String getId()
+   protected void checkDeploymentType()
    {
-      return id;
+      // TODO sort out ordering of init, then we can use initDeploymentType and hence checkDeploymentType
    }
 
-   public boolean isPolicy()
-   {
-      return false;
-   }
-
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java	2009-07-25 21:18:10 UTC (rev 3230)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java	2009-07-25 21:19:28 UTC (rev 3231)
@@ -126,11 +126,11 @@
       {
          throw new DefinitionException("Producer method cannot have parameter annotated @Disposes");
       }
-      else if (declaringBean instanceof EnterpriseBean)
+      else if (getDeclaringBean() instanceof EnterpriseBean<?>)
       {
          boolean methodDeclaredOnTypes = false;
          // TODO use annotated item?
-         for (Type type : declaringBean.getTypes())
+         for (Type type : getDeclaringBean().getTypes())
          {
             if (type instanceof Class)
             {
@@ -148,7 +148,7 @@
          }
          if (!methodDeclaredOnTypes)
          {
-            throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + declaringBean);
+            throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + getDeclaringBean());
          }
       }
    }
@@ -253,7 +253,7 @@
    @Override
    protected void preSpecialize(BeanDeployerEnvironment environment)
    {
-      if (declaringBean.getAnnotatedItem().getSuperclass().getDeclaredMethod(getAnnotatedItem().getAnnotatedMethod()) == null)
+      if (getDeclaringBean().getAnnotatedItem().getSuperclass().getDeclaredMethod(getAnnotatedItem().getAnnotatedMethod()) == null)
       {
          throw new DefinitionException("Specialized producer method does not override a method on the direct superclass");
       }
@@ -262,7 +262,7 @@
    @Override
    protected void specialize(BeanDeployerEnvironment environment)
    {
-      WBMethod<?> superClassMethod = declaringBean.getAnnotatedItem().getSuperclass().getMethod(getAnnotatedItem().getAnnotatedMethod());
+      WBMethod<?> superClassMethod = getDeclaringBean().getAnnotatedItem().getSuperclass().getMethod(getAnnotatedItem().getAnnotatedMethod());
       if (environment.getProducerMethod(superClassMethod) == null)
       {
          throw new IllegalStateException(toString() + " does not specialize a bean");

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java	2009-07-25 21:18:10 UTC (rev 3230)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java	2009-07-25 21:19:28 UTC (rev 3231)
@@ -24,7 +24,6 @@
 import javax.enterprise.inject.Disposes;
 import javax.enterprise.inject.Initializer;
 import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.ObserverMethod;
 
 import org.jboss.webbeans.BeanManagerImpl;
@@ -131,6 +130,7 @@
       for (WBMethod<?> method : annotatedClass.getDeclaredMethodsWithAnnotatedParameters(Disposes.class))
       {
          DisposalMethodBean<?> disposalBean = DisposalMethodBean.of(manager, method, declaringBean);
+         disposalBean.initialize(environment);
          environment.addDisposalBean(disposalBean);
       }
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java	2009-07-25 21:18:10 UTC (rev 3230)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java	2009-07-25 21:19:28 UTC (rev 3231)
@@ -54,7 +54,7 @@
    private final Set<DisposalMethodBean<?>> resolvedDisposalBeans;
    private final Set<DecoratorBean<?>> decorators;
    private final EjbDescriptorCache ejbDescriptors;
-   private final TypeSafeResolver disposalMethodResolver;
+   private final TypeSafeResolver<DisposalMethodBean<?>> disposalMethodResolver;
    private final BeanManagerImpl manager;
 
    public BeanDeployerEnvironment(EjbDescriptorCache ejbDescriptors, BeanManagerImpl manager)
@@ -68,7 +68,7 @@
       this.decorators = new HashSet<DecoratorBean<?>>();
       this.observers = new HashSet<ObserverMethod<?, ?>>();
       this.ejbDescriptors = ejbDescriptors;
-      this.disposalMethodResolver = new TypeSafeBeanResolver(manager, allDisposalBeans);
+      this.disposalMethodResolver = new TypeSafeBeanResolver<DisposalMethodBean<?>>(manager, allDisposalBeans);
       this.manager = manager;
    }
 
@@ -190,11 +190,11 @@
    public <T> Set<DisposalMethodBean<T>> resolveDisposalBeans(WBAnnotated<T, ?> annotatedItem)
    {
       // Correct?
-      Set<Bean<?>> beans = disposalMethodResolver.resolve(ResolvableFactory.of(annotatedItem));
+      Set<DisposalMethodBean<?>> beans = disposalMethodResolver.resolve(ResolvableFactory.of(annotatedItem));
       Set<DisposalMethodBean<T>> disposalBeans = new HashSet<DisposalMethodBean<T>>();
       for (Bean<?> bean : beans)
       {
-         if (bean instanceof DisposalMethodBean)
+         if (bean instanceof DisposalMethodBean<?>)
          {
             disposalBeans.add((DisposalMethodBean<T>) bean);
          }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java	2009-07-25 21:18:10 UTC (rev 3230)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java	2009-07-25 21:19:28 UTC (rev 3231)
@@ -78,7 +78,7 @@
       assert theOnlyDen.getName().equals(fox.getDen().getName());
    }
 
-   @Test(groups = { "new", "ri-broken", "disposal" })
+   @Test(groups = { "new", "disposal" })
    @SpecAssertion(section = "3.10", id = "x")
    public void testNewBeanHasNoDisposalMethods() throws Exception
    {




More information about the weld-commits mailing list