openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1776472 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanAttributesImpl.java
Date Thu, 29 Dec 2016 19:30:36 GMT
Author: struberg
Date: Thu Dec 29 19:30:36 2016
New Revision: 1776472

URL: http://svn.apache.org/viewvc?rev=1776472&view=rev
Log:
OWB-1164 further improve performance

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanAttributesImpl.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanAttributesImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanAttributesImpl.java?rev=1776472&r1=1776471&r2=1776472&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanAttributesImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanAttributesImpl.java
Thu Dec 29 19:30:36 2016
@@ -20,10 +20,10 @@ package org.apache.webbeans.component.th
 
 import org.apache.webbeans.annotation.AnyLiteral;
 import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.util.SingleItemSet;
 
 import javax.enterprise.inject.spi.BeanAttributes;
 import java.lang.annotation.Annotation;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -45,15 +45,21 @@ class ThirdpartyBeanAttributesImpl<T> ex
 
     private Set<Annotation> calculateQualifiers(final BeanAttributes<T> beanAttributes)
     {
-        final Set<Annotation> originalQualifiers = beanAttributes.getQualifiers() ==
null ?
-                Collections.<Annotation>emptySet() : beanAttributes.getQualifiers();
-        if (originalQualifiers.contains(AnyLiteral.INSTANCE))
+        Set<Annotation> originalQualifiers = beanAttributes.getQualifiers();
+        if (originalQualifiers != null && originalQualifiers.contains(AnyLiteral.INSTANCE))
         {
             return originalQualifiers;
         }
 
-        final Set<Annotation> newQualifiers = new HashSet<>(originalQualifiers);
-        newQualifiers.add(AnyLiteral.INSTANCE);
-        return newQualifiers;
+        if (originalQualifiers != null)
+        {
+            Set<Annotation> newQualifiers = new HashSet<>(originalQualifiers);
+            newQualifiers.add(AnyLiteral.INSTANCE);
+            return newQualifiers;
+        }
+        else
+        {
+            return new SingleItemSet<Annotation>(AnyLiteral.INSTANCE);
+        }
     }
 }



Mime
View raw message