[weld-issues] [JBoss JIRA] Created: (WELD-705) Changes made to a superclass's AnnotatedType by extensions not taken into account while sending ProcessAnnotatedType events pertaining to the subclass

Sivakumar Thyagarajan (JIRA) jira-events at lists.jboss.org
Wed Oct 6 00:48:39 EDT 2010


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

                 Key: WELD-705
                 URL: https://jira.jboss.org/browse/WELD-705
             Project: Weld
          Issue Type: Bug
          Components: Bootstrap and Metamodel API
    Affects Versions: 1.1.0.Beta1
         Environment: Jersey extension in GlassFish faces this issue
            Reporter: Sivakumar Thyagarajan
             Fix For: 1.1.0.Beta2


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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list