[jdom-interest] Re: Exception documentation
Alex Rosen
arosen at silverstream.com
Tue Apr 30 09:04:12 PDT 2002
>How to Write Doc Comments goes so far as to say:
>
>"It is considered poor programming practice to include unchecked exceptions
>in the throws clause."
>
>http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#throwstag
>
>I've never read a good explanation why not, but this guideline suits me
just
>fine. It places a clear guideline on the method signature while leaving
>room for editorializing in the javadoc.
I have a vague memory of some old Java compilers that had a problem with
this. If you called a method, it forced you to catch *every* exception
listed in the method's throws clause, even unchecked exceptions. In other
words putting it in the throws clause would basically turn it from an
unchecked exception into a checked exception. Maybe that's where this comes
from.
Alex
More information about the jdom-interest
mailing list