fix(extract): emit Java generic parent relationships#1511
Closed
oleksii-tumanov wants to merge 1 commit into
Closed
fix(extract): emit Java generic parent relationships#1511oleksii-tumanov wants to merge 1 commit into
oleksii-tumanov wants to merge 1 commit into
Conversation
safishamsi
pushed a commit
that referenced
this pull request
Jun 28, 2026
A generic parent — `class Foo extends Bar<T>` or `implements List<T>` — is a `generic_type` node in the tree, but the inheritance extractor only fired on a bare `type_identifier`, so those inherits/implements edges were silently dropped. The parent type is now unwrapped to its base (`Bar<T>` -> `Bar`) for the inherits/implements edge, and the type arguments are emitted as `generic_arg` references. Ported from PR #1511 by @oleksii-tumanov. Known pre-existing limitation (not introduced here, worth a separate follow-up): the extractor has no type-parameter tracking, so a bare parameter like `T` in `extends Container<T>` still produces a `generic_arg` reference to `T`; the inherits/implements edge itself always targets the real base type, never `T`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
Thanks @oleksii-tumanov — confirmed the bug (generic parents are |
safishamsi
pushed a commit
that referenced
this pull request
Jun 28, 2026
The generic-parent support (#1511) emitted a spurious references/generic_arg edge (and a sourceless stub node) for a bare type parameter — the T in `class Box<T> extends Container<T>` — because the Java extractor had no type- parameter tracking. _java_collect_type_refs now collects the in-scope type- parameter names (walking class/interface/record/method/constructor declarations, including bounded and multiple params) and skips references to them, while keeping every real type. Scoped to the declaring node, so a real class that shares a name with a type parameter elsewhere is still referenced. Ported from PR #1518 by @oleksii-tumanov. Closes the nit flagged when #1511 landed. 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.
Summary
inheritsandimplementsedges for parameterized Java parentsgeneric_argreferences for parent type arguments and cover class and interface casesFixes #1510
Result
Label-normalized relevant edges from the final patch:
[ { "source": "Service", "target": "Base", "relation": "inherits", "confidence": "EXTRACTED" }, { "source": "Service", "target": "Dependency", "relation": "references", "confidence": "EXTRACTED", "context": "generic_arg" }, { "source": "Service", "target": "Handler", "relation": "implements", "confidence": "EXTRACTED" }, { "source": "Service", "target": "Event", "relation": "references", "confidence": "EXTRACTED", "context": "generic_arg" } ]Testing
uv run --frozen pytest tests/test_languages.py -q -k java_generic_parents(1 passed)uv run --frozen pytest tests/ -q --tb=short(2442 passed, 28 skipped)uv run --frozen ruff check graphify/extract.py tests/test_languages.py(passed)