[2308] in java-interest

home help back first fref pref prev next nref lref last post

Re: throws declataration in Java/beta

daemon@ATHENA.MIT.EDU (Jim Graham)
Fri Sep 29 06:54:07 1995

Date: Fri, 29 Sep 1995 01:45:42 -0700
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: garya@village.org
Cc: java-interest@java@sun.com


> >Only forseen exceptions are generally required to be declared (and
> >therefore need to be caught or explicitly passed on).  Exceptions which
> >are subclasses of RuntimeException or Error - which are not generally
> >part of the API of a given method - don't have to be declared.
> >Exceptions such as IOException, which are part of the natural working
> >domain of many methods, must be declared where they can occur so that
> >callers of that method are aware that the indicated exception is a
> >possible result of calling the method.
> 
> It seems to me that this reasoning has a flaw.
> It assumes that the base class designer can forsee all possible algorithms
> needed by all possible subclasses, and include the necessary exception
> declarations to cover them.  Unfortunately, it can't, which is why the
> whole problem arises.  No base class can forsee anything about the
> mechanisms needed by a subclass to implement a different but functionally
> equivalent or complementary, task.

Can you give a concrete example?  If a subclasser wants to throw a new
kind of exception, then he is most likely trying to fit a round peg into
a square hole...

				...jim
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post