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:1899–1916  ·  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

1897 * interface calls (List/Stream/Predicate, no in-project impl) resolving via the
1898 * strict type_dispatch path instead of being downgraded to interface_dispatch. */
1899static bool java_emit_interface_resolution(JavaLSPContext *ctx, const char *iface_qn,
1900 const char *mname) {
1901 int impl_count = 0;
1902 const char *sole_impl = java_find_sole_impl(ctx, iface_qn, mname, &impl_count);
1903 if (impl_count == 1 && sole_impl) {
1904 const CBMRegisteredFunc *cf = cbm_registry_lookup_method(ctx->registry, sole_impl, mname);
1905 const char *target =
1906 cf ? cf->qualified_name : cbm_arena_sprintf(ctx->arena, "%s.%s", sole_impl, mname);
1907 java_emit_resolved(ctx, target, "lsp_interface_resolve", 0.85f);
1908 return true;
1909 }
1910 if (impl_count >= 2) {
1911 java_emit_resolved(ctx, cbm_arena_sprintf(ctx->arena, "%s.%s", iface_qn, mname),
1912 "lsp_interface_dispatch", 0.80f);
1913 return true;
1914 }
1915 return false; /* impl_count == 0: caller falls back to type_dispatch. */
1916}
1917
1918static void resolve_method_call(JavaLSPContext *ctx, TSNode call) {
1919 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