Skip to content

Commit 1575f86

Browse files
committed
test(extract): preserve cross-language JVM inheritance
Assisted-by: OpenAI Codex (GPT-6)
1 parent 35adf43 commit 1575f86

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎tests/test_extract.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4946,6 +4946,21 @@ def test_rewire_binds_builtin_named_supertype_stub_within_same_language():
49464946
assert edges[0]["target"] == "pkg_support_Exception"
49474947

49484948

4949+
def test_cross_file_inheritance_resolves_across_jvm_languages(tmp_path):
4950+
"""A Kotlin subclass must keep its Java base despite the extension difference."""
4951+
base = tmp_path / "Base.java"
4952+
child = tmp_path / "Child.kt"
4953+
base.write_text("package models;\npublic class Base {}\n", encoding="utf-8")
4954+
child.write_text("import models.Base\nclass Child : Base()\n", encoding="utf-8")
4955+
result = extract([base, child], root=tmp_path, cache_root=tmp_path / "cache", parallel=False)
4956+
base_node = next(n for n in result["nodes"]
4957+
if n["label"] == "Base" and n.get("source_file") == "Base.java")
4958+
child_node = next(n for n in result["nodes"]
4959+
if n["label"] == "Child" and n.get("source_file") == "Child.kt")
4960+
assert any(e["relation"] == "inherits" and e["source"] == child_node["id"]
4961+
and e["target"] == base_node["id"] for e in result["edges"])
4962+
4963+
49494964
def test_rewire_builtin_supertype_guard_folds_case_insensitive_languages():
49504965
"""#2812: PHP resolves class names case-insensitively, so `extends \\exception`
49514966
names the same built-in as `extends \\Exception` and must be blocked too."""

0 commit comments

Comments
 (0)