fix: restore Java parser fixes (#275/#278/#280), GDScript support (#316), and refresh stdio banner test#364
Closed
npkriami18 wants to merge 5 commits intotirth8205:mainfrom
Closed
Conversation
…odes (tirth8205#278) tree-sitter-java wraps extends/implements clauses in superclass and super_interfaces nodes whose .text includes the keyword. The _get_bases() function was storing the full text (e.g. "implements UserRepository") as the INHERITS edge target instead of just the type name. This caused inheritors_of queries to fail — the query looks up edges by the qualified class name or bare name, neither of which matches "implements UserRepository". Adds a Java-specific branch in _get_bases() that drills into the AST children to extract type_identifier nodes (including generic_type for parameterized interfaces like IBar<String>). C#/Kotlin are unaffected and retain the existing behavior. (cherry picked from commit 8104eb7)
(cherry picked from commit 112a442)
PR tirth8205#290 (cc169af) added show_banner=False to the production mcp.run(transport="stdio") call to silence the FastMCP banner under MCP stdio clients, but the assertion in TestServeMainTransport.test_stdio_calls_mcp_run_stdio was never refreshed to match. The test has been failing on main ever since. Co-authored-by: Copilot <[email protected]>
…h8205#275) tree-sitter-java places type_identifier (return type) before identifier (method name) in method_declaration nodes. The generic _get_name() loop matched type_identifier first, causing methods to be indexed under their return type instead of their actual name. For example: * `public String getName()` was indexed as "String" instead of "getName", and * `public ConfigBean getUtilityIngestionBean()`was indexed as "ConfigBean". This broke callers_of,callees_of, and children_of queries for any Java method with a non-void, non-generic return type. Adds a Java-specific branch in _get_name() that returns the first identifier child for method_declaration nodes, following the same pattern as the Go fix (field_identifier) from PR tirth8205#166. Kotlin & Scala is unaffected — its syntax places the name before the return type. (cherry picked from commit 9a88f20)
Java imports like `import com.example.auth.User` were stored as raw dot-notation strings because _do_resolve_module() had no Java branch. This caused `importers_of` queries to return 0 — the query looks for file path targets, but the stored edges had raw import strings. Adds a Java branch that converts dot-notation to a relative path (com/example/auth/User.java) and walks up from the caller's directory to find the source root. This resolves same-source-root imports (the common case in Maven modules). Also handles: - Static imports (import static pkg.Class.member) — strips the member name and resolves to the class file - Wildcard imports (import pkg.*) — skipped, can't resolve to one file - JDK/library imports (java.util.*) — remain unresolved (no local file) (cherry picked from commit 088c281)
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.
Follow-up to #361 / #362. Same silent-revert pattern, three more victims.
What this PR does
Five cherry-picks onto
main, preserving authorship:8104eb79a88f20088c281112a442Plus a 1-line test fix:
TestServeMainTransport.test_stdio_calls_mcp_run_stdiowas assertingcalls == [{"transport": "stdio"}]but PR #290 (cc169af) had addedshow_banner=Falseto the production call without updating the test. Refreshed the assertion to match.Why these were failing
Same root cause as #362: the
3cf31ec/cb9d25achore: resolve merge conflicts with maincommits accepted the stale feature-branch side ofparser.pyfor the ReScript PR (#323) and Julia PR (#319). Both feature branches forked fromdb2d2df— before the Java/GDScript fixes landed — sogit mergeauto-resolved the Java and GDScript hunks in favour of the side that never had them. See #361 for the full pattern.Test results
15 failures fixed. Remaining 45+6 are explicitly out of scope:
test_finds_calls— genuine PHP parser bug (namespace resolution returns\dirnameinstead of the user's call). Separate issue.test_module_scope_calls_in_notebook/ similar stragglers — covered by fix: restore dropped parser fixes from #274 / #276 / #285 (+ Julia impl from #319) #362.TestApplyToolFiltererrors —FastMCP._tool_managerprivate-API bug froma3a043b. Separate issue.This PR and #362 are independent and can be merged in either order. Applying both together yields the full 60 → ≤8 improvement.
Quality gate
uv run ruff check code_review_graph/parser.py tests/test_main.pyuv run pytest tests/test_multilang.py::TestJavaParsing tests/test_multilang.py::TestJavaImportResolution tests/test_multilang.py::TestGDScriptParsing tests/test_main.py::TestServeMainTransport— 25 passedConflict resolution notes
parser.pyEXTENSION_TO_LANGUAGE: kept both.res/.resi(ReScript, HEAD) and.gd(GDScript, cherry-pick side).tests/test_multilang.py: kept HEAD side (preservesTestJuliaParsingclass and ReScript cross-module resolver tests that the cherry-pick side did not have).cc @tirth8205 — second restoration PR for the same merge-resolution bug tracked in #361. @krmahadevan @Mornor — pinging as original authors; please flag if I misread any intent during the cherry-pick.