From b4d209ae9b144bb325239faa7663ff9a45ae79b8 Mon Sep 17 00:00:00 2001 From: Synvoya <16019863+Synvoya@users.noreply.github.com> Date: Sat, 4 Jul 2026 16:35:30 +1000 Subject: [PATCH] fix(apex): emit extends edges for interface multiple inheritance interface X extends A, B captured the parent list in iface_re group 2 but the handler only read group 1, so no inheritance edge was emitted. Split the parent list and emit one extends edge per parent (mirroring the class branch). --- graphify/extract.py | 10 ++++++++++ tests/test_languages.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/graphify/extract.py b/graphify/extract.py index f1cb548d6..8b8437ee4 100644 --- a/graphify/extract.py +++ b/graphify/extract.py @@ -6297,6 +6297,16 @@ def add_edge(src: str, tgt: str, relation: str, line: int, add_node(iface_nid, iface_name, lineno) add_edge(file_nid if current_class_nid is None else current_class_nid, iface_nid, "contains", lineno) + if im.group(2): + for parent in im.group(2).split(","): + parent = parent.strip() + if parent: + parent_nid = _make_id(stem, parent) + if parent_nid not in seen_ids: + parent_nid = _make_id(parent) + if parent_nid not in seen_ids: + add_node(parent_nid, parent, lineno) + add_edge(iface_nid, parent_nid, "extends", lineno, confidence="INFERRED") pending_annotations = [] continue diff --git a/tests/test_languages.py b/tests/test_languages.py index ca5169d54..1ba9dc99c 100644 --- a/tests/test_languages.py +++ b/tests/test_languages.py @@ -2627,6 +2627,16 @@ def test_apex_interface_extraction(): labels = _labels(r) assert "Notifiable" in labels +def test_apex_interface_extends(tmp_path): + source = tmp_path / "PaymentProcessor.cls" + source.write_text( + "public interface PaymentProcessor extends Processor, Auditable { void process(); }\n" + ) + result = extract_apex(source) + inheritance = _edge_labels(result, "extends") | _edge_labels(result, "implements") + assert ("PaymentProcessor", "Processor") in inheritance + assert ("PaymentProcessor", "Auditable") in inheritance + def test_apex_method_extraction(): r = extract_apex(FIXTURES / "sample.cls") labels = _labels(r)