You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ar...@apache.org on 2013/01/14 22:08:55 UTC

svn commit: r1433130 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/InterceptorBean.java portable/InjectionTargetImpl.java

Author: arne
Date: Mon Jan 14 21:08:54 2013
New Revision: 1433130

URL: http://svn.apache.org/viewvc?rev=1433130&view=rev
Log:
OWB-755: Fixed InjectionTargetImpl#getConstructor()

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java?rev=1433130&r1=1433129&r2=1433130&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java Mon Jan 14 21:08:54 2013
@@ -33,9 +33,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.exception.WebBeansException;
-import org.apache.webbeans.inject.InjectableConstructor;
 import org.apache.webbeans.util.ExceptionUtil;
 
 /**
@@ -78,12 +76,7 @@ public abstract class InterceptorBean<T>
     @Override
     protected T createComponentInstance(CreationalContext<T> creationalContext)
     {
-        Constructor<T> con = getConstructor();
-        InjectableConstructor<T> ic = new InjectableConstructor<T>(con, getInjectionTarget(), (CreationalContextImpl<T>) creationalContext);
-
-        T instance = ic.doInjection();
-
-        return instance;
+        return getInjectionTarget().produce(creationalContext);
     }
 
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java?rev=1433130&r1=1433129&r2=1433130&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java Mon Jan 14 21:08:54 2013
@@ -34,6 +34,7 @@ import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.spi.AnnotatedConstructor;
 import javax.enterprise.inject.spi.AnnotatedMember;
 import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.InjectionTarget;
@@ -176,11 +177,11 @@ public class InjectionTargetImpl<T> exte
         AnnotatedConstructor<T> constructor = null;
         for (InjectionPoint injectionPoint : getInjectionPoints())
         {
-            if (injectionPoint.getAnnotated() instanceof AnnotatedConstructor)
+            if (injectionPoint.getMember() instanceof Constructor)
             {
                 if (constructor == null)
                 {
-                    constructor = (AnnotatedConstructor<T>) injectionPoint.getAnnotated();
+                    constructor = (AnnotatedConstructor<T>)((AnnotatedParameter<T>)injectionPoint.getAnnotated()).getDeclaringCallable();
                 }
                 else if (!constructor.equals(injectionPoint.getAnnotated()))
                 {
@@ -189,7 +190,14 @@ public class InjectionTargetImpl<T> exte
                 }
             }
         }
-        this.constructor = new AnnotatedConstructorImpl<T>(context, getDefaultConstructor(), type);
+        if (constructor != null)
+        {
+            this.constructor = constructor;
+        }
+        else
+        {
+            this.constructor = new AnnotatedConstructorImpl<T>(context, getDefaultConstructor(), type);
+        }
         return this.constructor;
     }