Uh oh!
There was an error while loading. Please reload this page.
fix: prefer sourcePaths before JDT source URIs - #629
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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>
Uh oh!
There was an error while loading. Please reload this page.
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.