harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry M. Kononov" <dmitry.m.kono...@gmail.com>
Subject Re: [classlib] matching RI exceptions -- are we required to have this type of compatibility?
Date Tue, 25 Apr 2006 08:32:06 GMT
On 4/25/06, Tim Ellison <t.p.ellison@gmail.com> wrote:
> Jimmy, Jing Lv wrote:
> > I agree.
> > But there are at least two exceptional situation:
> > 1) several exceptions throws from one method, which extend one parent
> > class, e.g. ConnectionException and UnknownHostException, javadoc writes
> > "throws IOException" rather than "throws
> > ConnectionException,UnknownHostException". And in implementation, we
> > shall throw them out directly instead of
> > try{...
> > }catch(UnknownHostException e){
> >     throw new IOException();
> > }
> > catch(ConnectionException e){
> >     throw new IOException();
> > }
> > right? :)
>
> +1, and other instances where super-types or super-interfaces declare
> compatible throws clauses that are implemented in subclasses that throw
> more specific subtypes.  I do not agree that we should be bound to throw
> and exception of the identical type as the declaration.

If we want to follow the spec and if we want to restrain ourself from
"improving" the spec, I think we really need to throw IOException. If
this exception can be caused by different ways we apparently have to
throw IOException with an appropriate cause.

Thanks.
--
Dmitry M. Kononov
Intel Managed Runtime Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message