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

Instance.destroy() cannot be used for dependent bean instances not created by the same Instance object

XMLWordPrintable

    • Icon: Clarification Clarification
    • Resolution: Done
    • Icon: Major Major
    • 2.0 .Final
    • 1.2.Final
    • None
    • None

      5.6.1. The Instance interface:

      The method destroy() instructs the container to destroy the instance. The bean instance passed to destroy() should be a dependent scoped bean instance, or...

      I think this should be more obvious. E.g. this wouldn't work correctly even though it doesn't violate the spec:

      @Dependent
      class Bar {
      }
      class Foo {
        @Inject
        Instance<Bar> instance;
        void ping() {
          instance.destroy(CDI.current().select(Bar.class).get());
        }
      }
      

            mkouba@redhat.com Martin Kouba
            mkouba@redhat.com Martin Kouba
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: