Sure, if there’s no LineNumberTable attribute to lookup into, the stack trace can’t give you a line number…
However why doesn’t the VM spit out the bytecode offset at which the Throwable occurred?
Seems logical if you can’t do the bytecode offset -> line number conversion, then you should just ‘do the best you can’, return the bytecode offset, and the let developer do the rest.
Unless I’m overlooking some VM argument that alters this behavior, potentially useful information is being discarded unnecessarily.
It doesn’t even seem to have been considered when the java.lang.StackTraceElement API was retrofitted in Java 1.4. (StackTraceElement only deals with line numbers, not bytecode offsets)
Anyone else encountered this, and wished for better stack traces?
:edit:
Quick search turned up this:
https://bugs.openjdk.java.net/browse/JDK-4185378
So I guess I’m not the only one…