I'm looking at an issue and have a question about this area of the code. I'm working with a dependent bean that has interceptors, so it is proxied.
It seems to me like the final argument of CreationalContextImpl#addDependent() is meant to be a contextual instance -- something suitable to be returned from Contextual.create() or Contextual.destroy(). The same things that should only ever directly be pulled from a Context. In this case though, it seems like at injection time we're passing not a contextual instance, but a contextual reference (e.g. our own javassist proxy) like we'd inject or provide via a call to BeanManager.getReference(). This will cause us to later call Contextual.destroy() on a proxy/reference instead of a contextual instance itself. Does the adding of dependents need to be pushed down into places where Contextual.create() is really called? Can anyone shed some light on this? On Wed, Mar 9, 2011 at 1:44 PM, <strub...@apache.org> wrote: > Author: struberg > Date: Wed Mar 9 18:44:04 2011 > New Revision: 1079926 > > URL: http://svn.apache.org/viewvc?rev=1079926&view=rev > Log: > OWB-542 oops, something went wrong with the revert. all fixed now ;) > > Modified: > > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java > > Modified: > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java > URL: > http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=1079926&r1=1079925&r2=1079926&view=diff > ============================================================================== > --- > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java > (original) > +++ > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java > Wed Mar 9 18:44:04 2011 > @@ -37,6 +37,7 @@ import org.apache.webbeans.component.Inj > import org.apache.webbeans.component.InstanceBean; > import org.apache.webbeans.component.OwbBean; > import org.apache.webbeans.container.InjectionResolver; > +import org.apache.webbeans.context.creational.CreationalContextImpl; > import org.apache.webbeans.context.creational.DependentCreationalContext; > import org.apache.webbeans.util.ClassUtil; > import org.apache.webbeans.util.WebBeansUtil; > @@ -138,6 +139,15 @@ public abstract class AbstractInjectable > } > } > > + // add this dependent into bean dependent list > + if (!WebBeansUtil.isStaticInjection(injectionPoint) && > WebBeansUtil.isDependent(injectedBean)) > + { > + if(instanceUnderInjection.get() != null) > + { > + > ((CreationalContextImpl<?>)this.injectionOwnerCreationalContext).addDependent(instanceUnderInjection.get(),injectedBean, > injected); > + } > + } > + > return injected; > } > > > > -- Eric Covener cove...@gmail.com