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).
This commit is contained in:
Synvoya
2026-07-04 11:26:54 +01:00
committed by safishamsi
parent e2ef4ef3d1
commit 53c769d23d
2 changed files with 20 additions and 0 deletions
+10
View File
@@ -6297,6 +6297,16 @@ def extract_apex(path: Path) -> dict:
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
+10
View File
@@ -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)