Skip to content

Fix: Open .java file instead of .class during debugging when source is available#4375

Open
amritamishra01 wants to merge 1 commit intoredhat-developer:mainfrom
amritamishra01:fix-java-class-debug-filename
Open

Fix: Open .java file instead of .class during debugging when source is available#4375
amritamishra01 wants to merge 1 commit intoredhat-developer:mainfrom
amritamishra01:fix-java-class-debug-filename

Conversation

@amritamishra01
Copy link
Copy Markdown
Contributor

@amritamishra01 amritamishra01 commented Mar 28, 2026

Problem

Currently, when debugging Java classes, the extension attempts to open the .class file instead of the corresponding .java source file, even when the source is available.

Fix

  • Added logic to check if a .java file exists for the given URI.
  • If available, open the .java file instead of the .class file.
  • Fallback to .class file if source is not available.

🔧 Changes

  • Updated javaClassEditor.ts to resolve correct file URI dynamically.

Result

Improves debugging experience by showing readable source code instead of compiled .class output.

fixes #4356

@fbricon
Copy link
Copy Markdown
Collaborator

fbricon commented Mar 30, 2026

I believe the proper fix should happen in microsoft/java-debug#623

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The filename of the class(with source code included) should not end with .class on debugging scene

2 participants