openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1797925 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/BeansDeployer.java container/BeanManagerImpl.java
Date Wed, 07 Jun 2017 13:40:00 GMT
Author: struberg
Date: Wed Jun  7 13:40:00 2017
New Revision: 1797925

URL: http://svn.apache.org/viewvc?rev=1797925&view=rev
Log:
OWB-1182 fix Delegate Injection and Decorator enablement

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/BeanManagerImpl.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=1797925&r1=1797924&r2=1797925&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
Wed Jun  7 13:40:00 2017
@@ -266,11 +266,12 @@ public class BeansDeployer
                     registerAlternativesDecoratorsAndInterceptorsWithPriority(at);
                 }
 
-                addAdditionalAnnotatedTypes(fireAfterTypeDiscoveryEvent(), globalBdaAnnotatedTypes);
-
                 // Also configures deployments, interceptors, decorators.
                 deployFromXML(scanner);
 
+                addAdditionalAnnotatedTypes(fireAfterTypeDiscoveryEvent(), globalBdaAnnotatedTypes);
+
+
                 final Map<BeanArchiveInformation, Map<AnnotatedType<?>, ExtendedBeanAttributes<?>>>
beanAttributesPerBda
                     = getBeanAttributes(annotatedTypesPerBda);
 
@@ -781,9 +782,11 @@ public class BeansDeployer
         Collections.reverse(interceptors);
         Collections.reverse(decorators);
         Collections.reverse(alternatives);
+
         final AfterTypeDiscoveryImpl event = new AfterTypeDiscoveryImpl(webBeansContext,
newAt,
                 interceptors, decorators, alternatives);
         manager.fireLifecycleEvent(event);
+
         // reverse to keep "selection" order - decorator and interceptors considers it in
their sorting.
         // NOTE: from here priorityClass.getSorted() MUST NOT be recomputed (ie no priorityClass.add(...))
         Collections.reverse(alternatives);
@@ -799,7 +802,6 @@ public class BeansDeployer
             newAt.add(at);
         }
 
-
         event.setStarted();
 
         // we do not need to set back the sortedAlternatives to the AlternativesManager as
the API

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=1797925&r1=1797924&r2=1797925&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 Jun  7 13:40:00 2017
@@ -649,12 +649,21 @@ public class BeanManagerImpl implements
         //Find the injection point Bean
         Bean<Object> injectedBean = (Bean<Object>)injectionResolver.getInjectionPointBean(injectionPoint);
 
+
         if(WebBeansUtil.isDependent(injectedBean))
         {
             if (!(ownerCreationalContext instanceof CreationalContextImpl))
             {
                 ownerCreationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(ownerCreationalContext,
injectionPoint.getBean());
             }
+
+            if (injectionPoint.isDelegate() && ((CreationalContextImpl<?>)ownerCreationalContext).getDelegate()
!= null)
+            {
+                // this is a dirty hack for Custom Decorators which inject into @Delegate
InjectionPoints
+                // by using getInjectableReference. Done in the TCK. Never seen this for
real though...
+                return ((CreationalContextImpl<?>)ownerCreationalContext).getDelegate();
+            }
+
             ((CreationalContextImpl<?>)ownerCreationalContext).putInjectionPoint(injectionPoint);
             //Using owner creational context
             //Dependents use parent creational context



Mime
View raw message