microsoft / microsoft/java-debug

Java-Debug is not always conforming the Debugger Adapter Protocol

未关闭
#444 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

ai-triaged bug help wanted
主要语言
Java
星标
409
派生
204
平均合并
1 天 13 小时
30 天内合并 PR
4

描述

  • Commands that have arguments set to null throw an exception:

    jdtls: 08.03.2021, 23:12:44 Error parsing message: com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonNull
    Expected a com.google.gson.JsonObject but was com.google.gson.JsonNull
    com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonNull
        at com.google.gson.internal.bind.TypeAdapters$35$1.read(TypeAdapters.java:897)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
        at com.google.gson.Gson.fromJson(Gson.java:932)
        at com.google.gson.Gson.fromJson(Gson.java:897)
        at com.google.gson.Gson.fromJson(Gson.java:846)
        at com.google.gson.Gson.fromJson(Gson.java:817)
        at com.microsoft.java.debug.core.protocol.JsonUtils.fromJson(JsonUtils.java:26)
        at com.microsoft.java.debug.core.protocol.AbstractProtocolServer.processData(AbstractProtocolServer.java:219)
        at com.microsoft.java.debug.core.protocol.AbstractProtocolServer.run(AbstractProtocolServer.java:98)
        at com.microsoft.java.debug.core.adapter.ProtocolServer.run(ProtocolServer.java:61)
        at com.microsoft.java.debug.plugin.internal.JavaDebugServer$2.run(JavaDebugServer.java:136)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
        at java.base/java.lang.Thread.run(Thread.java:832)
    

    However, commands that do not need arguments, e.g. (configurationDone, threads) should be able to set arguments to null as the Thread Request does not set any restrictions. See here.

  • The response to threads request does not always contain the threads key.
    Protocol:

    ⟸ request/threads(8) :: {}
    ⟸ request/threads(9) :: {}
    ⟸ request/threads(10) :: {}
    ⟸ request/threads(11) :: {}
    ⟸ request/threads(12) :: {}
    ⟸ request/threads(13) :: {}
    ⟹ response/threads(8) :: None
    ⟹ response/threads(9) :: None
    ⟹ response/threads(10) :: None
    ⟹ response/threads(11) :: None
    ⟹ response/threads(12) :: None
    ⟹ response/threads(13) :: None
    

    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 the java/classFileContents LSP request. Java-Debug should instead set the sourceReference value > 0 and the contents of the source must be retrieved through the source request (See https://github.com/microsoft/java-debug/issues/259#issuecomment-695097967).
    This requires a special workaround in https://github.com/daveleroy/sublime_debugger/pull/106.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

先从经过 JsonUtils.java、AbstractProtocolServer.java 和 ProtocolServer.java 的协议路径开始,然后重现带有 null 参数的请求以及重复的 threads 请求。检查 DAP threads 响应,以及对使用 jdt:// URI 返回的类进行的源处理。当 null 参数不再抛出异常、threads 响应包含 threads,并且非项目类在 source 请求中使用 sourceReference 时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。