[cdi-dev] [JBoss JIRA] (CDI-284) Clarify AlterableContext corner cases

Jozef Hartinger (JIRA) jira-events at lists.jboss.org
Mon Oct 29 04:19:01 EDT 2012

Jozef Hartinger created CDI-284:

             Summary: Clarify AlterableContext corner cases
                 Key: CDI-284
                 URL: https://issues.jboss.org/browse/CDI-284
             Project: CDI Specification Issues
          Issue Type: Clarification
          Components: Contexts, Resolution
    Affects Versions: 1.1.PRD
            Reporter: Jozef Hartinger
            Assignee: Pete Muir
             Fix For: 1.1 (Proposed)

There are some corner cases that are not well specified and should be improved:

h3. Dependent scope
The context for the @Dependent scope (DependentContext hereafter) is required to implement the AlterableContext interface. However, it is not possible to properly execute the DependentContext.destroy() method since the CreationalContext is not known.

h3. Context not active
The Javadoc for AlterableContext should say that the methods throws ContextNotActiveException if the method is invoked on a Context that is not active.

h3. reflect CDI-24
The spec should require the container to use a serializable Contextual not only for Context.get() methods but also for AlterableContext.destroy()

h3. Illegal arguments
I am wondering whether the spec should be more strict and require better validation of AlterableContext.destroy() and Instance.destroy() parameters.

For example:
instance.destroy(new Object());

should probably be considered an illegal argument. That would at least be expected by users I guess. On the other hand, such validation would disallow certain optimizations that a container may currently do (e.g. keeping only those references to dependent objects that require cleanup on destruction)

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

More information about the cdi-dev mailing list