Skip to content

fix(extract): skip Java type parameter references#1518

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

fix(extract): skip Java type parameter references#1518
oleksii-tumanov wants to merge 1 commit into
Graphify-Labs:v8from
oleksii-tumanov:fix/java-type-parameter-references

Conversation

@oleksii-tumanov

@oleksii-tumanov oleksii-tumanov commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • track Java type parameters declared by enclosing types, methods, and constructors
  • skip unqualified references to those parameters while preserving real type references
  • cover per-file output and cross-file collisions with real classes of the same name

Fixes #1517

Result

Label-normalized verification summary from the final extraction:

{
  "type_parameter_nodes": [],
  "type_parameter_reference_edges": [],
  "retained_edges": [
    {
      "source": "Box",
      "target": "Base",
      "relation": "inherits",
      "confidence": "EXTRACTED"
    },
    {
      "source": "convert",
      "target": "Payload",
      "relation": "references",
      "context": "generic_arg",
      "confidence": "EXTRACTED"
    }
  ]
}

Testing

  • uv run --frozen pytest tests/test_languages.py tests/test_java_type_resolution.py -q -k java_type_parameters (2 passed)
  • uv run --frozen pytest tests/ -q --tb=short (2496 passed, 3 skipped)
  • uv run --frozen ruff check graphify/extract.py tests/test_languages.py tests/test_java_type_resolution.py (passed)

@oleksii-tumanov oleksii-tumanov force-pushed the fix/java-type-parameter-references branch from 480242d to 862008b Compare June 28, 2026 17:21
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>
safishamsi added a commit that referenced this pull request Jun 28, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@safishamsi

Copy link
Copy Markdown
Collaborator

Thanks @oleksii-tumanov — clean fix for the nit flagged when #1511 landed. Landed on v8 in 8b9a998 with your authorship. The in-scope type-parameter collection (class/interface/record/method/constructor, bounded + multiple) is correctly scoped to the declaring node, so a real class sharing a name with a type param elsewhere is still referenced, and nested generics keep the real types. Verified: Box<T> extends Container<T>inherits Container with no T edge; Map<String,List<T>> keeps Map/String/List. Closing as merged-by-port — ships in 0.9.1.

@safishamsi safishamsi closed this Jun 28, 2026
safishamsi pushed a commit that referenced this pull request Jun 28, 2026
A Java record's component types produced no edges, so a record's data dependencies
were invisible. The record_declaration handler now emits `references` edges from
each component type (field context; generic_arg for type arguments), skipping
primitives and — via #1518's in-scope type-parameter filtering — the record's own
type parameters. Handles standard, generic, primitive, and varargs components.

Ported from PR #1520 by @oleksii-tumanov (clean 3-way onto v8; builds on #1518).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
safishamsi added a commit that referenced this pull request Jun 28, 2026
Patch over 0.9.0: completes the node-ID work (fully closes #1504 via injective
salt #1522), stops origin_file leaking into graph.json (#1516), extends cross-file
stub disambiguation to the six dedicated extractors (#1515), Java type-param skip
(#1518) + record component refs (#1519), prunes a deleted import's edge on update
(#1521), and retries rate-limited (429) requests instead of dropping chunks (#1523).
All non-breaking.

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 type parameters are emitted as type-reference nodes

2 participants