Stephen, that's why I thought a static flag would be a compromise, but I don't think it's the best solution. Anyway, the changes I made locally so far are this:
* notNull - throws NPE * isTrue - throws IAE * isValidIndex - throws IOOBE Paul On Sun, Nov 22, 2009 at 6:36 PM, Stephen Colebourne <scolebou...@btopenworld.com> wrote: > Henri Yandell wrote: >> >> On Thu, Nov 19, 2009 at 9:24 AM, Paul Benedict <pbened...@apache.org> >> wrote: >>> >>> On Thu, Nov 19, 2009 at 1:39 AM, Henri Yandell <flame...@gmail.com> >>> wrote: >>> >>>> Your argument being that the JDK and others do NPE when null? i.e. NPE >>>> = IAE(null)? >>> >>> Yes. Some things to note: >>> * The JDK does this as their pattern >>> * JDK 7 definitely encodes this patter in their new Object.notNull() >>> method. >>> * Google Collections -- being a JDK wannabe addition -- does this >>> * Josuha Bloch's "Effective Java" (two editions) has codified this >>> expectation into the minds of developers. >> >> +1 to NPE. > > While I know this is the modern advice, there will be other places where any > NPE is a bug, and thus Validate should throw IAE. > > There are no pretty solutions > - two classes ValidateNPE and ValidateIAE? > - some kind of static flag? > - picking one, and offending the others? > > Stephen > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org