fix(java-enum): resolve enum methods from enum_body_declarations#984
fix(java-enum): resolve enum methods from enum_body_declarations#984sahil-mangla wants to merge 1 commit into
Conversation
|
Thanks. I have triaged this as a 0.9.1-rc Java extraction bug fix. Review should verify that enum_body_declarations handling fixes enum methods without changing normal class/interface method extraction or introducing duplicate method definitions. |
|
Thanks for splitting this out of #893 so quickly — exactly the atomic shape we asked for, and the |
|
Thanks for this, @sahil-mangla — the Java enum-method extraction fix is genuinely good work, and the One blocker before it can land: the PR also carries an undocumented change to the call-resolution core — Could you split this into two PRs?
Really appreciate the contribution — just want each change reviewable on its own merits. |
41f4196 to
3d6a29c
Compare
Signed-off-by: sahil-mangla <manglasahil2017@gmail.com>
3d6a29c to
4c01d66
Compare
What does this PR do?
Resolves extraction and calling-edge issues for Java enums that define methods (e.g.,
isWeekendorlabelincp_enum_method_java).In tree-sitter-java, an enum's methods are declared within an
enum_body_declarationsblock, which is a nested child ofenum_bodyrather than a direct child of the enum declaration itself. Previously:find_class_bodyresolved only the rawenum_bodynode.extract_class_methodsiterated over this body, encountering constants and separator tokens, but missing the nestedenum_body_declarationsblock. As a result, method definitions were ignored and calling edges failed to resolve.This change:
find_class_bodyto correctly scan and inspect theenum_bodyfor nestedenum_body_declarationsnodes and return them.enum_bodyandenum_body_declarationsto the list of recognized body containers inpush_class_body_childrenso the AST traverser pushes all method declarations under the correct enum QN namespace.extract_defs.c.Checklist
git commit -s) — required, CI rejects unsigned commits (DCO, see CONTRIBUTING.md)make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)