Aha got it.
But then the test should be challenged, I suppose.

cheers

On Fri, May 18, 2012 at 2:17 PM, Mark Struberg <[email protected]> wrote:

>
>
> Hi Nikolai!
>
> Congratulations, you went pretty deep already ;)
>
> please consider the following situation:
>
> @Dependent
> public class OuterBean {
>   private @Inject SomeNotSerializableBean s;
>
>   @Produces @SessionScoped
>   public User createUser() {
>     return getUserFromDatabase();
>   }
> }
>
> When somewhere in a code a
>
> private @Inject User u;
> u.getName();
>
> gets executed, the container will create the Contextual Instance for the
> user (if there is none in the session already -> 'SessionSingleton').
> For doing so the container will
>
> a.) create a OuterBean o
> b.) invoke the o.createUser(); method and store the created User in the
> SessionContext.
> c.) IMPORTANT! As OuterBean is @Dependent, it will IMMEDIATELY destroyed
> after createUser() returns! See 6.4.2:
> "any @Dependent scoped contextual instance created to receive a producer
> method, producer field, disposer method or
> observer method invocation is destroyed when the invocation completes, and
> ..." It might not be 100% clear if this means only the parameters of the
> producer method or also the containing bean as well though ... I remember
> that I talked about this with Pete a year or so ago and I think Weld also
> destroys the OuterBean immediately.
>
> So why the hack should we check if OuterBean is Serializable or not? It
> does NOT end up in the CreationalContext of the User u anyway. At least not
> if we assume the outlined interpretation of the spec ;)
>
> LieGrue,
> strub
>
>
> ----- Original Message -----
> > From: Nikolai Dokovski <[email protected]>
> > To: [email protected]
> > Cc:
> > Sent: Friday, May 18, 2012 12:52 PM
> > Subject: Passivation dependencies of producer method are not validated
> >
> > Hi,
> > I got JSR 299 TCK (webprofile) running with tomcat and openwebbeans-1.1.4
> > and there is one other test that fails
> > PassivatingProducerMethodWithNonPassivatingParameterTest
> >
> > The case is simple: The container should respond with deployment
> exception
> > when there is bean in passivating scope with dependencies which are not.
> > After short debug session I ended up to invocation of
> > AbstractProducerBeans.validatePassivationDependencies which is left emty
> > (no implementation)
> > with the following comments:
> > // don't call super.validatePassivationDependencies()!
> > // the injection points of producers are the parameters of the
> > producermethod.
> > // since CDI-1.1 we must not check those for is serializable anymore.
> >
> > Is there any particular reason for not implementing this or the check is
> > performed elsewhere?
> >
> > Regards
> > Nikolai
> >
>

Reply via email to