Repository navigation
fix: honor source encodings when resolving breakpoints - #647
Merged
Merged
Conversation
Use Eclipse resource decoding for workspace files and BOM-aware decoding for external sources. Exercise breakpoint class-name resolution with UTF-16, UTF-8, and configured resource charsets in headless JDT tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Changyong Gong (chagong)
requested review from
Sheng Chen (jdneo),
Jinbo Wang (testforstephen) and
wenyt (wenytang-ms)
as code owners
October 29, 2026 02:13
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the encoding-aware source decoding changes.
No open issues 🎉
What changed in this PR
Fixes encoding-related breakpoint resolution failures by decoding file-backed Java sources correctly before JDT parses them.
Changes:
- Honor workspace file/project encodings and recognize UTF-8 and UTF-16 BOMs in external sources, preserving the JVM-default fallback.
- Add 14 headless Eclipse/JDT regression cases covering encoding-aware breakpoint class-name and line resolution.
- Enable plugin integration tests, align the compiler with the Eclipse target, and document encoding behavior and build requirements.
| File | Description |
|---|---|
| README.md | Documents source encodings and build/test requirements. |
| com.microsoft.java.debug.target/com.microsoft.java.debug.tp.target | Makes the Eclipse target’s JDT compiler available. |
| com.microsoft.java.debug.plugin/src/test/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProviderTest.java | Adds 14 encoding-focused breakpoint regression cases. |
| com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java | Uses encoding-aware source readers and logs read failures. |
| com.microsoft.java.debug.plugin/pom.xml | Configures plugin tests, runtime dependencies, and a compatible compiler range. |
Review effort: Balanced
Restore README.md to the PR base without changing the source-encoding fix or regression tests. Keep contributor-facing verification and implementation rationale in the PR description because there is no suitable existing contributor guide. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes microsoft/vscode-java-debug#1726.
The file-backed source lookup decoded Java sources with the language-server JVM's default charset before parsing them. UTF-16 bytes consequently produced an unusable AST and no breakpoint class name, leaving line breakpoints unverified.
IFile.readString()for workspace resources, honoring file/project encodings and stripping Unicode BOMs.getBreakpointLocations()from actual encoded files through AST parsing to the resolved class name and line. Cover workspace and external BOMs, BOM-less resource encodings, UTF-8, and ISO-8859-1 with a non-ASCII package identifier.NoSuchMethodError).README.mdhas no net changes relative to the PR base. The documentation-only follow-up46db436a48270e53eb169f868d19ffdef2ed6d0bremoves the original README additions without changing the runtime fix or regression coverage. There is no suitable existing contributor guide, so contributor-facing build/test evidence and implementation rationale remain in this PR description rather than a new repository document.Verification
Performed for the unchanged runtime fix in this cloud worktree on Linux with Temurin JDK 27 (Java 21 plugin target):
./mvnw -B -ntp clean verify— passed: 55 existing core tests and all 14 new headless plugin cases../mvnw -B -ntp checkstyle:check— passed../mvnw -B -ntp -pl com.microsoft.java.debug.plugin,com.microsoft.java.debug.target checkstyle:check -Dcheckstyle.includeTestSourceDirectory=true— passed, including the new tests.Initial implementation CI completed successfully for commit
5a6483183afaff90e2711b1df3fef29e6f4f2f0aon Linux, Windows, and macOS with JDK 21. Every platform ran all 14 plugin regression cases with no failures or skips, and passed Checkstyle. The existing core suite ran 55 cases per platform (one existing Windows-only skip; no failures). The CLA check also passed. Copilot review was requested after CI passed and reported no open issues on that implementation commit.Current-head CI also completed successfully for the README-only follow-up
46db436a48270e53eb169f868d19ffdef2ed6d0b: clean verify and Checkstyle passed on Linux, Windows, and macOS with JDK 21, and the CLA check passed. The follow-up was verified with zero net README diff against the PR base and no changes to the runtime, tests, or harness. No redundant local build was run for that documentation-only change.These are real JVM/JDT integration tests, not just byte-decoder checks. No VS Code UI/debuggee end-to-end reproduction was performed; the claim verified here is correct source decoding and breakpoint class-name/location resolution.