[2037] in java-interest
Re: throws declataration in Java/beta
daemon@ATHENA.MIT.EDU (Michael Lorton)
Fri Sep 22 07:08:20 1995
Date: Thu, 21 Sep 1995 09:44:10 -0700
From: Michael Lorton <mlorton@eshop.com>
To: java-interest@java.Eng.Sun.COM
In-Reply-To: <199509210617.XAA14046@blob.best.net> (pambrose@weblogic.com)
> In beta Java, if object A extends object B, and both implement method
> foo(), A.foo() *cannot* throw exception X unless B.foo() also
> throws X. If you declare that A.foo() throws X, the compiler
> will complain that B doesn't also throw X.
>
> This means that you can NEVER throw an exception from a
> toString() method because Object.toString() doesn't throw
> any exceptions.
>
> Is this correct?
>
> Paul
I have no inside knowledge, but it seems correct to me. Otherwise,
you would be severely changing the interface. No method could depend
on the throw-list of any of its arguments, or of any object returns by
a method from another class.
M.
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com