J
Jacob
A well designed API normaly doesn't accept null as parameter
values, so as a programmer you are forced to test most inputs
against null and throw an IllegalArgumentException in case it
is null. All these cases must be properly documented in the
javadoc section with an appropriate @throws tag.
Likewise in private APIs you would do the same thing but possibly
by using asserts instead of exceptions.
All of this is good and has excellent documentation value, but
it is commonly ommited, in particular by inexperienced developers,
or by experienced developers in a hurry, and it just seams like
an issue that could be better supported by the language itself.
What about attaching a "&" character next to the variable to
indicate that it cannot be null. (Just kidding
Any opinions?
values, so as a programmer you are forced to test most inputs
against null and throw an IllegalArgumentException in case it
is null. All these cases must be properly documented in the
javadoc section with an appropriate @throws tag.
Likewise in private APIs you would do the same thing but possibly
by using asserts instead of exceptions.
All of this is good and has excellent documentation value, but
it is commonly ommited, in particular by inexperienced developers,
or by experienced developers in a hurry, and it just seams like
an issue that could be better supported by the language itself.
What about attaching a "&" character next to the variable to
indicate that it cannot be null. (Just kidding
Any opinions?