microsoft / microsoft/java-debug

Discovering main class does not work with arguments

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

还没有人认领这个 Issue。

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

描述

Hi i am attempting to call the vscode.java.resolveMainClass with a single argument (the arguments param being array with one entry, the uri) being the uri to a file which is part of a project to which jdtls has been attached to with the java-debug extension enabled. If i try to do that, i get empty response, no errors seemingly. If i pass no uri, just call the command to resolve the main classes it returns fine, the issue here is that i have single jdtls instance which has multiple workspaces / projects attached to it, and so i would like to use the argument to narrow down the result to only the current workspace / context by passing the uri. According to the implementation, it is supposed to handle file uris passed as the first and only argument to this method to use it to resolve the result in ResolveMainClassHandler

[ERROR][2023-05-22 16:04:05] ...lsp/handlers.lua:535	"May 22, 2023, 4:04:05 PM Error in calling delegate command handler\nclass java.lang.String cannot be cast to class java.util.ArrayList (java.lang.String and java.util.ArrayList are in module java.base of loader 'bootstrap')\njava.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.ArrayList (java.lang.String and java.util.ArrayList are in module java.base of loader 'bootstrap')\n\tat org.eclipse.jdt.ls.core.internal.JDTDelegateCommandHandler.executeCommand(JDTDelegateCommandHandler.java:94)\n\tat org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:230)\n\tat org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)\n\tat org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:220)\n\tat org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:585)\n\tat org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)\n\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)\n\tat java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)\n\tat java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)\n\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)\n\tat java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)\n\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)\n\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)\n"

Here is what is being sent

[DEBUG][2023-05-22 16:13:01] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 6,  jsonrpc = "2.0",  method = "workspace/executeCommand",  params = {    arguments = { "file:///home/asmodeus/.projects/javahehe/src/main/java/com/mycompany/app/App17.java" },    command = "vscode.java.resolveMainClass"  }}

贡献指南

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

从这里开始

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

调研方向

从 JDTDelegateCommandHandler.java:94 开始,沿着 vscode.java.resolveMainClass 路径进入 ResolveMainClassHandler。使用单个文件 URI 重现 workspace/executeCommand 请求,然后验证参数在不发生 String-to-ArrayList cast failure 的情况下得到处理,并且主类结果已缩小到相关项目。

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

评估

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

把新 issue 发到你的邮箱

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