[cdi-dev] [JBoss JIRA] (CDI-598) Clarify what happens if one of the interceptors in the AroundConstruct chain does not invoke InvocationContext.proceed()

Martin Kouba (JIRA) issues at jboss.org
Mon Apr 11 09:02:00 EDT 2016


     [ https://issues.jboss.org/browse/CDI-598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Kouba updated CDI-598:
-----------------------------
    Description: 
The interceptors spec only states (2.2 Interceptor Life Cycle):
{quote}
If the InvocationContext.proceed method is not invoked by an interceptor method, *the target instance will not be created*.
{quote}
But it's not clear what does it mean in the context of CDI.

Possible interpretations are:
* {{Contextual.create()}} returns null
* an exception (e.g. {{javax.enterprise.inject.CreationException}}) is thrown

I think the exception is more appropriate. Note that right now only @Dependent producer methods are allowed to return a null value.

By the way, the RI (Weld) currently returns null for beans which have no other interceptors associated and throws NPE for beans which also have other interceptor types associated. Also there is a TCK test which tests the "null" interpretation for a bean with only AroundConstruct interceptors. I'm going to create a separate TCK issue so that the test is redesigned.

  was:
The interceptors spec only states (2.2 Interceptor Life Cycle):
{quote}
If the InvocationContext.proceed method is not invoked by an interceptor method, *the target instance will not be created*.
{quote}
But it's not clear what does it mean in the context of CDI.

Possible interpretations are:
* {{Contextual.create()}} returns null
* an exception (e.g. {{javax.enterprise.inject.CreationException}}) is thrown

I think the exception is more appropriate. Note that right now only @Dependent producer methods are allowed to return a null value.

By the way, the RI (Weld) currently returns null because there is a TCK test which requires this behavior. I'm going to create a separate TCK issue so that the test is redesigned.



> Clarify what happens if one of the interceptors in the AroundConstruct chain does not invoke InvocationContext.proceed()
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CDI-598
>                 URL: https://issues.jboss.org/browse/CDI-598
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>          Components: Interceptors
>    Affects Versions: 1.2.Final
>            Reporter: Martin Kouba
>
> The interceptors spec only states (2.2 Interceptor Life Cycle):
> {quote}
> If the InvocationContext.proceed method is not invoked by an interceptor method, *the target instance will not be created*.
> {quote}
> But it's not clear what does it mean in the context of CDI.
> Possible interpretations are:
> * {{Contextual.create()}} returns null
> * an exception (e.g. {{javax.enterprise.inject.CreationException}}) is thrown
> I think the exception is more appropriate. Note that right now only @Dependent producer methods are allowed to return a null value.
> By the way, the RI (Weld) currently returns null for beans which have no other interceptors associated and throws NPE for beans which also have other interceptor types associated. Also there is a TCK test which tests the "null" interpretation for a bean with only AroundConstruct interceptors. I'm going to create a separate TCK issue so that the test is redesigned.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the cdi-dev mailing list