fix(extract): emit Java enum constants as nodes with case_of edges#1719
Closed
ivanzhl wants to merge 1 commit into
Closed
fix(extract): emit Java enum constants as nodes with case_of edges#1719ivanzhl wants to merge 1 commit into
ivanzhl wants to merge 1 commit into
Conversation
Collaborator
|
Merged into |
safishamsi
added a commit
that referenced
this pull request
Jul 8, 2026
Correctness batch since 0.9.9: TS/JS builtin-typed receiver no longer collapses onto a same-named user symbol (#1726); no cross-language calls edges (#1718); build_merge ambiguous-alias no longer merges unrelated files (#1713); base-class stubs tagged with origin_file (#1707); Java enum constants as nodes (#1719); rebuild recovers from a deleted hook cwd (#1703); per-chunk semantic-cache checkpoint (#1715); SECURITY.md http-transport doc + GRAPHIFY_MAX_GRAPH_BYTES tests (#1714, #1722). Nine merged PRs plus #1726. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Addresses #1700 (Java only)
Problem
Java enum constants aren't extracted as nodes. The enum type node is created,
but its members (
ErrorCode.GAME_DONE) don't exist in the graph, so"where is this constant defined/used" can't find them.
enum_declarationis inJava's class_types, so the walker recurses into the enum body, but
enum_constantmatches no handled type and falls through, dropping the constant.Fix
Add
_java_extra_walk(dispatched fortree_sitter_java) that emits eachenum_constantas a child node with acase_ofedge to the enum, mirroring theexisting Swift
enum_entryhandling.Before:
NODE ErrorCode
EDGE ErrorCode.java --contains--> ErrorCode
After:
NODE ErrorCode
NODE OK
NODE GAME_DONE
EDGE ErrorCode.java --contains--> ErrorCode
EDGE ErrorCode --case_of--> OK
EDGE ErrorCode --case_of--> GAME_DONE
Note for reviewer
For a constant with an anonymous body (
MONDAY { void greet(){} }), the handlerdescends into the body and attaches its methods to the constant node rather than
letting them fall to file scope. Without descending, those methods would be dropped. Side effect: it de-collides a
constant's method from a same-named enum method.
Out of scope
isSystem() --references--> SYSTEM) — definitions only.file --contains--> enumedge (constructor shares the enum's name) — unrelated, untouched.