openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1623478 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/BeansDeployer.java portable/ProducerMethodProducer.java
Date Mon, 08 Sep 2014 19:18:45 GMT
Author: rmannibucau
Date: Mon Sep  8 19:18:45 2014
New Revision: 1623478

URL: http://svn.apache.org/r1623478
Log:
validating @Disposes injection points

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerMethodProducer.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=1623478&r1=1623477&r2=1623478&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 Sep  8 19:18:45 2014
@@ -61,6 +61,7 @@ import org.apache.webbeans.intercept.Int
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
 import org.apache.webbeans.portable.AbstractProducer;
 import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.portable.ProducerMethodProducer;
 import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
 import org.apache.webbeans.portable.events.ProcessBeanImpl;
 import org.apache.webbeans.portable.events.ProcessSyntheticAnnotatedTypeImpl;
@@ -95,6 +96,7 @@ import javax.enterprise.inject.spi.Decor
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.Interceptor;
 import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.Producer;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
@@ -250,6 +252,7 @@ public class BeansDeployer
                 
                 // Validate injection Points
                 validateInjectionPoints();
+                validateDisposeParameters();
 
                 validateDecoratorGenericTypes();
 
@@ -295,6 +298,26 @@ public class BeansDeployer
         }
     }
 
+    private void validateDisposeParameters()
+    {
+        final WebBeansUtil webBeansUtil = webBeansContext.getWebBeansUtil();
+        for (final Bean<?> bean : webBeansContext.getBeanManagerImpl().getBeans())
+        {
+            if (ProducerMethodBean.class.isInstance(bean))
+            {
+                final Producer<?> producer = ProducerMethodBean.class.cast(bean).getProducer();
+                if (ProducerMethodProducer.class.isInstance(producer))
+                {
+                    final Set<InjectionPoint> disposalIPs = ProducerMethodProducer.class.cast(producer).getDisposalIPs();
+                    if (disposalIPs != null)
+                    {
+                        webBeansUtil.validate(disposalIPs, bean);
+                    }
+                } // else?
+            }
+        }
+    }
+
     // avoid delegate implementing Foo<A> and decorator implementing Foo<B> with
no link between A and B
     private void validateDecoratorGenericTypes()
     {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerMethodProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerMethodProducer.java?rev=1623478&r1=1623477&r2=1623478&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerMethodProducer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerMethodProducer.java
Mon Sep  8 19:18:45 2014
@@ -157,4 +157,9 @@ public class ProducerMethodProducer<T, P
             }
         }
     }
+
+    public Set<InjectionPoint> getDisposalIPs()
+    {
+        return disposalIPs;
+    }
 }



Mime
View raw message