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

ProcessBeanAttributes fired for producer methods and producer fields has wrong type argument

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0.Alpha1
    • None
    • None
    • None

      The spec (CDI 1.1) states: "The event object must be of type javax.enterprise.inject.spi.ProcessBeanAttributes<T> where T is the bean class of the managed bean or session bean, the return type of the producer method, or the type of the producer field."

      However events fired for producer methods and producer fields are of type javax.enterprise.inject.spi.ProcessBeanAttributes<T> where T is the declaring bean class, not the return type or the type of the field.

      There is also invalid test in weld test suite - VerifyValuesTest. Observer methods in VerifyingExtension:

      void observeBravo(@Observes ProcessBeanAttributes<BravoProducer> event) {
      bravo = event.getBeanAttributes();
      }
      
      void observeCharlie(@Observes ProcessBeanAttributes<CharlieProducer> event) {
      charlie = event.getBeanAttributes();
      }
      

      should be replaced with:

      void observeBravo(@Observes ProcessBeanAttributes<Bravo> event) {
      bravo = event.getBeanAttributes();
      }
      
      void observeCharlie(@Observes ProcessBeanAttributes<Charlie> event) {
      charlie = event.getBeanAttributes();
      }
      

            rhn-engineering-jharting Jozef Hartinger
            mkouba@redhat.com Martin Kouba
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: