[weld-issues] [JBoss JIRA] Created: (WELD-317) SFSB initialization fails to detect injectable initializer methods of super class

Vivek Pandey (JIRA) jira-events at lists.jboss.org
Wed Nov 25 12:40:29 EST 2009


SFSB initialization fails to detect injectable initializer methods of super class 
----------------------------------------------------------------------------------

                 Key: WELD-317
                 URL: https://jira.jboss.org/jira/browse/WELD-317
             Project: Weld
          Issue Type: Bug
          Components: Bootstrap and Metamodel API
    Affects Versions: 1.0.0.GA
         Environment: glassfish v3, jdk6 u15, weld tck 1.0.1
            Reporter: Vivek Pandey


This is regarding org.jboss.jsr299.tck.tests.lookup.injection.enterprise.SessionBeanInjectionOrderingTest. It tests order in which a SFSB's postConstruct and its superclass's initializers are called. Basically the super class's initializer should be called first before the subclass's postConstruct. However there seems to be a bug in Weld, as it  skips the superclass initializer for this SFSB.

@Stateful
public class MegaPoorHenHouse extends PoorHenHouse implements MegaPoorHenHouseLocal
{
     //There is no initializer() method in it, but Weld adds one during bean deploy

    @PostConstruct
    public void postConstruct() {
      //
    }
}

class PoorHenHouse extends HenHouse
{ 
   @Inject
   public void initialize() {
       //
   }
}


Weld does not invoke PoorHenHouse.initialize(). There seems to be a bug there. I think Beans.getInitializerMethods() should start looking for injectable initialize() method starting from the superclass at the end of the chain. 

Looking in to the debugger it seems that during Bean deploy Weld is adding initialize() method to MegaPoorHenHouse. Inside Beans.getInitializerMethods(), when the MegaPoorHenHouse  is processed to find initializer methods it finds the initializer method and adds it to seenMethod list. Since on the MegaPoorHenHouse the intializer() method dynamically added by Weld is not an injection point so its not added to the list of initializedMethods. Latter when the super class PoorHenHouse is processed to find injectable initialize() method isOverridden() returns true, as initialize() method was added to seenMethod list while processing the subclass, and the legitimate intialize() method on the this super class is skipped.

          ===>if (!isOverridden(method, seenMethods))
                  {
                     MethodInjectionPoint<?, ?> initializerMethod = MethodInjectionPoint.of(declaringBean, method);
                     initializerMethods.add(initializerMethod);
                  }



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

        


More information about the weld-issues mailing list