fix(extract): emit Java field type references#1485
Closed
oleksii-tumanov wants to merge 1 commit into
Closed
Conversation
safishamsi
pushed a commit
that referenced
this pull request
Jun 27, 2026
Java field declarations produced no `references` edge for their type, so a class's data dependencies (its field types) were missing from the graph even though parameter and return types were already captured. The field handler now collects the declared type via the same `_java_collect_type_refs` helper used elsewhere, preserving the `field` and `generic_arg` contexts and skipping primitives (int/boolean/etc.), matching the existing C#/PHP/Kotlin field handlers. Ported from PR #1485 by @oleksii-tumanov. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
safishamsi
pushed a commit
that referenced
this pull request
Jun 27, 2026
Annotations on Java classes/interfaces/records (e.g. @service, @entity) produced no edge, so type-level framework wiring was invisible even though method-level annotations were already captured. The class/interface/record handler now emits `references` edges with the existing `attribute` context, reusing the renamed `_java_annotation_names` helper (was `_java_method_annotation_names`; logic unchanged) at both the type and method call sites. Ported from PR #1487 by @oleksii-tumanov. Resolved an additive test conflict with #1485 by keeping both new test functions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
Thanks @oleksii-tumanov — clean fix, mirrors the existing C#/PHP/Kotlin field handlers and reuses the primitive-skipping collector (verified |
safishamsi
pushed a commit
that referenced
this pull request
Jun 27, 2026
Java field declarations produced no `references` edge for their type, so a class's data dependencies (its field types) were missing from the graph even though parameter and return types were already captured. The field handler now collects the declared type via the same `_java_collect_type_refs` helper used elsewhere, preserving the `field` and `generic_arg` contexts and skipping primitives (int/boolean/etc.), matching the existing C#/PHP/Kotlin field handlers. Ported from PR #1485 by @oleksii-tumanov. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
safishamsi
pushed a commit
that referenced
this pull request
Jun 27, 2026
Annotations on Java classes/interfaces/records (e.g. @service, @entity) produced no edge, so type-level framework wiring was invisible even though method-level annotations were already captured. The class/interface/record handler now emits `references` edges with the existing `attribute` context, reusing the renamed `_java_annotation_names` helper (was `_java_method_annotation_names`; logic unchanged) at both the type and method call sites. Ported from PR #1487 by @oleksii-tumanov. Resolved an additive test conflict with #1485 by keeping both new test functions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
safishamsi
added a commit
that referenced
this pull request
Jun 27, 2026
Dates the 0.8.50 CHANGELOG and bumps the version. Highlights: WPF/XAML extraction + ViewModel/binding links (#1460/#1473), Objective-C relationship fixes (#1475), .vue SFC grammar fix (#1468), Metal shader indexing (#1480), Java field/annotation references (#1485/#1487), portable wiki links (#1444), *_BASE_URL backend overrides (#1458), non-streaming OpenAI-compatible calls (#1223), reflect --if-stale sidecar freshness (#1470), label --missing-only (#1481), canvas grid + case-fold dedup (#1452/#1453), the Read|Glob hook extension fix (#1463), and the no-API-key skill clarification (#1461). 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
referencesedges for Java field typesfieldandgeneric_argcontextsWhy
Java field types were missing from the extraction cache and final graph, hiding composition and injected dependencies in Java projects.
Fixes #1484
Result
The extraction cache now includes:
{"source": "fieldreference_checkoutservice", "target": "fieldreference_paymentgateway", "relation": "references", "confidence": "EXTRACTED", "context": "field"}Testing
uv run --frozen pytest tests/test_languages.py tests/test_java_type_resolution.py -q -k java(16 passed, 261 deselected)uv run --frozen pytest tests/ -q --tb=short(2413 passed, 28 skipped)uv run --frozen ruff check graphify/extract.py tests/test_languages.py(passed)