Skip to content

Commit bb3017a

Browse files
wenytang-msCopilot
andcommitted
Use JDTUtils.toUri() for decompiled class file URIs
Replace manual jdt:// URI construction in getFileURI(IClassFile) with JDTUtils.toUri(classFile) to align with eclipse.jdt.ls PR #3666. This ensures the debugger generates the same URI format as the language server, fixing the issue where classes with source code are opened twice (once as .java, once as .class) during debugging. Fixes #623 Related: eclipse-jdtls/eclipse.jdt.ls#3729 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 26b05eb commit bb3017a

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,15 +466,7 @@ private String getContents(IClassFile cf) {
466466
}
467467

468468
private static String getFileURI(IClassFile classFile) {
469-
String packageName = classFile.getParent().getElementName();
470-
String jarName = classFile.getParent().getParent().getElementName();
471-
try {
472-
return new URI(JDT_SCHEME, "contents", PATH_SEPARATOR + jarName + PATH_SEPARATOR + packageName
473-
+ PATH_SEPARATOR + classFile.getElementName(), classFile.getHandleIdentifier(), null)
474-
.toASCIIString();
475-
} catch (URISyntaxException e) {
476-
return null;
477-
}
469+
return JDTUtils.toUri(classFile);
478470
}
479471

480472
private static String getFileURI(IResource resource) {

0 commit comments

Comments
 (0)