Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-598

Clarify what happens if one of the interceptors in the AroundConstruct chain does not invoke InvocationContext.proceed()

XMLWordPrintable

    • Icon: Clarification Clarification
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 1.2.Final
    • Interceptors
    • None

      The interceptors spec only states (2.2 Interceptor Life Cycle):

      If the InvocationContext.proceed method is not invoked by an interceptor method, the target instance will not be created.

      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.

              Unassigned Unassigned
              mkouba@redhat.com Martin Kouba
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: