> From: [EMAIL PROTECTED]
>
> "John Keiser" <[EMAIL PROTECTED]> writes:
>
> > 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.
>
> This is not the case.  See section 8.4.4 of the JLS, or write your own
> simple test case.  It's perfectly fine to put unchecked exceptions on
> the throws clause (and putting it on the throws clause does _not_
> cause it to become a checked exception).
>

Point noted and accepted.  Putting a "throws NullPointerException" in there
can only be an issue of style.  The only one it could possibly make a
difference to is a person who is actually reading the code.  I'd argue that
he doesn't need to know that information at the time he is reading it.  He
can get it from the documentation just fine because we'd document it with
@exception.

> > In most cases NullPointerException is not thrown (I am unaware of
> > any, but the possibility remains).
>
> For your Double/Float cases, if the String passed in is null, a
> NullPointerException results.
>

Sorry, should have clarified.  It should have read: "in most cases
NullPointerException is not declared in the throws clause."  We know this
from the JavaDoc, unless they weed out subclasses of RuntimeException.

> > 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.
>
> What?  We should know ahead of time if its possible to throw a
> NullPointerException because of an argument.  If it is, we declare
> that we throw it, if not, then we don't.
>

It should certainly be in the @exception clause in JavaDoc.  And if you want
to put it in the throws clause, I guess it really doesn't matter.  Go for
it.  I'll put your throws clauses back in.  My main objection was that I
thought if you declared it thrown, it would have to be caught.

If it doesn't change the behavior in any way, it's a *style* issue, and one
we haven't decided on and maybe shouldn't.  I don't think putting the throws
clause in either degrades or improves readability or usability of the
program.

If it doesn't help anyone but doesn't hurt anyone either, then I say we just
let people do what they want.  Style issues are divisive in an annoying way.
The time spent on them is disproportionate to their importance.  When I
propose a major change to the VM interface, I *maybe* get one or two people
on this list to say something, but after an offhand remark about commenting
style, *everyone* jumps on the bandwagon.

Sigh.

--John

Reply via email to