- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
Java 类文件格式支持称为“源调试扩展”的属性(参见 Java language specification §4.7.11 "TheSourceDebugExtension
attribute")。
在支持 JVMTI 这方面的 JVM 中,您可以使用 jvmtiError GetSourceDebugExtension(jvmtiEnv *, jclass, char **)
查询此字符串.
我的问题是是否有办法使用普通的javac
和Java 语言将“源调试扩展”信息嵌入到.class
文件中。在核心 Java 语言中似乎没有注释可以执行此操作(javadoc for java.lang.Annotation
中的“所有已知实现类”列表中没有明显的候选对象)。
最佳答案
该属性是由 JSR 45 添加的支持使用非 Java 语言进行调试。 JVM 本身不使用该属性的值;它用于调试工具。 The final release of that JSR描述 SourceDebugExtension
属性的动机如下:
SourceDebugExtension Support
Debugger applications frequently need debugging information about the source that exceeds what is delivered by the existing JavaTM Virtual Machine class file attributes (SourceFile, LineNumber, and LocalVariable). This is particularly true for debugging the source of other languages. In a distributed environment side files may not be accessible, the information must be directly associated with the class.
The solution is the addition of a class file attribute which holds a string; The string contains debugging information in a standardized format which allows for evolution and vendor extension.
鉴于此目的,javac 不太可能将任何内容放入该字段。还有另一个 StackOverflow 问题问 what JVM languages use the SMAP attribute .
关于java - javac 可以提供类的 "source debug extension information"属性吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25516850/
我的问题是关于基本的java命令之一“javac”。我的桌面上有一个“.java”文件。我已经安装了 JDK 7 并将路径变量添加到环境变量中。这是“环境变量”的屏幕截图。 http://s13.po
我制作了我的 gitrepository 并提交了它。 插入了一个 java 文件并想编译它,但它给了我这个: Bernard@BERNARD-PC /c/users/bernard/desktop/
运行Maven时,得到以下输出: [WARNING] Unable to autodetect 'javac' path, using 'javac' from the environment. 我该
我有一个导入一些 servlet 库的类。当我从命令行编译它时它很好。 当我使用 ant compile 任务编译它时,它给出了在其路径中找不到 servlet 库的错误。 这是已知/常见的情况吗?
我试图在 maven-compiler-plugin 中指定另一个版本的 JDK .当-target和 -source参数设置为1.5,一切正常。但是当我尝试使用 1.6 JDK 时,maven 会报
我们的软件之前附带 OpenJDK JRE,但现在我们将附带 Oracle JRE。 之前我们使用 OpenJDK javac 编译器进行编译。我认为现在我们应该使用 Oracle javac 编译器
在大多数现代 IDE 中,您可以设置一个参数来确保 javac 获得足够的堆内存来进行编译。由于不值得在这里讨论的原因,我们暂时与 JBuilder 2005/2006 联系在一起,而且源代码的数量似
我在桌面上的 Notepad++ 中保存了一个名为“first.java”的文件。当我运行 cmd 命令“javac first.java”时,它给了我这个错误。 javac: file not fo
更新: See resolution here. 感谢大家的帮助! 我在尝试使用 Ant 编译项目时遇到错误,它声称“[javac] javac:无效目标版本:7”并导致构建失败。 我在 Mac OS
当我尝试在我的 gwt-maven Projekt 上进行 maven-install 时,我得到了这个错误: [ERROR] Failed to execute goal org.apache.ma
使用 maven 编译时出现编译错误。 [ERROR] COMPILATION ERROR : [INFO] ---------------------------------------------
我正在查看一些内部 javac sun 编译器 API 源代码,并在 Types 类中发现了这一点: public Boolean visitTypeVar(TypeVar var1, Type va
我正在尝试运行 java 应用程序,但出现以下错误, Unable to find a javac compiler; com.sun.tools.javac.Main is not on the c
我有这个类,它是我在从 Java 6 移植到 Java 8 的项目中找到的一些代码的简化: public class Unification { final class Box {}
首先,我要感谢你,并明确地说,我已经在这个问题上苦苦思索了好几天,并在其他类似线程中寻找解决方案,但没有成功。 我们的应用程序负责生成 java 类,其中一些可能在类名(因此文件名)中包含特殊字符,例
以下代码创建了一个Collector,它产生了一个UnmodifiableSortedSet: package com.stackoverflow; import java.util.Collecti
当我用 Maven 编译我的类时遇到问题。堆栈跟踪如下所示: [ERROR] Failure executing javac, but could not parse the error: [ERRO
这个问题在这里已经有了答案: Why Java compiler as distributed as executable and not as JVM bytecode? (1 个回答) 关闭 7
我有一些用 javac 1.8.0_92 编译的代码: public final class Either { // ... private final L l; privat
这个问题在这里已经有了答案: Lombok's access to jdk.compiler's internal packages incompatible with Java-16 (3 个回答)
我是一名优秀的程序员,十分优秀!