Skip to content

Conversation

@Huabuxiu
Copy link
Contributor

@Huabuxiu Huabuxiu commented Sep 9, 2025

What type of PR is this?

feat: support java parser with tree-sitter and jdt-ls lsp

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. [User docs repo](GitHub - cloudwego/cloudwego.github.io: Website for CloudWeGo)

(Optional) Translate the PR title into Chinese.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:

  • Only perform Java static analysis, excluding advanced content such as dynamic proxies, AOP programming, and bytecode modification agents.
  • Only supports Maven projects.
  • Only builds the graph structure within the current code repository, not processing the contents of dependent Jar packages, such as Maven dependencies.

zh(optional):

  • 只做Java 静态分析,不包含动态代理,AOP 编程 ,字节码修改Agent等高级内容。
  • 只支持Maven 项目
  • 只构建 当前代码仓库内部 图谱结构,不处理依赖Jar 包内容,比如 Maven dependencies

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

more detail of this pr : docs/tree-sitter_and_lsp_zh.md

@CLAassistant
Copy link

CLAassistant commented Sep 9, 2025

CLA assistant check
All committers have signed the CLA.

@welkeyever
Copy link
Member

可以先签署一下 cla 哈

@welkeyever
Copy link
Member

JDT 能做到用户按需安装码吗?类似:

  • 将 JDT 从代码仓库中移除
  • 提供安装脚本或文档指导用户安装
  • 实现 JDT 路径的自动检测和配置

@Huabuxiu
Copy link
Contributor Author

Huabuxiu commented Sep 9, 2025

JDT 能做到用户按需安装码吗?类似:

  • 将 JDT 从代码仓库中移除
  • 提供安装脚本或文档指导用户安装
  • 实现 JDT 路径的自动检测和配置

脚本已提供,可以支持用户自定义JDT和默认JDT 路径

@welkeyever
Copy link
Member

Part of #64

Copy link
Member

@welkeyever welkeyever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testdata 统一放到根目录下吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@AsterDY
Copy link
Collaborator

AsterDY commented Sep 11, 2025

PS: 理想架构应该是将 tree-sitter binding 封装为一套接口,直接内嵌到 Collect 过程中。不过改动其他parser实现现在确实也不在本次pr的职责范围呢,就先这样吧。后面有兴趣可以一起看看怎么整体重构一下 @Huabuxiu @Hoblovski

@Hoblovski
Copy link
Collaborator

Hoblovski commented Sep 11, 2025

  1. 有两个 commit,一个加 jar 一个移除,把他们清理一下吧。
    不然 git 里会一直有这个 jar,整整 50M 呢。
    clone 会变慢。

还是说我们最后 squash?那样的话就别管了

@Huabuxiu
Copy link
Contributor Author

  1. 有两个 commit,一个加 jar 一个移除,把他们清理一下吧。
    不然 git 里会一直有这个 jar,整整 50M 呢。
    clone 会变慢。

还是说我们最后 squash?那样的话就别管了

squash 下吧

@Hoblovski
Copy link
Collaborator

Screenshot from 2025-09-11 21-44-21 我 panic 了 话说我运行需要安装什么吗?

@Huabuxiu
Copy link
Contributor Author

Huabuxiu commented Sep 11, 2025

Screenshot from 2025-09-11 21-44-21 我 panic 了 话说我运行需要安装什么吗?

上午改 commit的时候改挂了,现在OK了,拉下代码再试试

@Hoblovski
Copy link
Collaborator

Hoblovski commented Sep 11, 2025

不 panic 了,不过现在跑 java 测例跑出来 modules 是空?

看起来是测例编译错?

Screenshot from 2025-09-11 23-48-57
$ ./abcoder parse java testdata/java/0_simple
2025/09/11 23:47:43 JDT Language Server not found locally. Downloading and installing version 1.39.0-202408291433...
2025/09/11 23:47:43 Downloading from https://download.eclipse.org/jdtls/milestones/1.39.0/jdt-language-server-1.39.0-202408291433.tar.gz...
2025/09/11 23:48:10 Extracting to /home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/java/lsp/jdtls...
2025/09/11 23:48:10 JDT Language Server installed successfully in /home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/java/lsp/jdtls/jdt-language-server-1.39.0-202408291433.
[ERROR]23:48:10 client.go:264: LSP server stderr: OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
[ERROR]23:48:10 client.go:264: LSP server stderr: Sep 11, 2025 11:48:10 PM org.apache.aries.spifly.BaseActivator log
[ERROR]23:48:10 client.go:264: LSP server stderr: INFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic
[ERROR]23:48:10 client.go:264: LSP server stderr: Sep 11, 2025 11:48:10 PM org.apache.aries.spifly.BaseActivator log
[ERROR]23:48:10 client.go:264: LSP server stderr: INFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic
{"ASTVersion":"v0.1.3","id":"/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple","Path":"/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple","Modules":{},"Graph":{}}

