> > [...] > >> > >Do you mean that we should do nothing, and let NPE occur "naturally"? > >The origin of the problem might then be difficult to identify. > >Or maybe you meant that we check for null in that case, but throw NPE > >instead of our own MathNullArgument? > >I would be in favor of the second option. On the other hand it's > >difficult to check that it's consistently applied throughout our > >code, > >and I can see your point in doing nothing. > > I meant to do nothing, and even to not document that > NullPointerException can > occur. There are simply too many places when users provide objects > we use later on, > checking everything would be impossible to maintain. > > There are some cases when passing a null reference is allowed, but > they are the > minority. They are so rare that I tend to document these specific > cases only in > the Javadoc, adding a parenthesis "(can be null)" at the end of the > @param. So when > nothing is said, it implicitly means to me "(cannot be null)" and if > I pass null, > I should not be surprised if something bad happens.
+1 [Also to be added in the formatting guidelines.] Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org