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

Changes made to a superclass's AnnotatedType by extensions not taken into account while sending ProcessAnnotatedType events pertaining to the subclass

XMLWordPrintable

    • Hide

      Netbeans project attached to reproduce the issue

      Show
      Netbeans project attached to reproduce the issue

      It appears that Weld does not take into account changes made to a superclass's AnnotatedType by extensions, when sending ProcessAnnotatedType events pertaining to the subclass.

      Please find attached a netbeans project that demonstrates the problem. It is a web app containing a CDI extension that patches the annotated types it sees to remove all their fields.

      BeanOne has one field:
      @Inject BeanManager beanManager;

      BeanTwo extends BeanOne and doesn't add any fields.

      There are no other injection points. The portable extensions patches the annotated type for BeanOne and removes the BeanManager injection point. However on execution, this output appears in the server log: (all the diagnostic output is at warning level...)
      ===
      WARNING: Handling BeforeBeanDiscovery event
      WARNING: Handling ProcessAnnotatedType event for beans.BeanOne
      WARNING: type has 0 fields
      WARNING: replaced annotated type for class beans.BeanOne
      WARNING: Handling ProcessAnnotatedType event for beans.BeanTwo
      WARNING: type has 0 fields
      WARNING: replaced annotated type for class beans.BeanTwo
      WARNING: Handling ProcessManagedBean event for beans.BeanTwo
      WARNING: found injection point interface javax.enterprise.inject.spi.BeanManager @javax.enterprise.inject.Default()
      WARNING: Handling ProcessManagedBean event for beans.BeanOne
      ===

      I.e. in BeanOne the field has been correctly nuked, but it comes back in BeanTwo.

      Weld may be holding a reference to the old AnnotatedType for BeanOne as part of its internal representation for BeanTwo and uses that instead of the replacement provided by the extension. Since annotated types are self-contained, so Weld should not even look at BeanOne at that point.

      The same behavior can be observed on both GF 3.0.1 (=WELD-000900 1.0.1 (SP3)) and GF 3.1-b16 (=WELD-000900 1.1.0.01 (glassfish)).

      A glassfish issue tracking this Jersey extension problem is at https://glassfish.dev.java.net/issues/show_bug.cgi?id=13132

        1. WebApplication1.tgz
          17 kB
          Sivakumar Thyagarajan
        2. WebApplication3.tgz
          16 kB
          Roberto Chinnici

              pmuiratbleepbleep Pete Muir (Inactive)
              sivakumart_jira Sivakumar Thyagarajan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: