openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1647350 - in /openwebbeans/trunk: webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/ webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/java/org/apache/webbeans/inject/ webbeans-impl/src/main/j...
Date Mon, 22 Dec 2014 16:51:46 GMT
Author: rmannibucau
Date: Mon Dec 22 16:51:45 2014
New Revision: 1647350

URL: http://svn.apache.org/r1647350
Log:
starting to move ProcessBeanAttribute event

Modified:
    openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/EjbBeanBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java
    openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java

Modified: openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/EjbBeanBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/EjbBeanBuilder.java?rev=1647350&r1=1647349&r2=1647350&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/EjbBeanBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/EjbBeanBuilder.java
Mon Dec 22 16:51:45 2014
@@ -24,10 +24,10 @@ import java.util.Set;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanAttributes;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.InjectionTarget;
 
-import org.apache.webbeans.component.BeanAttributesImpl;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.ejb.common.util.EjbValidator;
 import org.apache.webbeans.portable.AbstractEjbInjectionTarget;
@@ -44,9 +44,9 @@ public abstract class EjbBeanBuilder<T,
 {
     protected final WebBeansContext webBeansContext;
     protected final AnnotatedType<T> annotatedType;
-    protected final BeanAttributesImpl<T> beanAttributes;
+    protected final BeanAttributes<T> beanAttributes;
 
-    public EjbBeanBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType,
BeanAttributesImpl<T> beanAttributes)
+    public EjbBeanBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType,
BeanAttributes<T> beanAttributes)
     {
         Asserts.assertNotNull(webBeansContext, "webBeansContext may not be null");
         Asserts.assertNotNull(annotatedType, "annotated type may not be null");

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1647350&r1=1647349&r2=1647350&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Mon Dec 22 16:51:45 2014
@@ -112,6 +112,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -220,12 +221,6 @@ public class BeansDeployer
                 //Fire Event
                 fireBeforeBeanDiscoveryEvent();
                 
-                //Deploy bean from XML. Also configures deployments, interceptors, decorators.
-                deployFromXML(scanner);
-                
-                //Checking stereotype conditions
-                checkStereoTypes(scanner);
-                
                 //Configure Default Beans
                 configureDefaultBeans();
 
@@ -238,13 +233,20 @@ public class BeansDeployer
 
                 addAdditionalAnnotatedTypes(fireAfterTypeDiscoveryEvent(), annotatedTypes);
 
+                Map<AnnotatedType<?>, AnnotatedTypeData<?>> annotatedTypePreProcessing
= getBeanAttributes(annotatedTypes);
+                annotatedTypes.clear(); // shouldn't be used anymore, view is now annotatedTypePreProcessing
+
+                //Deploy bean from XML. Also configures deployments, interceptors, decorators.
+                deployFromXML(scanner, annotatedTypePreProcessing);
+
+                //Checking stereotype conditions
+                checkStereoTypes(scanner);
+
                 // Handle Specialization
-                removeSpecializedTypes(annotatedTypes);
+                removeSpecializedTypes(annotatedTypePreProcessing.keySet());
 
                 // create beans from the discovered AnnotatedTypes
-                deployFromAnnotatedTypes(annotatedTypes);
-
-                webBeansContext.getAlternativesManager().failIfSomeAlternativeIsNotResolved();
+                deployFromAnnotatedTypes(annotatedTypePreProcessing);
 
                 //X TODO configure specialized producer beans.
                 webBeansContext.getWebBeansUtil().configureProducerMethodSpecializations();
@@ -304,6 +306,39 @@ public class BeansDeployer
         }
     }
 
+    private Map<AnnotatedType<?>, AnnotatedTypeData<?>> getBeanAttributes(final
List<AnnotatedType<?>> annotatedTypes)
+    {
+        final Map<AnnotatedType<?>, AnnotatedTypeData<?>> result = new
IdentityHashMap<AnnotatedType<?>, AnnotatedTypeData<?>>(annotatedTypes.size());
+        final Iterator<AnnotatedType<?>> iterator = annotatedTypes.iterator();
+        while (iterator.hasNext())
+        {
+            final AnnotatedType<?> at = iterator.next();
+            final Class beanClass = at.getJavaClass();
+            final boolean isEjb = discoverEjb && EJBWebBeansConfigurator.isSessionBean(beanClass,
webBeansContext);
+            try
+            {
+                if(isEjb || (ClassUtil.isConcrete(beanClass) || WebBeansUtil.isDecorator(at))
&& isValidManagedBean(at))
+                {
+                    final BeanAttributesImpl tBeanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(at).build();
+                    final BeanAttributes<?> beanAttributes = webBeansContext.getWebBeansUtil().fireProcessBeanAttributes(at,
at.getJavaClass(), tBeanAttributes);
+                    if (beanAttributes != null)
+                    {
+                        result.put(at, new AnnotatedTypeData(beanAttributes, isEjb));
+                    }
+                }
+                else
+                {
+                    iterator.remove();
+                }
+            }
+            catch (final NoClassDefFoundError ncdfe)
+            {
+                logger.info("Skipping deployment of Class " + beanClass + "due to a NoClassDefFoundError:
" + ncdfe.getMessage());
+            }
+        }
+        return result;
+    }
+
     private void validateDisposeParameters()
     {
         final WebBeansUtil webBeansUtil = webBeansContext.getWebBeansUtil();
@@ -1000,26 +1035,26 @@ public class BeansDeployer
      * @param annotatedTypes the AnnotatedTypes which got discovered so far and are not vetoed
      * @throws ClassNotFoundException if class not found
      */
-    protected void deployFromAnnotatedTypes(List<AnnotatedType<?>> annotatedTypes)
throws ClassNotFoundException
+    protected void deployFromAnnotatedTypes(Map<AnnotatedType<?>, AnnotatedTypeData<?>>
annotatedTypes) throws ClassNotFoundException
     {
         logger.fine("Deploying configurations from class files has started.");
 
         // Start from the class
-        for(AnnotatedType<?> annotatedType : annotatedTypes)
+        for(Map.Entry<AnnotatedType<?>, AnnotatedTypeData<?>> annotatedType
: annotatedTypes.entrySet())
         {
             try
             {
-                deploySingleAnnotatedType(annotatedType);
+                deploySingleAnnotatedType(annotatedType.getKey(), annotatedType.getValue());
             }
             catch (NoClassDefFoundError ncdfe)
             {
-                logger.info("Skipping deployment of Class " + annotatedType.getJavaClass()
+ "due to a NoClassDefFoundError: " + ncdfe.getMessage());
+                logger.info("Skipping deployment of Class " + annotatedType.getKey().getJavaClass()
+ "due to a NoClassDefFoundError: " + ncdfe.getMessage());
             }
 
             // if the implClass already gets processed as part of the
             // standard BDA scanning, then we don't need to 'additionally'
             // deploy it anymore.
-            webBeansContext.getBeanManagerImpl().removeAdditionalAnnotatedType(annotatedType);
+            webBeansContext.getBeanManagerImpl().removeAdditionalAnnotatedType(annotatedType.getKey());
 
         }
 
@@ -1032,18 +1067,18 @@ public class BeansDeployer
      * Common helper method used to deploy annotated types discovered through
      * scanning or during beforeBeanDiscovery.
      * 
-     * @param annotatedType the AnnotatedType representing the bean to be deployed
+     * @param annotatedTypeData the AnnotatedType representing the bean to be deployed with
their already computed data
      */
-    private void deploySingleAnnotatedType(AnnotatedType annotatedType)
+    private void deploySingleAnnotatedType(AnnotatedType annotatedType, AnnotatedTypeData
annotatedTypeData)
     {
 
         Class beanClass = annotatedType.getJavaClass();
 
         // EJBs can be defined so test them really before going for a ManagedBean
-        if (discoverEjb && EJBWebBeansConfigurator.isSessionBean(beanClass, webBeansContext))
+        if (annotatedTypeData.isEjb)
         {
             logger.log(Level.FINE, "Found Enterprise Bean with class name : [{0}]", beanClass.getName());
-            defineEnterpriseWebBean((Class<Object>) beanClass, annotatedType);
+            defineEnterpriseWebBean((Class<Object>) beanClass, annotatedType, annotatedTypeData.beanAttributes);
         }
         else
         {
@@ -1052,7 +1087,7 @@ public class BeansDeployer
                 if((ClassUtil.isConcrete(beanClass) || WebBeansUtil.isDecorator(annotatedType))
                         && isValidManagedBean(annotatedType))
                 {
-                    defineManagedBean(annotatedType);
+                    defineManagedBean(annotatedType, annotatedTypeData.beanAttributes);
                 }
             }
             catch (NoClassDefFoundError ncdfe)
@@ -1095,7 +1130,7 @@ public class BeansDeployer
      *
      * @throws WebBeansDeploymentException if a problem occurs
      */
-    protected void deployFromXML(ScannerService scanner) throws WebBeansDeploymentException
+    protected void deployFromXML(ScannerService scanner, Map<AnnotatedType<?>, AnnotatedTypeData<?>>
preProcessing) throws WebBeansDeploymentException
     {
         logger.fine("Deploying configurations from XML files has started.");
 
@@ -1112,14 +1147,14 @@ public class BeansDeployer
 
             configureDecorators(url, beanArchiveInformation.getDecorators());
             configureInterceptors(url, beanArchiveInformation.getInterceptors());
-            configureAlternatives(url, beanArchiveInformation.getAlternativeClasses(), false);
-            configureAlternatives(url, beanArchiveInformation.getAlternativeStereotypes(),
true);
+            configureAlternatives(url, beanArchiveInformation.getAlternativeClasses(), false,
preProcessing);
+            configureAlternatives(url, beanArchiveInformation.getAlternativeStereotypes(),
true, preProcessing);
         }
 
         logger.fine("Deploying configurations from XML has ended successfully.");
     }
 
-    private void configureAlternatives(URL bdaLocation, List<String> alternatives,
boolean isStereotype)
+    private void configureAlternatives(URL bdaLocation, List<String> alternatives,
boolean isStereotype, Map<AnnotatedType<?>, AnnotatedTypeData<?>> preProcessing)
     {
         // the alternatives in this beans.xml
         // this gets used to detect multiple definitions of the
@@ -1143,14 +1178,34 @@ public class BeansDeployer
             }
             else
             {
-                AlternativesManager manager = WebBeansContext.getInstance().getAlternativesManager();
+                AlternativesManager manager = webBeansContext.getAlternativesManager();
                 if (isStereotype)
                 {
                     manager.addXmlStereoTypeAlternative(clazz);
                 }
                 else
                 {
-                    manager.addXmlClazzAlternative(clazz);
+                    if (AnnotationUtil.hasClassAnnotation(clazz, Alternative.class) ||
+                            AnnotationUtil.hasMetaAnnotation(clazz.getAnnotations(), Alternative.class))
+                    {
+                        manager.addXmlClazzAlternative(clazz);
+                    }
+                    else
+                    {
+                        AnnotatedType annotatedType = webBeansContext.getAnnotatedElementFactory().getAnnotatedType(clazz);
+                        if (annotatedType != null)
+                        {
+                            AnnotatedTypeData data = preProcessing.get(annotatedType);
+                            if (data != null && data.beanAttributes.isAlternative())
+                            {
+                                manager.addXmlClazzAlternative(clazz);
+                            }
+                            else
+                            {
+                                throw new WebBeansConfigurationException("Given alternative
class : " + clazz.getName() + " is not decorated wih @Alternative" );
+                            }
+                        }
+                    }
                 }
             }
         }
@@ -1275,7 +1330,7 @@ public class BeansDeployer
      * Checks specialization on classes and remove any AnnotatedType which got 'disabled'
by having a sub-class with &#064;Specializes.
      * @param annotatedTypes the annotatedTypes which got picked up during scanning. All
'disabled' annotatedTypes will be removed.
      */
-    private void removeSpecializedTypes(List<AnnotatedType<?>> annotatedTypes)
+    private void removeSpecializedTypes(Collection<AnnotatedType<?>> annotatedTypes)
     {
         logger.fine("Checking Specialization constraints has started.");
         
@@ -1385,7 +1440,7 @@ public class BeansDeployer
      * Defines and configures managed bean.
      * @param <T> type info
      */
-    protected <T> void defineManagedBean(AnnotatedType<T> annotatedType)
+    protected <T> void defineManagedBean(AnnotatedType<T> annotatedType, BeanAttributes<T>
attributes)
     {   
         //Fires ProcessInjectionTarget event for Java EE components instances
         //That supports injections but not managed beans
@@ -1402,21 +1457,7 @@ public class BeansDeployer
         }
 
         {
-
-            final BeanAttributesImpl<T> tBeanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(annotatedType).build();
-            final BeanAttributes<T> beanAttributes = webBeansContext.getWebBeansUtil().fireProcessBeanAttributes(
-                    annotatedType, annotatedType.getJavaClass(),
-                    tBeanAttributes);
-            if (beanAttributes == null)
-            {
-                return;
-            }
-            if (!tBeanAttributes.isAlternative() && beanAttributes.isAlternative())
-            {
-                webBeansContext.getAlternativesManager().onProgrammicAlternative(annotatedType.getJavaClass());
-            }
-
-            ManagedBeanBuilder<T, ManagedBean<T>> managedBeanCreator = new ManagedBeanBuilder<T,
ManagedBean<T>>(webBeansContext, annotatedType, beanAttributes);
+            ManagedBeanBuilder<T, ManagedBean<T>> managedBeanCreator = new ManagedBeanBuilder<T,
ManagedBean<T>>(webBeansContext, annotatedType, attributes);
 
             if(WebBeansUtil.isDecorator(annotatedType))
             {
@@ -1425,7 +1466,7 @@ public class BeansDeployer
                     logger.log(Level.FINE, "Found Managed Bean Decorator with class name
: [{0}]", annotatedType.getJavaClass().getName());
                 }
 
-                DecoratorBeanBuilder<T> dbb = new DecoratorBeanBuilder<T>(webBeansContext,
annotatedType, beanAttributes);
+                DecoratorBeanBuilder<T> dbb = new DecoratorBeanBuilder<T>(webBeansContext,
annotatedType, attributes);
                 if (dbb.isDecoratorEnabled())
                 {
                     dbb.defineDecoratorRules();
@@ -1440,7 +1481,7 @@ public class BeansDeployer
                     logger.log(Level.FINE, "Found Managed Bean Interceptor with class name
: [{0}]", annotatedType.getJavaClass().getName());
                 }
 
-                CdiInterceptorBeanBuilder<T> ibb = new CdiInterceptorBeanBuilder<T>(webBeansContext,
annotatedType, beanAttributes);
+                CdiInterceptorBeanBuilder<T> ibb = new CdiInterceptorBeanBuilder<T>(webBeansContext,
annotatedType, attributes);
                 if (ibb.isInterceptorEnabled())
                 {
                     ibb.defineCdiInterceptorRules();
@@ -1566,10 +1607,22 @@ public class BeansDeployer
      * @param <T> bean class type
      * @param clazz bean class
      */
-    protected <T> void defineEnterpriseWebBean(Class<T> clazz, AnnotatedType<T>
annotatedType)
+    protected <T> void defineEnterpriseWebBean(Class<T> clazz, AnnotatedType<T>
annotatedType, BeanAttributes<T> attributes)
     {
-        InjectionTargetBean<T> bean = (InjectionTargetBean<T>) EJBWebBeansConfigurator.defineEjbBean(clazz,
annotatedType,
-                                                                                        
            webBeansContext);
+        InjectionTargetBean<T> bean = (InjectionTargetBean<T>) EJBWebBeansConfigurator.defineEjbBean(
+                clazz, annotatedType, attributes, webBeansContext);
         webBeansContext.getWebBeansUtil().setInjectionTargetBeanEnableFlag(bean);
     }
+
+    private static class AnnotatedTypeData<T>
+    {
+        private final BeanAttributes<T> beanAttributes;
+        private final boolean isEjb;
+
+        public AnnotatedTypeData(final BeanAttributes<T> beanAttributes, final boolean
isEjb)
+        {
+            this.beanAttributes = beanAttributes;
+            this.isEjb = isEjb;
+        }
+    }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java?rev=1647350&r1=1647349&r2=1647350&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java
Mon Dec 22 16:51:45 2014
@@ -20,6 +20,7 @@ package org.apache.webbeans.config;
 
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
 
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.plugins.PluginLoader;
@@ -60,7 +61,7 @@ public final class EJBWebBeansConfigurat
      * @param clazz bean class
      * @return ejb bean
      */
-    public static <T> Bean<T> defineEjbBean(Class<T> clazz, AnnotatedType<T>
annotatedType,
+    public static <T> Bean<T> defineEjbBean(Class<T> clazz, AnnotatedType<T>
annotatedType, BeanAttributes<T> attributes,
                                             WebBeansContext webBeansContext)
     {
         PluginLoader loader = webBeansContext.getPluginLoader();
@@ -71,7 +72,7 @@ public final class EJBWebBeansConfigurat
             throw new IllegalStateException("There is no provided EJB plugin. Unable to define
session bean for class : " + clazz.getName());
         }
         
-        return ejbPlugin.defineSessionBean(clazz, annotatedType);
+        return ejbPlugin.defineSessionBean(clazz, attributes, annotatedType);
     }
     
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java?rev=1647350&r1=1647349&r2=1647350&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
Mon Dec 22 16:51:45 2014
@@ -55,9 +55,6 @@ public class AlternativesManager
 
     private final WebBeansContext webBeansContext;
 
-    // should always be empty at runtime, mainly used for BeanAttribute#isAlternative() checks
-    private final Set<Class<?>> potentialProgrammaticAlternatives = new HashSet<Class<?>>();
-
     /**
      * All the stereotypes which are configured via XML &lt;class&gt;
      */
@@ -76,19 +73,6 @@ public class AlternativesManager
         this.webBeansContext = webBeansContext;
     }
 
-    public void onProgrammicAlternative(final Class<?> clazz)
-    {
-        potentialProgrammaticAlternatives.remove(clazz);
-    }
-
-    public void failIfSomeAlternativeIsNotResolved()
-    {
-        if (!potentialProgrammaticAlternatives.isEmpty())
-        {
-            throw new WebBeansConfigurationException("Specified alternatives: " + potentialProgrammaticAlternatives
+ " are not annotated with @Alternative");
-        }
-    }
-
     /**
      * This methods gets called while scanning the various beans.xml files.
      * It registers a &lt;stereotype&gt; alternative.
@@ -126,15 +110,7 @@ public class AlternativesManager
      */
     public void addXmlClazzAlternative(Class<?> alternative)
     {
-        if (AnnotationUtil.hasClassAnnotation(alternative, Alternative.class) ||
-            AnnotationUtil.hasMetaAnnotation(alternative.getAnnotations(), Alternative.class))
-        {
-            configuredAlternatives.add(alternative);
-        }
-        else
-        {
-            potentialProgrammaticAlternatives.add(alternative);
-        }
+        configuredAlternatives.add(alternative);
     }
 
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java?rev=1647350&r1=1647349&r2=1647350&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java
Mon Dec 22 16:51:45 2014
@@ -25,6 +25,7 @@ import javax.enterprise.inject.spi.Annot
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -58,7 +59,7 @@ public class SpecializationUtil
     }
 
 
-    public void removeDisabledTypes(List<AnnotatedType<?>> annotatedTypes)
+    public void removeDisabledTypes(Collection<AnnotatedType<?>> annotatedTypes)
     {
         if (annotatedTypes != null && !annotatedTypes.isEmpty())
         {
@@ -96,7 +97,7 @@ public class SpecializationUtil
 
                     AnnotatedType<?> superType = getAnnotatedTypeForClass(annotatedTypes,
superClass);
 
-                    if (!webBeansUtil.isConstructorOk(superType))
+                    if (superType == null || !webBeansUtil.isConstructorOk(superType))
                     {
                         throw new WebBeansDeploymentException(new InconsistentSpecializationException("@Specializes
class " + specialClass.getName()
                                 + " does not extend a bean with a valid bean constructor"));
@@ -139,7 +140,7 @@ public class SpecializationUtil
         }
     }
 
-    private boolean containsAllSuperclassTypes(AnnotatedType<?> annotatedType, Class<?>
superClass, List<AnnotatedType<?>> annotatedTypes)
+    private boolean containsAllSuperclassTypes(AnnotatedType<?> annotatedType, Class<?>
superClass, Collection<AnnotatedType<?>> annotatedTypes)
     {
         Typed typed = annotatedType.getAnnotation(Typed.class);
         if (typed != null)
@@ -168,7 +169,7 @@ public class SpecializationUtil
         return true;
     }
 
-    private AnnotatedType<?> getAnnotatedTypeForClass(List<AnnotatedType<?>>
annotatedTypes, Class<?> clazz)
+    private AnnotatedType<?> getAnnotatedTypeForClass(Collection<AnnotatedType<?>>
annotatedTypes, Class<?> clazz)
     {
         for (AnnotatedType<?> annotatedType : annotatedTypes)
         {

Modified: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java?rev=1647350&r1=1647349&r2=1647350&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java
(original)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java
Mon Dec 22 16:51:45 2014
@@ -21,6 +21,7 @@ package org.apache.webbeans.spi.plugins;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
 import java.lang.reflect.Method;
 
 /**
@@ -52,7 +53,7 @@ public interface OpenWebBeansEjbPlugin e
      * @param clazz session bean class
      * @param annotatedType processed annotated type
      */
-    public <T> Bean<T> defineSessionBean(Class<T> clazz, AnnotatedType<T>
annotatedType);
+    public <T> Bean<T> defineSessionBean(Class<T> clazz, BeanAttributes<T>
attributes, AnnotatedType<T> annotatedType);
 
     public <T> Bean<T> defineNewSessionBean(Class<T> clazz);
 



Mime
View raw message