hi,
Catching illegal arguments and especially potential NPEs as early as
possible is IMHO a Good Thing - don't let errors dribble down the layers
until the bottom drops out somehwere else. Easiest & IMHO most obvious
place to do at least some form of checking would be the setters, and have
them throw an IllegalArgumentException("foo must not be null"), or
whatever is appropriate. Classes without public accessors could have them
protected/private I usually start with private and 'open up' as required).
I've been looking at jlint's (admittedly extremely picky) reports some
more and instead of randomly fixing potential NPEs with if-thens I'd like
to have a more systematic approach that satisfies all and leads to an
overall improvement by defect prevention. This should also improve bug
reports & logging with more meaningful traces.
Other thoughts or ideas?
Holger
This archive was generated by hypermail 2.0.0 : Thu Dec 05 2002 - 08:15:05 EST