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 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

ai-triaged bug
主要言語
TypeScript
スター
591
フォーク
429
平均マージ
1日 9時間
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされた java-debug-demo リポジトリを does-not-work ブランチでクローンし、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.class ではなく、ユーザーの変更を含む別モジュールの Relation.java を開けば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, typescript
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。