Repository navigation
Call resolver: choose Java overloads by argument count; ties are ambiguous (#3835) - #3840
Merged
Merged
Conversation
…guous (#3835) The detector records, for java (language flag calls_out_arities), the distinct argument counts each callee is called with (_call_arity: one bounded linear pass; commas inside nested calls, lambdas, initializers and generic type arguments do not count). It is persisted (function_data and synthetic_unit_data.calls_out_arities, healed into old DBs) and rehydrated. For OVERLOAD_LANGS (java), a confident call to one of several overloads on a class now links to the overload declaring that many parameters -- one row per overload the counts pick, so a caller of two overloads gets both -- and a count that matches several overloads or none becomes the ambiguous step `overload` (a row, never an edge). vs scip-java on gson: confident precision 59.8% -> 92.7%, recall 36.3% -> 41.0%, resolution recall 38.7% -> 43.6%, strict precision 54.4% -> 82.9%; no wrong link is an overload choice any more. Python and TypeScript unchanged; zero-dependency golden masters unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3835 (epic #3772).
The problem: when a Java class has several methods of the same name (overloads), the resolver linked any call to one of them to whichever came first in the file. Measured vs scip-java on gson (#3838), 1,653 of 1,923 confident
wronglinks were that arbitrary pick.This is option B from the plan: choose the overload by argument count, and leave the call ambiguous when the count can't choose.
detector.py, language flagcalls_out_arities, Java only): records the distinct argument counts each callee is called with._call_aritymakes one bounded, linear pass with no regex.new HashMap<K, V>(,Map.<K, V>of() don't count.<comparison (f(i < n, x)) isn't mistaken for type arguments.calls_out_aritiescolumn onfunction_dataandsynthetic_unit_data, healed into older databases;test_fcall_data.py, following thedef_shapeprecedent from call resolver (ts/js): only a binding is bare-callable; signatures are never targets (#3757, #3758, #3759) #3767.call_resolver.py,OVERLOAD_LANGS = {"java"}), for a confident call whose target has same-named siblings on the same class in the same file:overload. That's a row, never an edge, the same rule as every other ambiguous step.overloadjoins the scorer's ambiguous steps;ambiguous/overloadhint;explain_callhandles several rows per callee, and shows argument counts and each definition's parameter count.Results vs scip-java on gson (7,858 reference edges)
external/unmapped_dst(not gated)Ungated moves, and why:
ambiguous/overload, where the first overload is kept only as a guess, and ambiguous rows are never edges. The same effect as call resolver (ts/js): only a binding is bare-callable; signatures are never targets (#3757, #3758, #3759) #3767's signature targets.The simulation run before any code, assuming perfect argument counts, predicted about 92% and about 41%. The measured result matches it.
Net change in the other languages: Python and TypeScript are unchanged to the decimal, as shown below. The change is Java-only by construction, and a guard test pins that.
Known limit: same-arity overloads (
fromJson(String, Class)vsfromJson(Reader, Type)) stay ambiguous. Choosing between them would need argument types, which a regex engine doesn't have.Type of change
CI checklist
python tests/tools/audit_check.py: all clear; format cleantest_call_arity_counts_top_level_argumentsandtest_detector_java_records_call_site_arities;pytestfrom/tmpDifferential Scan target
crucible_check.pyin zero-dependency mode passes with no re-bless. The golden masters don't change, since overload choice stays within one file and ambiguous rows don't feed the file graph.crucible-audit (full-precision)is the check for that half.Verification
python tests/tools/callgraph_check.py --skip tree-sitter:The Java baseline is regenerated to the new numbers. The docs (
graph_accuracy.md,function_call_graph.md, README, roadmap), the miss-sweep skill's pattern table, and the coverage chart are updated.🤖 Generated with Claude Code
https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt
Generated by Claude Code