Submitted On 14-JAN-2004
bonniot
Note that the proposed work-around is partial: it is only
possible when the application explicitely wants to print the
strack. It won't work when the VM itself prints it, for
instance when an exception was uncaught.
Using the default stratum when printing a stack trace seems
the right thing to do. It would make developing with other
languages than Java (e.g. JSP) more friendly.
Submitted On 23-JAN-2004
bonniot
I investigate the proposed workaround consisting of calling
Throwable.getStackTrace() and post-processing the results
to reflect the SourceDebugExtension attribute. As far as I
could see, there is no public API to obtain the
SourceDebugExtension attribute of a given class in the
current JVM, nor to map a line number to relevant
information for a chosen stratum. There is an API in the
Java Debuging API to do those things, but that is only
available when debuging an application, which must be
running in a separate JVM. So this is not appropriate for
the simpler task of rewriting the stack trace information in
a normal application.
If such an API is in fact available, I would be grateful if
sombody could point to it. Otherwise, I think a partial
answer to this request would be to provide it (it must
already be implemented in the JDI, it's just a matter of
providing the right entry point to use it outside of the
debugging mode). It would still be nice if the default
behaviour of printStackTrace was to use the information in
the default stratum.
Note that implementing these changes should not impact in
any way "normal" Java programs, which don't have a
SourceDebugExtension attribute (one only needs to discover
that the class has no such attribute, but that can be
implemented cheaply). So there should be no compatibility or
performance problem with this proposal.
Submitted On 03-FEB-2004
Dan.Jacobs
I think this is critical functionality for any application that
uses Java code generation. Without it, it's nearly
impossible for such an application to provide useful
diagnostics.
Submitted On 09-APR-2006
shivane
Another vote for this.
I agree the implementation is involved, but the way I see it, its better implemented in the platform than by every user of the platform.
Submitted On 10-APR-2006
i agree that its better to have this as a feature in VM, rather than each developer implementing it independently for stackTraces.
Submitted On 27-DEC-2006
spvincent
JSR 45 support seems to be a real poor cousin - Java is an excellent language for code generation, and JSR seems to make it even better: letting debuggers and friends cope nicely.
However, not supporting a standard classfile postprocessor (or supporting SMAP files in javac), and not using the SourceDebugExtension where ever possible seems to really cripple the spec.
Why is this good? It doesn't sound hard to do it properly, and I haven't heard any good reasons why these changes aren't critical.
Submitted On 05-JUN-2008
It seems to me that the JSR-045 is incomplete without this feature.
JSR-045 is quite complex and very-well made, providing a wonderfl easy way to add debug support for any language translating to Java.
It feels a bit clumsy that the JSR-045 participants understood so well the problematic of languages translating to Java and "forgot" to specify that the VM should also use the JSR-045 informations to provide useful stack traces.
Besides, as bonniot quoted in previous comments, the proposed work around does not work and is not acceptable for several reasons.
While I guess that implementing this feature in the VM itself would be quite quick and easy: all the needed informations and code are already there, they just need to be used.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|