[~/O/data/Programs/bytedance/abcoder.remote]   [feature-20250815-add-java =]   [11:48:14 PM]   zhenyang
$ git status -s  ;  git log -1 | cat
?? lang/java/lsp/jdtls/
commit 6d13a45c68e452d4b7b4f348b7e4aff8e1e69496
Author: mayuewei.13 <mayuewei.13@bytedance.com>
Date:   Thu Sep 11 18:09:10 2025 +0400

    fix:remove append check

加 verbose 的 log 如下

$ ./abcoder parse java testdata/java/0_simple -verbose
2025/09/11 23:54:18 Found existing JDT Language Server at /home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/java/lsp/jdtls/jdt-language-server-1.39.0-202408291433. Skipping installation.
[INFO]23:54:18 parse.go:136: open file '' and wait for 2 seconds for initialize workspace
[INFO]23:54:18 parse.go:80: start initialize LSP server java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar /home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/java/lsp/jdtls/jdt-language-server-1.39.0-202408291433/plugins/org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar -configuration /home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/java/lsp/jdtls/jdt-language-server-1.39.0-202408291433/config_linux -data /home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/java/lsp/jdtls/runtime --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED...
[ERROR]23:54:18 client.go:264: LSP server stderr: OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
[ERROR]23:54:19 client.go:264: LSP server stderr: Sep 11, 2025 11:54:19 PM org.apache.aries.spifly.BaseActivator log
[ERROR]23:54:19 client.go:264: LSP server stderr: INFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic
[ERROR]23:54:19 client.go:264: LSP server stderr: Sep 11, 2025 11:54:19 PM org.apache.aries.spifly.BaseActivator log
[ERROR]23:54:19 client.go:264: LSP server stderr: INFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM Main thread is waiting","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM \u003e\u003e initialize","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM Initializing Java Language Server 1.39.0.202408291433","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM Started org.eclipse.m2e.core 0ms","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM ProjectRegistryRefreshJob finished 285ms","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM Started org.eclipse.buildship.core 8ms","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM Static Commands: []","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM Non-Static Commands: [java.project.import, java.project.changeImportedProjects, java.navigate.openTypeHierarchy, java.project.resolveStackTraceLocation, java.edit.handlePasteEvent, java.edit.stringFormatting, java.project.getSettings, java.project.resolveWorkspaceSymbol, java.project.upgradeGradle, java.project.createModuleInfo, java.vm.getAllInstalls, java.edit.organizeImports, java.project.refreshDiagnostics, java.project.removeFromSourcePath, java.project.listSourcePaths, java.project.updateSettings, java.project.getAll, java.reloadBundles, java.project.isTestFile, java.project.resolveText, java.project.getClasspaths, java.navigate.resolveTypeHierarchy, java.edit.smartSemicolonDetection, java.project.updateSourceAttachment, java.project.updateClassPaths, java.decompile, java.protobuf.generateSources, java.project.resolveSourceAttachment, java.project.updateJdk, java.project.addToSourcePath, java.completion.onDidSelect]","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"Init...","type":"Starting"}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"0% Starting Java Language Server","type":"Starting"}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM \u003e\u003e initialized","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM RepositoryRegistryUpdateJob finished 10ms","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"OK","type":"ProjectStatus"}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"100% Starting Java Language Server","type":"Starting"}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"1000% Starting Java Language Server","type":"Starting"}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"1005% Starting Java Language Server","type":"Starting"}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"1010% Starting Java Language Server","type":"Starting"}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"1100% Starting Java Language Server","type":"Starting"}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"1100% Starting Java Language Server","type":"Starting"}
[DEBUG]23:54:19 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:19 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:19 PM Workspace initialized in 31ms","type":3}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"Ready","type":"Started"}
[DEBUG]23:54:19 handler.go:96: handle method: language/status
[DEBUG]23:54:19 handler.go:98: param: {"message":"1100% Starting Java Language Server","type":"Starting"}
[DEBUG]23:54:20 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:20 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:20 PM \u003e\u003e initialization job finished","type":3}
[DEBUG]23:54:20 handler.go:96: handle method: language/status
[DEBUG]23:54:20 handler.go:98: param: {"message":"ServiceReady","type":"ServiceReady"}
[DEBUG]23:54:20 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:20 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:20 PM \u003e\u003e build jobs finished","type":3}
[DEBUG]23:54:20 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:20 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:20 PM \u003e\u003e registerWatchers'","type":3}
[DEBUG]23:54:20 handler.go:96: handle method: textDocument/publishDiagnostics
[DEBUG]23:54:20 handler.go:98: param: {"diagnostics":[{"code":"536871240","message":"The declared package \"simple\" does not match the expected package \"\"","range":{"end":{"character":14,"line":0},"start":{"character":8,"line":0}},"severity":1,"source":"Java"},{"code":"16777541","message":"The public type AdvancedFeature must be defined in its own file","range":{"end":{"character":28,"line":2},"start":{"character":13,"line":2}},"severity":1,"source":"Java"}],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/AdvancedFeatures.java"}
[DEBUG]23:54:20 handler.go:131: Received publishDiagnostics notification:
{"diagnostics":[{"code":"536871240","message":"The declared package \"simple\" does not match the expected package \"\"","range":{"end":{"character":14,"line":0},"start":{"character":8,"line":0}},"severity":1,"source":"Java"},{"code":"16777541","message":"The public type AdvancedFeature must be defined in its own file","range":{"end":{"character":28,"line":2},"start":{"character":13,"line":2}},"severity":1,"source":"Java"}],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/AdvancedFeatures.java"}
[DEBUG]23:54:20 handler.go:96: handle method: textDocument/publishDiagnostics
[DEBUG]23:54:20 handler.go:98: param: {"diagnostics":[{"code":"536871240","message":"The declared package \"simple\" does not match the expected package \"\"","range":{"end":{"character":14,"line":0},"start":{"character":8,"line":0}},"severity":1,"source":"Java"},{"code":"603979977","message":"Cannot make a static reference to the non-static method testFunction(HelloWorld.P, String) from the type HelloWorld","range":{"end":{"character":20,"line":9},"start":{"character":8,"line":9}},"severity":1,"source":"Java"},{"code":"1610612976","message":"Syntax error, insert \";\" to complete Statement","range":{"end":{"character":30,"line":9},"start":{"character":29,"line":9}},"severity":1,"source":"Java"}],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/HelloWorld.java"}
[DEBUG]23:54:20 handler.go:131: Received publishDiagnostics notification:
{"diagnostics":[{"code":"536871240","message":"The declared package \"simple\" does not match the expected package \"\"","range":{"end":{"character":14,"line":0},"start":{"character":8,"line":0}},"severity":1,"source":"Java"},{"code":"603979977","message":"Cannot make a static reference to the non-static method testFunction(HelloWorld.P, String) from the type HelloWorld","range":{"end":{"character":20,"line":9},"start":{"character":8,"line":9}},"severity":1,"source":"Java"},{"code":"1610612976","message":"Syntax error, insert \";\" to complete Statement","range":{"end":{"character":30,"line":9},"start":{"character":29,"line":9}},"severity":1,"source":"Java"}],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/HelloWorld.java"}
[INFO]23:54:21 parse.go:93: end initialize LSP server
[INFO]23:54:21 parse.go:186: start collecting symbols...
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM Clearing problems for /AdvancedFeatures.java","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: textDocument/publishDiagnostics
[DEBUG]23:54:22 handler.go:98: param: {"diagnostics":[],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/AdvancedFeatures.java"}
[DEBUG]23:54:22 handler.go:131: Received publishDiagnostics notification:
{"diagnostics":[],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/AdvancedFeatures.java"}
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM begin problem for /AdvancedFeatures.java","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM 2 problems reported for /AdvancedFeatures.java","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: textDocument/publishDiagnostics
[DEBUG]23:54:22 handler.go:98: param: {"diagnostics":[{"code":"536871240","message":"The declared package \"simple\" does not match the expected package \"\"","range":{"end":{"character":14,"line":0},"start":{"character":8,"line":0}},"severity":1,"source":"Java"},{"code":"16777541","message":"The public type AdvancedFeature must be defined in its own file","range":{"end":{"character":28,"line":2},"start":{"character":13,"line":2}},"severity":1,"source":"Java"}],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/AdvancedFeatures.java"}
[DEBUG]23:54:22 handler.go:131: Received publishDiagnostics notification:
{"diagnostics":[{"code":"536871240","message":"The declared package \"simple\" does not match the expected package \"\"","range":{"end":{"character":14,"line":0},"start":{"character":8,"line":0}},"severity":1,"source":"Java"},{"code":"16777541","message":"The public type AdvancedFeature must be defined in its own file","range":{"end":{"character":28,"line":2},"start":{"character":13,"line":2}},"severity":1,"source":"Java"}],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/AdvancedFeatures.java"}
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM Reconciled 1. Took 0 ms","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM Reconciled 1. Took 0 ms","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM Clearing problems for /HelloWorld.java","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: textDocument/publishDiagnostics
[DEBUG]23:54:22 handler.go:98: param: {"diagnostics":[],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/HelloWorld.java"}
[DEBUG]23:54:22 handler.go:131: Received publishDiagnostics notification:
{"diagnostics":[],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/HelloWorld.java"}
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM begin problem for /HelloWorld.java","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM 3 problems reported for /HelloWorld.java","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: textDocument/publishDiagnostics
[DEBUG]23:54:22 handler.go:98: param: {"diagnostics":[{"code":"536871240","message":"The declared package \"simple\" does not match the expected package \"\"","range":{"end":{"character":14,"line":0},"start":{"character":8,"line":0}},"severity":1,"source":"Java"},{"code":"603979977","message":"Cannot make a static reference to the non-static method testFunction(HelloWorld.P, String) from the type HelloWorld","range":{"end":{"character":20,"line":9},"start":{"character":8,"line":9}},"severity":1,"source":"Java"},{"code":"1610612976","message":"Syntax error, insert \";\" to complete Statement","range":{"end":{"character":30,"line":9},"start":{"character":29,"line":9}},"severity":1,"source":"Java"}],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/HelloWorld.java"}
[DEBUG]23:54:22 handler.go:131: Received publishDiagnostics notification:
{"diagnostics":[{"code":"536871240","message":"The declared package \"simple\" does not match the expected package \"\"","range":{"end":{"character":14,"line":0},"start":{"character":8,"line":0}},"severity":1,"source":"Java"},{"code":"603979977","message":"Cannot make a static reference to the non-static method testFunction(HelloWorld.P, String) from the type HelloWorld","range":{"end":{"character":20,"line":9},"start":{"character":8,"line":9}},"severity":1,"source":"Java"},{"code":"1610612976","message":"Syntax error, insert \";\" to complete Statement","range":{"end":{"character":30,"line":9},"start":{"character":29,"line":9}},"severity":1,"source":"Java"}],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/HelloWorld.java"}
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM Clearing problems for /AdvancedFeatures.java","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: textDocument/publishDiagnostics
[DEBUG]23:54:22 handler.go:98: param: {"diagnostics":[],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/AdvancedFeatures.java"}
[DEBUG]23:54:22 handler.go:131: Received publishDiagnostics notification:
{"diagnostics":[],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/AdvancedFeatures.java"}
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM begin problem for /AdvancedFeatures.java","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: window/logMessage
[DEBUG]23:54:22 handler.go:98: param: {"message":"Sep 11, 2025, 11:54:22 PM 2 problems reported for /AdvancedFeatures.java","type":3}
[DEBUG]23:54:22 handler.go:96: handle method: textDocument/publishDiagnostics
[DEBUG]23:54:22 handler.go:98: param: {"diagnostics":[{"code":"536871240","message":"The declared package \"simple\" does not match the expected package \"\"","range":{"end":{"character":14,"line":0},"start":{"character":8,"line":0}},"severity":1,"source":"Java"},{"code":"16777541","message":"The public type AdvancedFeature must be defined in its own file","range":{"end":{"character":28,"line":2},"start":{"character":13,"line":2}},"severity":1,"source":"Java"}],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/AdvancedFeatures.java"}
[DEBUG]23:54:22 handler.go:131: Received publishDiagnostics notification:
{"diagnostics":[{"code":"536871240","message":"The declared package \"simple\" does not match the expected package \"\"","range":{"end":{"character":14,"line":0},"start":{"character":8,"line":0}},"severity":1,"source":"Java"},{"code":"16777541","message":"The public type AdvancedFeature must be defined in its own file","range":{"end":{"character":28,"line":2},"start":{"character":13,"line":2}},"severity":1,"source":"Java"}],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple/AdvancedFeatures.java"}
[INFO]23:54:22 collect.go:451: finish collector module /home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple ,progress rate 0/1
[INFO]23:54:22 parse.go:191: all symbols collected.
[INFO]23:54:22 parse.go:192: start exporting symbols...
[INFO]23:54:22 parse.go:101: all symbols collected, start writing to stdout...
{"ASTVersion":"v0.1.3","id":"/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple","Path":"/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple","Modules":{},"Graph":{}}

@Hoblovski
Copy link
Collaborator

CI 挂了,是不是文件要加版权 header?

@welkeyever
Copy link
Member

@Huabuxiu
Copy link
Contributor Author

@Huabuxiu These files need to add the license header: https://github.com/cloudwego/abcoder/actions/runs/17656011834/job/50202337881?pr=80

done

@Huabuxiu
Copy link
Contributor Author

Huabuxiu commented Sep 12, 2025

不 panic 了,不过现在跑 java 测例跑出来 modules 是空?

看起来是测例编译错?

Screenshot from 2025-09-11 23-48-57 ``` $ ./abcoder parse java testdata/java/0_simple 2025/09/11 23:47:43 JDT Language Server not found locally. Downloading and installing version 1.39.0-202408291433... 2025/09/11 23:47:43 Downloading from https://download.eclipse.org/jdtls/milestones/1.39.0/jdt-language-server-1.39.0-202408291433.tar.gz... 2025/09/11 23:48:10 Extracting to /home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/java/lsp/jdtls... 2025/09/11 23:48:10 JDT Language Server installed successfully in /home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/java/lsp/jdtls/jdt-language-server-1.39.0-202408291433. [ERROR]23:48:10 client.go:264: LSP server stderr: OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release. [ERROR]23:48:10 client.go:264: LSP server stderr: Sep 11, 2025 11:48:10 PM org.apache.aries.spifly.BaseActivator log [ERROR]23:48:10 client.go:264: LSP server stderr: INFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic [ERROR]23:48:10 client.go:264: LSP server stderr: Sep 11, 2025 11:48:10 PM org.apache.aries.spifly.BaseActivator log [ERROR]23:48:10 client.go:264: LSP server stderr: INFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic {"ASTVersion":"v0.1.3","id":"/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple","Path":"/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/java/0_simple","Modules":{},"Graph":{}}

[~/O/data/Programs/bytedance/abcoder.remote] [feature-20250815-add-java =] [11:48:14 PM] zhenyang
$ git status -s ; git log -1 | cat
?? lang/java/lsp/jdtls/
commit 6d13a45
Author: mayuewei.13 mayuewei.13@bytedance.com
Date: Thu Sep 11 18:09:10 2025 +0400

fix:remove append check

加 verbose 的 log 如下

前面三个仓库 是测试 解析部分功能用的 repo file,给小UT 用的 , 加了一个 带mvn项目管理的 第四个,可以试试跑一下parse 看看
image

@Hoblovski
Copy link
Collaborator

0_HelloWorld 里代码有语法错误,tree sitter 居然会自动修复?
虽然可能影响不大

@Huabuxiu
Copy link
Contributor Author

0_HelloWorld 里代码有语法错误,tree sitter 居然会自动修复? 虽然可能影响不大

tree sitter 在这里用法是 单文件词法解析,没有校验语法正确性,所以能识别出来这个格式

"context"
"fmt"
"github.com/cloudwego/abcoder/lang/java"
javaparser "github.com/cloudwego/abcoder/lang/java/parser"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import 可以顺带 format 下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

@Hoblovski Hoblovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

解决一下冲突然后 squash 吧?

@Huabuxiu Huabuxiu force-pushed the feature-20250815-add-java branch from 7551392 to 940796b Compare September 18, 2025 10:40
@welkeyever
Copy link
Member

Moved to #88

@welkeyever welkeyever closed this Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants