Skip to content

fix(java): extract bare type names from superclass/super_interfaces nodes#278

Merged
tirth8205 merged 1 commit intotirth8205:mainfrom
krmahadevan:bugfix/extract_bare_type_names_from_superclass_super_interface
Apr 18, 2026
Merged

fix(java): extract bare type names from superclass/super_interfaces nodes#278
tirth8205 merged 1 commit intotirth8205:mainfrom
krmahadevan:bugfix/extract_bare_type_names_from_superclass_super_interface

Conversation

@krmahadevan
Copy link
Copy Markdown
Contributor

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). C#/Kotlin are unaffected and retain the existing behavior.

…odes

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.
@tirth8205 tirth8205 merged commit 8104eb7 into tirth8205:main Apr 18, 2026
1 check passed
npkriami18 pushed a commit to npkriami18/code-review-graph that referenced this pull request Apr 21, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants