> From: Antonio Gallardo [mailto:[EMAIL PROTECTED]
>
> I was reviewing the cocoon code and found some declared exceptions that
> are not thrown by the methods declared by it.
>
> Sample:
> o.a.c.webapps.authentication.components.DefaultAuthenticationManager
>
> There is a function:
>
>    public void configure(SitemapConfigurationHolder holder)
>     throws ConfigurationException {
>         this.holder = holder;
>     }
>
> But this function does not trows any Exception. We can write:
>
>    public void configure(SitemapConfigurationHolder holder)
>    {
>         this.holder = holder;
>    }
>
> This also works in Cocoon. Can we remove it? I ask because there are other
> similars elsewhere.
>
These are methods defined by interfaces, like in the case above the
Configurable interface. The method declared in that interface
has the "throws" clause in its signature.
You could remove them, but as soon as you start inheriting from such
a class you can't overwrite the method anymore because of signature
problems.
So we should leave the throws clause if it belongs to an interface.
In other cases, we could remove them.

Carsten

Reply via email to