openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1437753 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: annotation/AnnotationManager.java container/BeanManagerImpl.java corespi/scanner/AnnotationDB.java event/EventImpl.java util/ArrayUtil.java
Date Wed, 23 Jan 2013 21:40:41 GMT
Author: struberg
Date: Wed Jan 23 21:40:41 2013
New Revision: 1437753

URL: http://svn.apache.org/viewvc?rev=1437753&view=rev
Log:
OWB-344 use Collections.addAll instead of manual operation

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AnnotationDB.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ArrayUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java?rev=1437753&r1=1437752&r2=1437753&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
Wed Jan 23 21:40:41 2013
@@ -218,11 +218,7 @@ public final class AnnotationManager
                 //check for transitive
                 Annotation[] transitives = getInterceptorBindingMetaAnnotations(ann.annotationType().getDeclaredAnnotations());
 
-                for(Annotation transitive : transitives)
-                {
-                    interAnns.add(transitive);
-                }
-
+                Collections.addAll(interAnns, transitives);
             }
         }
 
@@ -507,11 +503,7 @@ public final class AnnotationManager
 
                 //check for transitive
                 Annotation[] transitives = getTransitiveStereoTypes(ann.annotationType().getDeclaredAnnotations());
-
-                for(Annotation transitive : transitives)
-                {
-                    interAnns.add(transitive);
-                }
+                Collections.addAll(interAnns, transitives);
             }
         }
 

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=1437753&r1=1437752&r2=1437753&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
Wed Jan 23 21:40:41 2013
@@ -646,10 +646,7 @@ public class BeanManagerImpl implements 
         
         if(binding.isAnnotationPresent(InterceptorBinding.class))
         {
-            for(Annotation ann : annotations)
-            {
-                set.add(ann);
-            }            
+            Collections.addAll(set, annotations);
         }
         
         return set;
@@ -812,10 +809,7 @@ public class BeanManagerImpl implements 
         
         if(stereotype.isAnnotationPresent(Stereotype.class))
         {
-            for(Annotation ann : annotations)
-            {
-                set.add(ann);
-            }            
+            Collections.addAll(set, annotations);
         }
         
         return set;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AnnotationDB.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AnnotationDB.java?rev=1437753&r1=1437752&r2=1437753&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AnnotationDB.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AnnotationDB.java
Wed Jan 23 21:40:41 2013
@@ -89,34 +89,7 @@ public class AnnotationDB
         }
     }
 
-    public String[] getIgnoredPackages()
-    {
-        return ignoredPackages;
-    }
-
-    /**
-     * Override/overwrite any ignored packages
-     *
-     * @param ignoredPackages cannot be null
-     */
-    public void setIgnoredPackages(String[] ignoredPackages)
-    {
-        this.ignoredPackages = ignoredPackages;
-    }
 
-    public void addIgnoredPackages(String... ignored)
-    {
-        String[] tmp = new String[ignoredPackages.length + ignored.length];
-        int i = 0;
-        for (String ign : ignoredPackages)
-        {
-            tmp[i++] = ign;
-        }
-        for (String ign : ignored)
-        {
-            tmp[i++] = ign;
-        }
-    }
 
     /**
      * This method will cross reference annotations in the annotation index with any meta-annotations
that they have

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java?rev=1437753&r1=1437752&r2=1437753&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
Wed Jan 23 21:40:41 2013
@@ -24,6 +24,7 @@ import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -100,24 +101,10 @@ public class EventImpl<T> implements Eve
         webBeansContext.getAnnotationManager().checkQualifierConditions(annotations);
 
         Set<Annotation> eventBindings = new HashSet<Annotation>();
-        
-        for(Annotation ann : injectedBindings)
-        {
-            eventBindings.add(ann);
-        }
-        
-        Annotation[] anns = null;
-
-        for (Annotation binding : annotations)
-        {
-            eventBindings.add(binding);
-        }
-
-        anns = new Annotation[eventBindings.size()];
-        anns = eventBindings.toArray(anns);
-
-        return anns;
+        Collections.addAll(eventBindings, injectedBindings);
+        Collections.addAll(eventBindings, annotations);
 
+        return eventBindings.toArray(new Annotation[eventBindings.size()]);
     }
 
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ArrayUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ArrayUtil.java?rev=1437753&r1=1437752&r2=1437753&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ArrayUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ArrayUtil.java
Wed Jan 23 21:40:41 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.webbeans.util;
 
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -93,12 +94,8 @@ public final class ArrayUtil
 
     public static <T> Set<T> asSet(T... items)
     {
-        Set<T> set = new HashSet<T>();
-
-        for(T item : items)
-        {
-            set.add(item);
-        }
+        Set<T> set = new HashSet<T>(items.length);
+        Collections.addAll(set, items);
 
         return set;
     }



Mime
View raw message