Skip to content

fix(extract): emit Java field type references#1485

Closed
oleksii-tumanov wants to merge 1 commit into
Graphify-Labs:v8from
oleksii-tumanov:fix/java-field-type-references
Closed

fix(extract): emit Java field type references#1485
oleksii-tumanov wants to merge 1 commit into
Graphify-Labs:v8from
oleksii-tumanov:fix/java-field-type-references

Conversation

@oleksii-tumanov

Copy link
Copy Markdown
Contributor

Summary

  • emit references edges for Java field types
  • preserve field and generic_arg contexts

Why

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)

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

Copy link
Copy Markdown
Collaborator

Thanks @oleksii-tumanov — clean fix, mirrors the existing C#/PHP/Kotlin field handlers and reuses the primitive-skipping collector (verified int/boolean emit nothing). Landed on v8 in 8d25ea4 with your authorship. Closing as merged-by-port.

@safishamsi safishamsi closed this Jun 27, 2026
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>
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.

Java field declarations do not emit type-reference edges

2 participants