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

Clarify AlterableContext corner cases

    XMLWordPrintable

Details

    • Clarification
    • Resolution: Done
    • Major
    • 1.1.PFD
    • 1.1.PRD
    • Contexts, Resolution
    • None
    • Release Notes

    Description

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

      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.

      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.

      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()
      https://issues.jboss.org/browse/CDI-24

      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)

      Attachments

        Issue Links

          Activity

            People

              pmuiratbleepbleep Pete Muir (Inactive)
              rhn-engineering-jharting Jozef Hartinger
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: