[cdi-dev] [JBoss JIRA] (CDI-519) Instance.destroy() cannot be used for dependent bean instances not created by the same Instance object

Antoine Sabot-Durand (JIRA) issues at jboss.org
Tue May 17 06:10:05 EDT 2016


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

Antoine Sabot-Durand reassigned CDI-519:
----------------------------------------

    Fix Version/s: 2.0-EDR2
                       (was: 2.0 (discussion))
         Assignee: Martin Kouba
       Resolution: Done


> Instance.destroy() cannot be used for dependent bean instances not created by the same Instance object
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CDI-519
>                 URL: https://issues.jboss.org/browse/CDI-519
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>    Affects Versions: 1.2.Final
>            Reporter: Martin Kouba
>            Assignee: Martin Kouba
>             Fix For: 2.0-EDR2
>
>
> 5.6.1. The Instance interface:
> {quote}
> The method destroy() instructs the container to destroy the instance. The bean instance passed to destroy() should be *a dependent scoped bean instance*, or...
> {quote}
> I think this should be more obvious. E.g. this wouldn't work correctly even though it doesn't violate the spec:
> {code:java}
> @Dependent
> class Bar {
> }
> class Foo {
>   @Inject
>   Instance<Bar> instance;
>   void ping() {
>     instance.destroy(CDI.current().select(Bar.class).get());
>   }
> }
> {code}



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


More information about the cdi-dev mailing list