Re:is it me or is it a bug?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re:is it me or is it a bug?

Mike Cowlishaw-2
If you want to write buggy code, perhaps.   Consider:  the method you call is
declared as raising IOException (that's in the signals list).   You find out
(perhaps by reading the code) that in fact it raises FileNotFoundException, so
that's what you catch.    All is well and good until ...

 ... the writer of that method decides to raise a different Exception (also a
subclass of IOException).  He or she is quite allowed to do that -- it doesn't
change the specification of the method, which is declared to raise IOExceptions.

But now it won't be caught by your catch statement, and could well bring down
your application.    Better for the compiler to let you know early on, perhaps?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mike Cowlishaw, IBM Fellow, IBM UK Laboratories
mailto:[hidden email]   []
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>