Can javac provide an attribute of the attribute "source debug source" of the class?

Java-class file format supports an attribute called "source debug extension" (see. The Java Language Specification and Section 4.7.11, "Attribute SourceDebugExtension" ).

In JVMs supporting this aspect of the JVMTI, you can query this string using jvmtiError GetSourceDebugExtension(jvmtiEnv *, jclass, char **).

My question is whether there is a way to use plain javacand Java to insert source information about the debug source in the file .class. There are no annotations on the Java kernel that would do this (there are no obvious candidates in the "All known class implementations" list in javadoc forjava.lang.Annotation ).

+4
source share
1 answer

This attribute was added by JSR 45 to support debugging in languages ​​other than Java. The JVM itself does not use the attribute value; it is intended for debugging tools. The latest version of this JSR describes the motivation for the attribute SourceDebugExtensionas follows:

SourceDebugExtension Support

, , JavaTM Virtual Machine (SourceFile, LineNumber LocalVariable). . , .

- , ; , .

, , javac - . StackOverflow, JVM SMAP.

0

All Articles