microsoft / microsoft/vscode-java-debug

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

Ouverte
#1,467 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

ai-triaged bug
Langage dominant
TypeScript
Étoiles
591
Forks
429
Merge moyen
1 j 9 h
PR mergées (30 j)
19

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Clonez le dépôt java-debug-demo lié sur la branche does-not-work et reproduisez le breakpoint dans other/src/main/java/tech/tablesaw/table/Relation.java pendant le débogage de run/src/main/java/com/project/my/run/Main.java. Comparez cela avec la branche works et examinez le fichier joint language-support-for-java.log. C’est terminé lorsque le débogueur ouvre Relation.java de l’autre module avec les modifications de l’utilisateur au lieu de la Relation.class de la dépendance.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, typescript
Domaine
devtools
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.