MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / java_emit_interface_resolution

Function java_emit_interface_resolution

internal/cbm/lsp/java_lsp.c:1964–1981  ·  view source on GitHub ↗

Emit the resolution for an interface-typed receiver `iface_qn` calling * `mname`: a sole concrete in-project impl → lsp_interface_resolve (resolved * to that impl's method, with a synthesized QN when the method isn't in the * method registry); two-or-more impls → lsp_interface_dispatch on a synthesized * iface-qualified target. Returns true when it emitted (caller should return), * false when

Source from the content-addressed store, hash-verified

1962 * interface calls (List/Stream/Predicate, no in-project impl) resolving via the
1963 * strict type_dispatch path instead of being downgraded to interface_dispatch. */
1964static bool java_emit_interface_resolution(JavaLSPContext *ctx, const char *iface_qn,
1965 const char *mname) {
1966 int impl_count = 0;
1967 const char *sole_impl = java_find_sole_impl(ctx, iface_qn, mname, &impl_count);
1968 if (impl_count == 1 && sole_impl) {
1969 const CBMRegisteredFunc *cf = cbm_registry_lookup_method(ctx->registry, sole_impl, mname);
1970 const char *target =
1971 cf ? cf->qualified_name : cbm_arena_sprintf(ctx->arena, "%s.%s", sole_impl, mname);
1972 java_emit_resolved(ctx, target, "lsp_interface_resolve", 0.85f);
1973 return true;
1974 }
1975 if (impl_count >= 2) {
1976 java_emit_resolved(ctx, cbm_arena_sprintf(ctx->arena, "%s.%s", iface_qn, mname),
1977 "lsp_interface_dispatch", 0.80f);
1978 return true;
1979 }
1980 return false; /* impl_count == 0: caller falls back to type_dispatch. */
1981}
1982
1983static void resolve_method_call(JavaLSPContext *ctx, TSNode call) {
1984 TSNode obj = ts_node_child_by_field_name(call, "object", 6);

Callers 1

resolve_method_callFunction · 0.85

Calls 4

java_find_sole_implFunction · 0.85
java_emit_resolvedFunction · 0.85
cbm_arena_sprintfFunction · 0.50

Tested by

no test coverage detected