This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git

commit 9e5237f72aad9905f3a6c6c8a356181d828dde98
Author: Mark Struberg <[email protected]>
AuthorDate: Sun Feb 28 19:14:40 2021 +0100

    improve handling of non existing beans
---
 .../org/apache/webbeans/container/InjectionResolver.java     | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
 
b/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
index 8154c30..5a5ec46 100644
--- 
a/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
+++ 
b/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
@@ -592,6 +592,12 @@ public class InjectionResolver
 
     private Set<Bean<?>> findByBeanType(Set<Bean<?>> allComponents, Type 
injectionPointType, boolean isDelegate)
     {
+        if (allComponents == null || allComponents.isEmpty())
+        {
+            // fast path
+            return allComponents;
+        }
+
         Set<Bean<?>> resolved = new HashSet<>();
         for (Bean<?> bean : allComponents)
         {
@@ -789,6 +795,12 @@ public class InjectionResolver
      */
     private Set<Bean<?>> findByQualifier(Set<Bean<?>> remainingSet, Type type, 
Annotation... annotations)
     {
+        if (remainingSet == null || remainingSet.isEmpty())
+        {
+            // fast path
+            return remainingSet;
+        }
+
         Iterator<Bean<?>> it = remainingSet.iterator();
         Set<Bean<?>> result = new HashSet<>();
 

Reply via email to