microsoft / microsoft/vscode-java-debug

Debugger opens *.class file despite there being an overridden *.java file in the project's src folder

未关闭
#1,467 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

ai-triaged bug
主要语言
TypeScript
星标
591
派生
429
平均合并
1 天 9 小时
30 天内合并 PR
19

描述

When debugging a project where I have put copies of Java files from a dependency in my project's src folder (but in another module) to adjust its behavior, and placing break points in these overwritten Java files, the debugger always opens the *.class file of the dependency, which does not contain my changes.

Example project which works: https://github.com/marecabo/java-debug-demo/tree/works
Example project where this issue occurs: https://github.com/marecabo/java-debug-demo/tree/does-not-work

Environment
  • Operating System: RHEL 8.9
  • JDK version: openjdk 21.0.2 2024-01-16 LTS
  • Visual Studio Code version: 1.88.1
  • Java extension version: v1.29.0
  • Java Debugger extension version: v0.57.0
Steps To Reproduce
  1. Checkout example project: git clone -b does-not-work https://github.com/marecabo/java-debug-demo.git
  2. Place a breakpoint in other/src/main/java/tech/tablesaw/table/Relation.java:261.
    This file overrides a file from a dependency and changes its behavior, see https://github.com/marecabo/java-debug-demo/commit/40bb99b2a213d8f93fe56e77a961562c2be7ac8f
    image
  3. Debug run/src/main/java/com/project/my/run/Main.java
Current Result

language-support-for-java.log

Relation.class is opened which obviously does not show the changes I made in Relation.java. The execution marker (yellow highligted line) is - however - at the line number of the original breakpoint in other/src/main/java/tech/tablesaw/table/Relation.java:261, even if that line in Relation.class only contains } or is even empty.

image

Expected Result

other/src/main/java/tech/tablesaw/table/Relation.java is opened with my changes.

image

Additional Informations

So far I found out, that this issue only occurs, when the overridden Java file is not located in the same maven module, where the main class which is debugged resides. As a workaround, moving the overridden Relation.java file to the run module is enough to make it work as expected.

Thanks for your work at this extension.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

在 does-not-work 分支上克隆链接的 java-debug-demo 仓库,并在调试 run/src/main/java/com/project/my/run/Main.java 时,重现 other/src/main/java/tech/tablesaw/table/Relation.java 中的断点。将其与 works 分支进行比较,并检查附加的 language-support-for-java.log。完成的标准是:调试器打开来自其他模块且包含用户更改的 Relation.java,而不是依赖项的 Relation.class。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, typescript
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。