Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2176

Weld fails to call disposal method for instances created by static producer method/field

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.3.4.Final, 3.0.0.Alpha16
    • Fix Version/s: 2.3.5.Final, 3.0.0.Alpha17
    • Component/s: None
    • Labels:
      None

      Description

      When you have something like this:

      public class FooDisposal { 
       
          @Produces
          @Tame
          static Foo foo() {
              return new Foo();
          }
       
          public void disposeFoo(@Disposes @Tame Foo foo) {
              System.out.println("------------------------------------- DISPOSED");
          }
      }
      

      then Weld silently fails with following message in log:

      19:26:21,933 ERROR [org.jboss.weld.Bean] (default task-17) WELD-000019: Error destroying an instance org.jboss.cdi.tck.tests.implementation.disposal.method.definition.broken.enterprise.remoteMethod.Foo@17bc197a of Producer Method [Foo] with qualifiers [@Tame @Any] declared as [[BackedAnnotatedMethod] @Produces @Tame static org.jboss.cdi.tck.tests.implementation.disposal.method.definition.broken.enterprise.remoteMethod.FooDisposal.foo()]
      

      I guess the underlying problem is NPE coming from https://github.com/weld/core/blob/master/impl/src/main/java/org/jboss/weld/injection/producer/AbstractMemberProducer.java#L132 but that's just a guess.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mkouba Martin Kouba
                  Reporter:
                  tremes Tomas Remes
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: