GitNexus/gitnexus/test/fixtures/lang-resolution/java-method-chain-cross-class/App.java
Gergő Magyar cb772b9e29
feat: lookupMethodByOwner index for O(1) cross-class chain resolution (#665)
Add eagerly-populated methodByOwner index to SymbolTable, keyed by
ownerNodeId\0methodName. Used by walkMixedChain as a fast path for
resolving intermediate method calls in cross-class chains like
user.getAddress().getCity().getZipCode(), avoiding expensive fuzzy
lookups when the owner type is already known.

Handles overloaded methods: returns the first match when all overloads
share the same returnType, undefined when return types differ (ambiguous).

- Add lookupMethodByOwner to SymbolTable interface + implementation
- Add resolveMethodByOwner helper in call-processor.ts
- Add fast path in walkMixedChain before resolveCallTarget fallback
- Add Java cross-class chain fixture + 6 integration tests
- Add 148 unit tests for methodByOwner index behavior
2026-04-06 10:20:04 +01:00

16 lines
542 B
Java

public class App {
// Two-step pure method chain: user.getAddress().save()
public static void twoStepChain(User user) {
user.getAddress().save();
}
// Three-step pure method chain: user.getAddress().getCity().getZipCode()
public static void threeStepChain(User user) {
user.getAddress().getCity().getZipCode();
}
// Mixed chain: method then field then method: user.getAddress().city.getZipCode()
public static void mixedChain(User user) {
user.getAddress().city.getZipCode();
}
}