feat(SM-9): add Java integration test with class Child extends Parent fixture

Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/cc58249b-42f1-45a9-89fb-e3917e4d0171

Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-08 18:19:26 +00:00 committed by GitHub
parent c7e701f2fe
commit 37563a3152
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 55 additions and 1 deletions

View file

@ -17,7 +17,6 @@
"commander": "^12.0.0",
"cors": "^2.8.5",
"express": "^4.19.2",
"gitnexus-shared": "file:../gitnexus-shared",
"glob": "^11.0.0",
"graphology": "^0.25.4",
"graphology-indices": "^0.17.0",

View file

@ -0,0 +1,5 @@
package models;
public class Child extends Parent {
public void childOnly() {}
}

View file

@ -0,0 +1,5 @@
package models;
public class Parent {
public String parentMethod() { return "hello"; }
}

View file

@ -0,0 +1,10 @@
package services;
import models.Child;
public class App {
public void run() {
Child c = new Child();
c.parentMethod();
}
}

View file

@ -2098,3 +2098,38 @@ describe('Cross-class method chain resolution (Java) — #575', () => {
expect(cityAccess.length).toBe(1);
});
});
// ---------------------------------------------------------------------------
// SM-9: lookupMethodByOwnerWithMRO — class Child extends Parent
// child.parentMethod() resolves to Parent#parentMethod via MRO parent walk.
// ---------------------------------------------------------------------------
describe('Java Child extends Parent — inherited method resolution (SM-9)', () => {
let result: PipelineResult;
beforeAll(async () => {
result = await runPipelineFromRepo(
path.join(FIXTURES, 'java-child-extends-parent'),
() => {},
);
}, 60000);
it('detects Parent and Child classes', () => {
const classes = getNodesByLabel(result, 'Class');
expect(classes).toContain('Parent');
expect(classes).toContain('Child');
});
it('emits EXTENDS edge: Child → Parent', () => {
const extends_ = getRelationships(result, 'EXTENDS');
expect(edgeSet(extends_)).toContain('Child → Parent');
});
it('resolves c.parentMethod() to Parent#parentMethod via MRO walk', () => {
const calls = getRelationships(result, 'CALLS');
const parentMethodCall = calls.find(
(c) => c.target === 'parentMethod' && c.targetFilePath.includes('Parent'),
);
expect(parentMethodCall).toBeDefined();
});
});