There are a couple of reasons:

It adds bloat. Nobody (afaik) really likes these methods, as almost
the same functionality can be achieved by using Application.get() or
Session.get();

The only reason to provide these short hand methods is to allow
binding using property models. For example new PropertyModel(this,
"session.user.name");

By opening up these methods for overriding, the contract is gone.
Components can't rely on the fact that getApplication() does just
that.

The use case you present for doing so is rather thin: there is nothing
preventing you from creating a getMyApplication() method that has the
correct type (as you already say you want to provide the correct type
in your own base classes—just create your own method that has the
correct type).

Martijn

On Wed, May 9, 2012 at 1:51 PM, Christoph Leiter
<[email protected]> wrote:
> Hi,
>
> Component#getApplication() is currently final. Could it be made non-final so
> that I can make use of covariant return types in my base page?
> Component#getSession() - which works the same way - is already non-final.
>
> A similar case could be made for Component#getPage() (which I would override
> in my base panel).
>
> Would that be a bad idea for some reason?
>
>
> Christoph



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

Reply via email to