openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1629585 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/BeansDeployer.java container/InjectionResolver.java
Date Mon, 06 Oct 2014 07:51:04 GMT
Author: rmannibucau
Date: Mon Oct  6 07:51:04 2014
New Revision: 1629585

URL: http://svn.apache.org/r1629585
Log:
validating injection point later

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.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=1629585&r1=1629584&r2=1629585&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 Oct  6 07:51:04 2014
@@ -664,6 +664,8 @@ public class BeansDeployer
      */
     private <T, B extends Bean<?>> void validate(Collection<B> beans)
     {
+        webBeansContext.getBeanManagerImpl().getInjectionResolver().clearCaches();
+
         if (beans != null && beans.size() > 0)
         {
             Stack<String> beanNames = new Stack<String>();

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=1629585&r1=1629584&r2=1629585&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Mon Oct  6 07:51:04 2014
@@ -171,54 +171,55 @@ public class InjectionResolver
         WebBeansUtil.checkInjectionPointNamedQualifier(injectionPoint);
 
         Type type = injectionPoint.getType();
-        Class<?> clazz;
-
         if (ClassUtil.isTypeVariable(type))
         {
             throw new WebBeansConfigurationException("Injection point type : " + injectionPoint
+ " type can not be defined as Typevariable or Wildcard type!");
         }
 
-        if (type instanceof ParameterizedType)
+        if (webBeansContext.getBeanManagerImpl().isAfterBeanDiscoveryFired())
         {
-            ParameterizedType pt = (ParameterizedType) type;
+            Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
+            qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
 
-            clazz = (Class<?>) pt.getRawType();
-        }
-        else
-        {
-            clazz = (Class<?>) type;
-        }
-
-        Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
-        qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
-
-        // OWB-890 some 3rd party InjectionPoints return null in getBean();
-        Class<?> injectionPointClass = Object.class; // the fallback
-        Bean injectionPointBean = injectionPoint.getBean();
-        if (injectionPointBean != null)
-        {
-            injectionPointClass = injectionPointBean.getBeanClass();
-        }
-        if (injectionPointClass == null && type instanceof Class)
-        {
-            injectionPointClass = (Class) type;
-        }
+            // OWB-890 some 3rd party InjectionPoints return null in getBean();
+            Class<?> injectionPointClass = Object.class; // the fallback
+            Bean injectionPointBean = injectionPoint.getBean();
+            if (injectionPointBean != null)
+            {
+                injectionPointClass = injectionPointBean.getBeanClass();
+            }
+            if (injectionPointClass == null && type instanceof Class)
+            {
+                injectionPointClass = (Class) type;
+            }
 
-        Set<Bean<?>> beanSet = implResolveByType(injectionPoint.isDelegate(),
type, injectionPointClass, qualifiers);
+            Set<Bean<?>> beanSet = implResolveByType(injectionPoint.isDelegate(),
type, injectionPointClass, qualifiers);
 
-        if (beanSet.isEmpty())
-        {
-            if (qualifiers.length == 1 && qualifiers[0].annotationType().equals(New.class))
+            if (beanSet.isEmpty())
             {
-                createNewBean(injectionPoint, type, qualifiers, beanSet);
+                if (qualifiers.length == 1 && qualifiers[0].annotationType().equals(New.class))
+                {
+                    createNewBean(injectionPoint, type, qualifiers, beanSet);
+                }
             }
-        }
 
-        Bean<?> bean = resolve(beanSet);
+            Bean<?> bean = resolve(beanSet);
 
-        if (bean == null)
-        {
-            InjectionExceptionUtil.throwUnsatisfiedResolutionException(clazz, injectionPoint,
qualifiers);
+            if (bean == null)
+            {
+                Class<?> clazz;
+                if (type instanceof ParameterizedType)
+                {
+                    ParameterizedType pt = (ParameterizedType) type;
+
+                    clazz = (Class<?>) pt.getRawType();
+                }
+                else
+                {
+                    clazz = (Class<?>) type;
+                }
+                InjectionExceptionUtil.throwUnsatisfiedResolutionException(clazz, injectionPoint,
qualifiers);
+            }
         }
     }
 



Mime
View raw message