Java: `codegraph_explore` blast radius misses callers for concrete-class `@Resource`/`@Autowired` field injection (package-correlated)
Summary
codegraph_explore reports 3 callers for a method that grep shows is called from 10 files (15 call sites). The method is invoked exclusively through Spring @Resource / @Autowired field injection where the field type is a concrete @Component class, not an interface. The 7 missed callers cluster in specific packages (controller/, facade/impl/, notify/, support/center/), while the 2 correctly-resolved external callers are both in service/**/impl/ subpackages.
Environment
- codegraph:
v1.2.0 - Language: Java 1.8
- Framework: Spring Boot 2.3.0 + Dubbo 2.6.x
- Project: large monorepo (~118 MyBatis mappers, 59 Dubbo facade impls, 25 service subpackages)
- Index method:
codegraph init+ file-watcher sync
Reproduction
Target method — concrete @Component class, no interface:
@Component
public class MemberDescriptionSupport {
public String getSuperVipName() { ... }
}
Caller pattern (missed) — every missed call site looks like this:
@Component // or @RestController / @Service
public class SomeClass {
@Resource
private MemberDescriptionSupport memberDescriptionSupport; // CONCRETE class, not interface
public void someMethod() {
memberDescriptionSupport.getSuperVipName(); // <- edge dropped
}
}
Expected vs Actual
| Tool | Reported callers |
|---|---|
codegraph_explore blast radius |
3 files |
grep "getSuperVipName(" (ground truth) |
10 files, 15 call sites |
Full breakdown:
| Caller file | Package | Call sites | Seen by codegraph? |
|---|---|---|---|
MemberDescriptionSupport.java (self-call this.getSuperVipName()) |
support/description |
1 | ✅ |
MemberPersonalCenterServiceImpl.java |
service/center/impl |
2 | ✅ |
MemberOpenNoticeServiceImpl.java |
service/rights/impl |
1 | ✅ |
MemberAppController.java |
controller/gw |
2 | ❌ |
MemberEnhancedController.java |
controller/gw/enhanced |
1 | ❌ |
MemberRightsCSCFacadeImpl.java |
facade/impl |
1 | ❌ |
SuperVipOpenSuccessNotifyTargetBuilder.java |
notify/rights |
3 | ❌ |
SendMemberOrderSuccessNotifyTargetBuilder.java |
notify/rights |
1 | ❌ |
MemberOpenSuccessNotifyForNewGiftCardTargetBuilder.java |
notify/rights |
1 | ❌ |
MemberUserInfoServiceSupport.java |
support/center |
2 | ❌ |
Diagnostic observations
-
Self-call works —
this.getSuperVipName()(line 38, insidegetAllMemberTypeMap()) is correctly resolved. Confirms the method definition itself is indexed; the failure is in receiver-type resolution at the call site, not in method indexing. -
Package-correlated — the only 2 correctly-resolved external callers are both in
service/**/impl/packages. All 7 missed callers are incontroller/,facade/impl/,notify/,support/center/. Same injection pattern (@Resourceon a concrete-class field), same target method — different resolution outcome by package. -
Inconsistent within a single query —
codegraph_explorereturned the verbatim source ofSuperVipOpenSuccessNotifyTargetBuilder.java, which visibly contains 3 calls tomemberDescriptionSupport.getSuperVipName()at lines 66, 72, 103. Yet the blast-radius summary listed only "3 callers" and omitted that file. → The file IS indexed; the call EDGE is not connected. This points at the cross-file receiver-type resolver, not at file indexing. -
Distinct from the v0.9.4 interface-dispatch fix — running v1.2.0, which already includes the
interfaceOverrideEdgessynthesis added in v0.9.4 (commit025ebc8). That fix targets the interface-method → override dead-end. Here the field type is already a concrete class — there is no interface hop to synthesize. This is a distinct, still-unresolved receiver-resolution path for concrete-class DI fields, present even on the latest version.
Cross-tool comparison (same analysis paradigm)
The same target method and the same @Resource concrete-class field-injection pattern resolves correctly under codebase-memory-mcp (DeusData) — another pure-static-analysis MCP server in the same paradigm (tree-sitter parse → SQLite graph → MCP caller query; no LLM, no runtime instrumentation, no live Spring context required).
The relevant architectural difference: codebase-memory-mcp ships a per-language "hybrid LSP" pass (a lightweight C type resolver, structurally inspired by Eclipse JDT for Java) that:
- Sees
@Resource private MemberDescriptionSupport memberDescriptionSupport;→ extracts the field with its annotated type. - Sees
memberDescriptionSupport.getSuperVipName()→ traces the receiver back to the field's declared type. - Walks the class hierarchy and emits a
CALLSedge to the resolved target.
This is the receiver-type propagation step that appears to be missing in codegraph for concrete-class DI fields. The v0.9.4 interfaceOverrideEdges synthesis operates as a post-processing patch on top of name matching; codebase-memory-mcp does it at the type-resolution layer instead.
I'm noting this not as "competitor X is better" but to establish that receiver-type resolution for concrete-class DI fields is a solvable problem within the pure-static-analysis paradigm — it doesn't require an LLM or a live runtime, both of which codegraph has explicitly disclaimed. This suggests the gap is an engineering-coverage choice in codegraph's Java extractor, not a fundamental limitation.
(Caveat: codebase-memory-mcp is a larger org-maintained C-based project with per-language type resolvers for 9 languages; codegraph is a solo TypeScript project covering more languages with lighter per-language depth. Different, both valid tradeoffs — but for the Java @Resource concrete-class case specifically, the alternative approach resolves it.)
Likely related
- #967 — framework coverage tracker (Spring)
- #687 — heuristic dynamic-dispatch synthesis ("DI wiring remain opaque")
- v0.9.4
interfaceOverrideEdges— covers interface injection; this case is concrete-class injection (still failing on v1.2.0)
Questions for maintainers
- Is concrete-class
@Resource/@Autowiredfield injection (field type ==@Componentclass, no interface) a known coverage gap distinct from the v0.9.4 interface-dispatch fix? (Confirmed still reproducible on v1.2.0.) - The package-correlated pattern (
service/**/impl/resolved vscontroller//facade/impl//notify/missed) suggests per-package resolver coverage variance — possibly timeout/budget-driven? Are there diagnostics I can run (e.g. a resolver log, per-file skip reasons) to confirm? - Given that receiver-type propagation for concrete-class DI fields is achievable within the same pure-static-analysis paradigm (per
codebase-memory-mcp's Java hybrid-LSP pass, no LLM/runtime), is closing this gap on the roadmap for codegraph's Java extractor, or is it considered out of scope for the lighter tree-sitter-only approach?
Workaround currently in use
grep "<methodName>(" to enumerate callers; reserving codegraph_explore for structure / call-path exploration. (Matches the community guidance from #608.)
Thank you for an outstanding report — the package-correlation breakdown and especially observation 3 ("explore returned the file's source with the calls visible, yet the blast radius omitted it") are what pinned this down. Root cause found, reproduced end-to-end, and fixed in #1191 (which auto-closed this). Answers to your three questions:
1. Is concrete-class @Resource/@Autowired field injection a coverage gap? No — and this was the surprise. Receiver-type resolution for concrete DI fields (field's declared type → validated method lookup) has been in the Java resolver for a long time, independent of the v0.9.4 interface-dispatch work. I rebuilt your exact table as a synthetic Spring repo — same 10 caller files, same 15 call sites, @Resource concrete-class fields, calls in every shape you'd find in the wild (ternary, lambda, anonymous inner class, nested arguments, this.-prefixed, chained) — and a clean v1.2.0 index resolves all 15. So the mechanism wasn't the problem, which raised the real question: why is your index missing edges the resolver demonstrably handles?
2. Package-correlated — timeout/budget-driven? Your instinct was right, with one indirection. What happened, almost certainly: an indexing run on your machine was interrupted partway through the "Resolving refs" phase. On v1.2.0 with a large Java monorepo that's a known hazard — the safety watchdog could kill a perfectly healthy resolution pass on exactly your repo profile (big, method-name-heavy Java; fixed on main via #1122, which landed after v1.2.0 shipped) — though a Ctrl-C, crash, or shutdown mid-index does the same. The references the run never reached stay parked in the database, and here's the actual bug: incremental syncs only re-resolve files that changed, so those parked references were never retried. The files stayed indexed (source visible — your observation 3), but their call edges were gone permanently. The "package correlation" is just the fileset/ordering of the interrupted run, not per-package resolver logic. I reproduced your exact end state — killed a sync mid-resolution on the synthetic repo and got precisely 3 of 10 caller files (the two service/**/impl survivors plus the self-call), stable across any number of later syncs.
You can confirm this in 30 seconds on your index:
sqlite3 .codegraph/codegraph.db "select count(*) from unresolved_refs;"
sqlite3 .codegraph/codegraph.db "select file_path, line from unresolved_refs where reference_name like '%getSuperVipName%';"
A healthy index has ~0 rows at rest. If this matches the diagnosis you'll see a large count, with rows for exactly your 7 missed files at the grep'd line numbers.
3. Is closing the gap on the roadmap? Nothing to close on the receiver-resolution side — no hybrid-LSP pass needed for this case; the type propagation your codebase-memory-mcp comparison describes is already how these calls resolve. The fixes that do ship in the next release: any sync now detects leftover unresolved references and finishes resolving them (so a plain codegraph sync — or any watched file change — automatically heals a wedged index, including one built by v1.2.0), codegraph status warns when an index is in that state instead of passing it off as healthy, and the v1.2.0 watchdog kill that likely caused the interruption in the first place is fixed (#1122).
Recovery today on v1.2.0: run codegraph index (full re-index) from a terminal and let it finish — your 7 missing callers should appear immediately. Once you upgrade to the next release, this class of damage self-heals and can't silently persist again.
If after a full re-index (or the upgrade) you still see missing callers for this method, please reopen — at that point it would be a resolution bug and I'd want the details.