Often times when writing programs, I come across a NullPointerException
that I didn't expect. I often spend forever finding what exactly is null
, only to find out that it was a simple oversight in my part.
What I want to know is: why NullPointerException
isn't generic.
for example:
java.lang.NullPointerException<(Class of object that is null)>
at (Stack trace)
instead of:
java.lang.NullPointerException
at (Stack trace)
To me, this would considerably reduce the time spent debugging and seems like it wouldn't be hard to implement.
Incidentally, how exactly do catch
blocks work with generic exceptions anyway?