Effective Java Second Edition by Josh Bloch describes in "Item 60: Favor the use of standard exceptions":
"Argument, all erroneous method invocations boil down to an illegal argument or an illegal state, but other exceptions are standardly used for certain kinds of arguments or states. If a caller passes null in some parameter for which null values are prohibited, convention dictates that NullPointerException be thrown rather than IllegalArgumentException"
I do recommend everyone to buy a copy of the book, read it at least once from cover to cover and reread it after a few years.
--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Effective Java is as close to a standard as we have.
We don't like perpetuating a "there are two ways to do this" situation.
The arguments in that stack overflow thread in favour of using IAE instead of NPE are typical idiotic sky is falling fodder. If only out of principle, this means NPE wins. Example:
" Agree with Thorbjorn, do yourself a favor and avoid debugging hell."
Oh, yup, somebody found a religion here. I'd there a Godwin's for usage of "hell"?
--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.
Effective Java is the bible we use. This IS a holy war which by definition means there is no provably right answer, we have to pick a side and accept that a large number of people are unhappy no matter which side we pick.
NPE wins because (A) Effective Java says so, and "when in doubt, follow EJ" is a convenient fallback, and (B) the current version of Lombok uses NPE already. No need to rock the boat if the alternative is not better, just different.
We could create a conf key, I guess. I'll talk it over with Roel.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.