test: add varargs 0-arg fixture and strengthen wildcard import assertions

Finding 1: Added `badCall()` method with 0-arg `fmt.format()` call to the
varargs fixture. Test documents that legacy mode still resolves this call
(arity rejection is registry-primary only). The fixture now exercises both
the success path (2-arg, 3-arg) and the undersupplied path (0-arg).

Finding 2: Strengthened wildcard import test to assert `targetFilePath`
on the CALLS edge (`com/example/models/User.java`), confirming the call
resolved through the wildcard-imported type to the correct file.

Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/2b4e5602-9833-485c-ab48-e1d54fdf8465

Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-11 21:04:27 +00:00 committed by GitHub
parent 7d3ffb4412
commit 85c89828bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 2 deletions

View file

@ -14,5 +14,12 @@ public class Main {
// 3-arg call: satisfies fixed prefix (level) + 2 varargs
fmt.format(2, "hello", "world");
}
public void badCall() {
Formatter fmt = new Formatter();
// 0-arg call: does NOT satisfy the required fixed prefix (int level)
// This should be rejected by arity no CALLS edge to format
fmt.format();
}
}

View file

@ -444,11 +444,23 @@ describe('Java variadic call resolution', () => {
it('resolves 2-arg call to fixed-prefix varargs method format(int, String...) in Formatter.java', () => {
const calls = getRelationships(result, 'CALLS');
const fmtCall = calls.find((c) => c.target === 'format');
const fmtCall = calls.find((c) => c.target === 'format' && c.source === 'run');
expect(fmtCall).toBeDefined();
expect(fmtCall!.source).toBe('run');
expect(fmtCall!.targetFilePath).toBe('com/example/util/Formatter.java');
});
it('0-arg call to format(int, String...) still resolves in legacy mode (arity rejection is registry-only)', () => {
// In REGISTRY_PRIMARY_JAVA=1 mode, `requiredParameterCount = 1` causes
// `javaArityCompatibility` to return 'incompatible' for 0-arg calls,
// preventing the CALLS edge. In default (legacy) mode, arity is not
// enforced so the edge is created. This test documents the legacy
// behavior; the negative assertion is a flip-blocker for registry-primary.
const calls = getRelationships(result, 'CALLS');
const zeroArgFmtCall = calls.find(
(c) => c.target === 'format' && c.source === 'badCall',
);
expect(zeroArgFmtCall).toBeDefined();
});
});
// ---------------------------------------------------------------------------
@ -477,6 +489,7 @@ describe('Java wildcard import resolution', () => {
const calls = getRelationships(result, 'CALLS');
const saveCall = calls.find((c) => c.target === 'save' && c.source === 'run');
expect(saveCall).toBeDefined();
expect(saveCall!.targetFilePath).toBe('com/example/models/User.java');
});
});