Hi Shawn! Missed this patch in JIRA. Feel free to post anytime you have a patch for review.
On Jun 13, 2010, at 12:22 AM, Shawn Jiang (JIRA) wrote: >> callback method search is not considering the overriding rule. >> -------------------------------------------------------------- >> >> Key: OPENEJB-1299 >> URL: https://issues.apache.org/jira/browse/OPENEJB-1299 >> Project: OpenEJB >> Issue Type: Bug >> Components: container system >> Affects Versions: 3.1.3 >> Environment: 3.1.3-snapshot , geronimo 2.2.1 jetty release >> Reporter: Shawn Jiang >> Attachments: OPENEJB-1299.diff >> >> >> Considering following scenario: >> Bean is a EJB, BeanSuper is the Bean's super class. >> BeanSuper { >> @PostConstruct >> private void postConstructMethodInBeanSuper() throws RuntimeException { >> System.out.println( " post construct method in bean super") >> } >> } >> @Stateless(name="Bean") >> Bean extends BeanSuper { >> protected void postConstructMethodInBeanSuper() throws RuntimeException { >> System.out.println( " post construct method in bean") >> } >> } >> When container invoke the @postconstruct callback method. It should call >> BeanSuper#postConstructMethodInBeanSuper() instead of >> Bean#postConstructMethodInBeanSuper() because >> BeanSuper#postConstructMethodInBeanSuper() is a private method that can't be >> overridden. Good catch! I went a head and whipped up a little test case for this: http://svn.apache.org/repos/asf/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/stateful/CallbackOverridesTest.java All the existing override logic is done in the InterceptorBindingBuilder class. We could probably improve that logic to be sensitive of the fact that the target method may be a private method, in which case we don't need to apply the override concept. -David
