On Tue, Aug 31, 2010 at 7:57 PM, Paul Stanton <p...@mapshed.com.au> wrote: > I've found a strange issue with the @SetupRender annotation when used in a > class hierarchy. > > Typically, in java 2 classes within a hierarchy can have the same signature > for a private method and not effect each other, so I would expect this to be > the case when both of these private methods are annotated with @SetupRender. > Therefore the output for case 1 and case 2 (below) should be the same and > print both messages "setupRender2", "setupRender1". > > However case 1 only prints "setupRender2" meaning it somehow overwrites the > method in it's implementing class. > > This is concerning because > 1. there should never be a requirement that a sub-class knows of it's > super-classes implementation > 2. if hierarchy does come into play, the subclass should override the super > class. > > CASE 1: > ------------------ > public abstract class StartBase { > @SetupRender > private void init() { > log.debug("setupRender2"); > } > } > > public class Start extends StartBase { > @SetupRender > private void init() { > log.debug("setupRender1"); > } > }
I think you are correct; it should invoke StartBase.init(), then Start.init(), following the rule that parent class render event methods are invoked before subclass render event methods. Which release of Tapestry are you using? I believe what's happening is that Tapestry is interpreting Start.init() as an override of StartBase.init() .... the methods have the same signature. Tapestry will effectively ignore the subclass method because it will be invoked by the base class (again, the rule about base class methods coming before subclass methods). However, in this case, it is not correct. Because the method is private, it is never an override of a base class method and should not be ignored. Please add a JIRA issue. > > CASE 2: > ------------------ > public abstract class StartBase { > @SetupRender > private void init2() { > log.debug("setupRender2"); > } > } > > public class Start extends StartBase { > @SetupRender > private void init1() { > log.debug("setupRender1"); > } > } > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org