There are some corner cases that are not well specified and should be improved:
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.
The Javadoc for AlterableContext should say that the methods throws ContextNotActiveException if the method is invoked on a Context that is not active.
The spec should require the container to use a serializable Contextual not only for Context.get() methods but also for AlterableContext.destroy()
I am wondering whether the spec should be more strict and require better validation of AlterableContext.destroy() and Instance.destroy() parameters.
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)