[
https://issues.apache.org/jira/browse/TAPESTRY-2146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Howard M. Lewis Ship closed TAPESTRY-2146.
------------------------------------------
Resolution: Won't Fix
Assignee: Howard M. Lewis Ship
Your best bet is to make your lifecycle methods final in the base class. That
removes the ambiguity.
> Duplicated calls with base class lifecycle methods
> --------------------------------------------------
>
> Key: TAPESTRY-2146
> URL: https://issues.apache.org/jira/browse/TAPESTRY-2146
> Project: Tapestry
> Issue Type: Bug
> Components: Core Components
> Affects Versions: 5.0.9
> Reporter: angerclown
> Assignee: Howard M. Lewis Ship
>
> When using a base class with a component, any lifecycle method (pageDetached,
> pageLoaded, activate, etc) call is duplicated. The core issue seems to be
> that both the base class and the page class are enhanced to make calls to
> lifecycle methods and the page class is then calling super.
> For example:
> package test.base;
> public class TestBase {
> public void pageDetached() {
> System.out.println("Base Detached");
> }
> }
> package test.pages;
> public class Test extends TestBase {
> @Override
> public void pageDetached() {
> super.pageDetached();
> System.out.println("Detached");
> }
> }
> The output will be:
> Base Detached
> Detached
> Base Detached
> Detached
> Removing the super.pageDetached() call just outputs Detached twice.
> Looking at the source for the both classes (after writing to disk and
> decompiling with jad):
> Base Class
> public void containingPageDidDetach()
> {
> Object obj = null;
> pageDetached();
> }
> Page Class
> public void containingPageDidDetach()
> {
> super.containingPageDidDetach();
> Object obj = null;
> pageDetached();
> }
> This is not right since the event is called once for each page. Either 1)
> the base class should not have these methods enhanced at all or 2) the
> enchanced page method should not call super. Option 1 seems a little more
> natural since that would imply you must make super calls in the non-enhanced
> page classes, i.e. the code you write and expect to call super in anyway.
> With option 2, there would be more "magic" -- you don't call super in your
> page detached method, but super.pageDetached gets called anyway by the
> enhanced class when the event is received.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]