If it's a setter
method and null
is being passed to it, I think it would make more sense to throw an IllegalArgumentException
. A NullPointerException
seems to make more sense in the case where you're attempting to actually use the null
.
So, if you're using it and it's null
, NullPointer
. If it's being passed in and it's null
, IllegalArgument
.