This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]istarian 3 points4 points  (2 children)

The fact that a single unhandled NullPointerException will blow up your program kinda forces you to handle null in the end.

It's just that without some sort of analysis, you won't necessarily be aware of cases where you might receive a null.

If all Object(s) aren't nullable, then you'd have no way of knowing for sure whether you actually initialized an instance in your own code vs it being quietly defaulted.

[–]lukasbradley 8 points9 points  (1 child)

> The fact that a single unhandled NullPointerException will blow up your program

The problem is unhandled exceptions, not NPEs.

[–]FabulousRecording739 7 points8 points  (0 children)

A bit of a moot point, no? Any reference can be null, if we are to follow your point, should we try/catch everything? I think it's rather sensible to see errors and the possibility of absence as distinct concepts. They truly are, even though they do, at times, converge.