fix: prefer sourcePaths before JDT source URIs#629
Merged
Conversation
When JDT source lookup returns a non-file URI, check debug sourcePaths before returning that URI to the client. Add a regression test covering cached JDT URI results being overridden by sourcePaths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates stack trace source resolution so that when the debugger/JDT source lookup yields a non-file URI (e.g., jdt://...), the adapter will first attempt to resolve a real local source file via user-provided sourcePaths, while keeping the existing URI fallback when no local match exists.
Changes:
- Prefer resolving sources from
sourcePathsbefore returning non-file:URIs from the source lookup cache. - Refactor source resolution into small helper methods (
getSourceReference,resolveSourceFromSourcePaths). - Add a regression test ensuring a cached
jdt://source can be overridden bysourcePathswhen a matching local file exists.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/StackTraceRequestHandler.java |
Adjusts source selection order to prefer sourcePaths over non-file URIs; refactors helper logic. |
com.microsoft.java.debug.core/src/test/java/com/microsoft/java/debug/core/adapter/handler/StackTraceRequestHandlerTest.java |
Adds regression coverage for cached jdt:// URIs being overridden by sourcePaths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use a null-safe SourceType comparison and convert sourcePaths matches to the client's expected path format. Extend regression coverage for URI clients and null source types. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
chagong
approved these changes
Jun 9, 2026
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.
Fixes #455.
Summary
sourcePathsbefore returning non-file JDT source URIs such asjdt://.jdt://fallback when no matching source file exists insourcePaths.sourcePathsmatches to the client-requested path format and use a null-safeSourceTypecomparison.Validation
mvn -pl com.microsoft.java.debug.core -Dtest=StackTraceRequestHandlerTest testmvn -pl com.microsoft.java.debug.core testmvn -pl com.microsoft.java.debug.core checkstyle:check '-Dcheckstyle.includes=src/test/java/com/microsoft/java/debug/core/adapter/handler/StackTraceRequestHandlerTest.java'Note: full core checkstyle still fails on existing CRLF baseline issues outside this change.