Details
-
Bug
-
Resolution: Cannot Reproduce
-
Major
-
1.0.0.GA
-
None
Description
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); }