feat: add Java writer and Gradle support, fix parser stability issues#164
Open
thunguo wants to merge 2 commits intocloudwego:mainfrom
Open
feat: add Java writer and Gradle support, fix parser stability issues#164thunguo wants to merge 2 commits intocloudwego:mainfrom
thunguo wants to merge 2 commits intocloudwego:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
feat
Check the PR title.
(Optional) Translate the PR title into Chinese.
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
lang/java/writer/write.goandlang/java/writer/ast.go, implementing a Java code generator (uniast.Writerinterface) that supports generating Java source code andpom.xmlfrom UniASTlang/java/writer/write_test.gowith comprehensive unit testslang/write.goandlang/patch/lib.goto register the Java Writer into the frameworklang/java/parser/gradle_parser.go, using regex to extract project structure fromsettings.gradle(.kts)/build.gradle(.kts)and outputtingModuleInfoin the same format as the Maven parserlang/java/parser/gradle_parser_test.goandtestdata/java/5_gradle_project/test dataNewJavaSpecinlang/java/spec.go: three-level detection — Maven → Gradle → empty fallbacklang/collect/collect.go: added Gradle fallback to bothScannerByTreeSitterandScannerByJavaIPClang/collect/export.go: receivers map entries are now sorted by source position after collection, ensuring stable method orderinglang/collect/collect.go: fallback file traversal changed to iterate over a sorted list, eliminating map random orderingFileImportsPaniclang/java/spec.go: replacedpanic("Java import parsing by tree-setting")with a regex-based import parsing implementationlang/java/writer/write.go: keys inmod.Filesare relative paths — fixed by matching on basename insteadextractPackageFromPathlang/java/ipc/converter.go: added recognition forsrc/test/java/,src/main/kotlin/, andsrc/test/kotlin/path prefixeszh(optional):
(Optional) Which issue(s) this PR fixes:
Fixes #95 #146
(optional) The PR that updates user documentation: