openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1796858 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Date Tue, 30 May 2017 13:07:17 GMT
Author: struberg
Date: Tue May 30 13:07:17 2017
New Revision: 1796858

URL: http://svn.apache.org/viewvc?rev=1796858&view=rev
Log:
OWB-1182 fix Stereotype checks

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java

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=1796858&r1=1796857&r2=1796858&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
Tue May 30 13:07:17 2017
@@ -278,7 +278,7 @@ public class BeansDeployer
 
 
                 //Checking stereotype conditions
-                checkStereoTypes(scanner);
+                checkStereoTypes(beanAttributesPerBda);
 
                 // Handle Specialization
                 specializationUtil.removeDisabledBeanAttributes(
@@ -1581,25 +1581,31 @@ public class BeansDeployer
 
     /**
      * Check steretypes.
-     * @param scanner scanner instance
      */
-    protected void checkStereoTypes(ScannerService scanner)
+    protected void checkStereoTypes(Map<BeanArchiveInformation, Map<AnnotatedType<?>,
ExtendedBeanAttributes<?>>> beanAttributesPerBda)
     {
         logger.fine("Checking StereoType constraints has started.");
 
         addDefaultStereoTypes();
 
-        final AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
-        
-        Set<Class<?>> beanClasses = scanner.getBeanClasses();
-        if (beanClasses != null && beanClasses.size() > 0)
+        AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+        StereoTypeManager stereoTypeManager = webBeansContext.getStereoTypeManager();
+
+        // all the Stereotypes we did already check
+        Set<Class<? extends Annotation>> verifiedStereotypes = new HashSet<>();
+
+        for (Map<AnnotatedType<?>, ExtendedBeanAttributes<?>> annotatedTypeExtendedBeanAttributesMap
: beanAttributesPerBda.values())
         {
-            final StereoTypeManager stereoTypeManager = webBeansContext.getStereoTypeManager();
-            for(Class<?> beanClass : beanClasses)
-            {                
-                if(beanClass.isAnnotation())
+            for (ExtendedBeanAttributes<?> extendedBeanAttributes : annotatedTypeExtendedBeanAttributesMap.values())
+            {
+                Set<Class<? extends Annotation>> stereotypes = extendedBeanAttributes.beanAttributes.getStereotypes();
+
+                for (Class<? extends Annotation> stereoClass : stereotypes)
                 {
-                    Class<? extends Annotation> stereoClass = (Class<? extends Annotation>)
beanClass;
+                    if (verifiedStereotypes.contains(stereoClass))
+                    {
+                        continue;
+                    }
                     if (annotationManager.isStereoTypeAnnotation(stereoClass)
                         && stereoTypeManager.getStereoTypeModel(stereoClass.getName())
== null)
                     {
@@ -1607,6 +1613,7 @@ public class BeansDeployer
                         StereoTypeModel model = new StereoTypeModel(webBeansContext, stereoClass);
                         stereoTypeManager.addStereoTypeModel(model);
                     }
+                    verifiedStereotypes.add(stereoClass);
                 }
             }
         }
@@ -1614,6 +1621,7 @@ public class BeansDeployer
         logger.fine("Checking StereoType constraints has ended.");
     }
 
+
     /**
      * Adds default stereotypes.
      */



Mime
View raw message