> From: Aaron M. Renn [mailto:[EMAIL PROTECTED]]
>
> >I declared an @exception clause, but I removed the throws
> >NullPointerException part from all of them.
>
> I recommend against declaring that a method throws exceptions from
> java.lang.  (Javadoc'ing them is probably good though, but perhaps things
> like NullPointerException are a bit overkill).  If you put them in the
> method decl, then the compiler will force any callers to catch them or
> declare that they throw the method instead of allowing them to propagate
> upward silently as normal.
>

I agree completely.  The decision is completely out of our hands, though; we
need to throw exactly the same exceptions as Java 2, so that stuff compiled
against us will work as expected on Sun, and vice versa.  In most cases
NullPointerException is not thrown (I am unaware of any, but the possibility
remains).

I think that declaring even NullPointerException in the JavaDoc is a good
idea, because there are some cases where we just ignore the argument if it
is null.

--John Keiser

Reply via email to