Re: Column numbers in stack trace - enhancement request



Patricia Shanahan wrote:

How about including in NullPointerException the compile time type of the
subexpression that was null?

That's a nice idea, and has the advantage that it requires only limited
modifications (i.e. all within Sun's codebase). Actually NullPointerException
is used rather a lot, and it might be awkward to make /all/ the desirable
changes (e.g. in non-platform code which checks for and throws NPEs), but even
getting a large fraction of the sources to include the desired target class
would help substantially (not only when chained sends are used).

Personally, I think the Sun collection of Throwables suffer from information
underload. Very few of the standard exceptions include sufficient diagnostic
information (e.g. what class was expected and what was found in a
ClassCastException, what index was expected in a ArrayIndexException, and so
on).

Even worse, from my point of view (though I admit it doesn't obviously effect
most people), is that too many runtime exceptions don't contain enough
information to re-start the precise operation. For instance, by the time a
NoSuchMethodError is trapped, the parameters to the method call have been
irretrievably discarded which makes creating worthwhile implementations of
worthwhile languages on a JVM unnecessarily difficult, and also rules out
useful kinds of adaptive software structures.

-- chris


.