fix(java): extract method name from identifier, not return type#275
Open
krmahadevan wants to merge 1 commit intotirth8205:mainfrom
Open
fix(java): extract method name from identifier, not return type#275krmahadevan wants to merge 1 commit intotirth8205:mainfrom
krmahadevan wants to merge 1 commit intotirth8205:mainfrom
Conversation
d78a14e to
bb33628
Compare
Author
|
@tirth8205 - Can you please help review this PR ? I am leveraging This is the other PR #278 |
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.
bb33628 to
a6b620e
Compare
Author
|
This is the 3rd PR #280 All of these will basically help us reduce claude token usage when working with java codebases wherein we use |
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.
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", andpublic 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 #166.
Kotlin & Scala is unaffected — its syntax places the name before the return type.