that would indeed be a bug in this case. For the long term, I'd like to completely split our dependent proxies from the proxies we need because of @NormalScoped. The problem is that according to the spec @PreDestroy methods might be intercepted. Not sure if we have this correctly implemented atm.
LieGrue, strub --- On Sat, 6/4/11, Eric Covener <[email protected]> wrote: > From: Eric Covener <[email protected]> > Subject: Re: svn commit: r1079926 - > /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java > To: [email protected] > Date: Saturday, June 4, 2011, 10:41 AM > 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, <[email protected]> > 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 > [email protected] >
