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
| 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. */ |
| 1899 | static 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 | |
| 1918 | static void resolve_method_call(JavaLSPContext *ctx, TSNode call) { |
| 1919 | TSNode obj = ts_node_child_by_field_name(call, "object", 6); |
no test coverage detected