Repository navigation
Java-Debug is not always conforming the Debugger Adapter Protocol #444
Description
Activity
I'm curious about this issue. What is the reason why not using the LSP4E.debug support for the Debug Adapter Protocol? Wouldn't using it provide more guarantee of conformance? Are there some known drawbacks?
testforstephen commented
on Apr 3, 2023 ContributorMore actionsI'm curious about this issue. What is the reason why not using the LSP4E.debug support for the Debug Adapter Protocol? Wouldn't using it provide more guarantee of conformance? Are there some known drawbacks?
There are two reasons:
- This Java debug project was set up earlier than LSP4E.debug and lsp4j.debug.
- This Java-debug project uses JDI directly. However, LSP4E.debug is built on top of Eclipse Platform Debug framework, that doesn't meet our needs.
Sorry, I made a typo in my previous comment. I was only thinking of LSP4J.debug part; the client side (LSP4E.debug and Eclipse Platform Debug) is totally out of the scope here.
So let's focus onThis Java debug project was set up earlier than LSP4E.debug and lsp4j.debug.
Do you think it would make sense to switch it to lsp4j.debug ?
testforstephen commented
on Apr 4, 2023 ContributorMore actionsThe original issue actually has three different use case. The first one involves JSON de-serialization and it might help by switching to lsp4j.debug. However, the other two use cases are related to the DAP implementation and lsp4j.debug won't help for them. I don't see much business benefit to switch it to lsp4j.debug.
Hi Lucas Alber (@LDAP), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
-
For handling
nullarguments:- Update the Request class to use a
JsonElement(orJsonObject) for theargumentsfield so thatJsonNullis accepted. See issue #744:
• Request.arguments should be a JsonElement type to allow JsonNull
• URL: The filed named arguments of Request class shoulb be JsonElement type . vscode-java-debug#744
- Update the Request class to use a
-
For the
threadsresponse missing thethreadskey:- Ensure the debug adapter always returns an object with a
threadsarray (even if empty) per the DAP spec:
• Spec: “The response to the threads request has thethreadsattribute”
• URL: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Threads
- Ensure the debug adapter always returns an object with a
-
For non–project-file classes (jdt:// URIs):
- Instead of using
jdt://, setsourceReference > 0and serve source via thesourcerequest. See discussion in issue Could not load source '': SourceRequest: property 'sourceReference' is missing, null, or empty. #259:
• Comment: workaround for sourceReference
• URL: Could not load source '': SourceRequest: property 'sourceReference' is missing, null, or empty. #259 (comment)
- Instead of using
labels:
- bug
duplicateUrls: []
The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!
-
Commands that have
argumentsset tonullthrow an exception:However, commands that do not need arguments, e.g. (
configurationDone,threads) should be able to set arguments tonullas the Thread Request does not set any restrictions. See here.The response to
threadsrequest does not always contain thethreadskey.Protocol:
See here.
When stepping into classes that are not represented by a project file, Java-Debug returns a path with URI scheme
jdt://which then can be used to retrieve the class content using thejava/classFileContentsLSP request. Java-Debug should instead set the sourceReference value > 0 and the contents of the source must be retrieved through thesourcerequest (See Could not load source '': SourceRequest: property 'sourceReference' is missing, null, or empty. #259 (comment)).This requires a special workaround in Java adapter daveleroy/SublimeDebugger#106.