Java: same-name overloads collapse to one node in 0.12.1 (get_file_outline/search_graph omit a declaration)

Open
#3,044 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
54/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

Start by reading the Java callable identity work referenced in #2429 and the shared identity discussion in #2342; compare how method declarations and call sites are identified during graph extraction. Reproduce with the two-file fixture and the listed CLI commands in both fast and full modes. Done means the outline and graph contain both label declarations, with each caller linked only to its matching overload.

Written by the indexing model from the issue text.

Description

bug parsing/quality ux/behavior windows
Version

codebase-memory-mcp 0.12.1

Platform

Windows (x64)

Install channel

GitHub release archive / install.sh / install.ps1

Binary variant

ui

What happened, and what did you expect?

Two same-name Java methods in one class that differ only in their parameter lists are stored as a single Method node. The graph keeps the later declaration's line range and drops the earlier declaration, and the surviving node receives the inbound CALLS of both call sites.

With the two-file fixture below, get_file_outline and search_graph return one label node (lines 13-19) although the source has two declarations (label(String) at 9-11 and label(String,int) at 13-19). query_graph confirms the graph itself holds one Method row, so this is not an outline-rendering filter. trace_path label --direction inbound then reports both shortLabel (calls label(String)) and fixedLabel (calls label(String,int)) as callers of the surviving two-argument node.

Expected: one node per declaration, two label rows in the outline, and each caller bound only to its own overload.

Reproduction
  1. <fixture>/src/main/java/probe/overloads/Overloads.java
package probe.overloads;

/**
 * Two same-name instance methods that differ only in their parameter lists.
 * Public-safe, dependency-free reproduction fixture.
 */
public final class Overloads {

	public String label(String value) {
		return "item:" + value;
	}

	public String label(String value, int width) {
		String base = label(value);
		if (base.length() >= width) {
			return base.substring(0, width);
		}
		return base + " ".repeat(width - base.length());
	}
}

<fixture>/src/main/java/probe/overloads/Usage.java

package probe.overloads;

/** Call sites for each overload of {@link Overloads#label}. */
public final class Usage {

	private final Overloads overloads = new Overloads();

	public String shortLabel(String value) {
		return overloads.label(value);
	}

	public String fixedLabel(String value) {
		return overloads.label(value, 8);
	}
}

Line numbers: label(String) 9-11; label(String,int) 13-19; class 7-20.

  1. Commands. <fixture> below was an otherwise empty directory. CBM_CACHE_DIR and CBM_RUNTIME_DIR pointed at empty directories, and index_repository was the first command in that cache, so this is a fresh index with no other project present.
codebase-memory-mcp cli index_repository --repo-path <fixture> --name overload-probe --mode fast
codebase-memory-mcp cli get_file_outline --project overload-probe --file-path src/main/java/probe/overloads/Overloads.java --format json
codebase-memory-mcp cli search_graph --project overload-probe --name-pattern '^label$' --format json
codebase-memory-mcp cli query_graph --project overload-probe --query "MATCH (m:Method) WHERE m.name = 'label' RETURN m.qualified_name, m.start_line, m.end_line" --format json
codebase-memory-mcp cli trace_path --project overload-probe --function-name label --direction inbound --format json
codebase-memory-mcp cli get_code_snippet --project overload-probe --qualified-name overload-probe.src.main.java.probe.overloads.Overloads.label --format json
  1. Actual output (abridged to the relevant fields):
index_repository: nodes=15 edges=23 parse_partial_count=0 parse_unusable_count=0 status=indexed

get_file_outline: total=2
  Overloads Class  7-20
  label     Method 13-19        <- no row for 9-11

search_graph: total=1, has_more=false
  label Method 13-19 in=2 out=0

query_graph: returned=1, total=1
  overload-probe.src.main.java.probe.overloads.Overloads.label  13  19

trace_path: callers_total=2
  Usage.shortLabel  1
  Usage.fixedLabel  1

get_code_snippet: start_line=13 end_line=19; only the two-argument body

search_code --pattern label still reports matches on line 9 and line 13 (total_grep_matches=6), so text search sees both declarations while the graph holds one Method node. A separate clean cache indexed with --mode full produced the same result (15 nodes, 23 edges, one outline row 13-19, search_graph total=1).

Expected output: two Method nodes for label (9-11 and 13-19), two outline rows, and shortLabel reaching only the one-argument declaration.

Logs

No command failed. stderr contained only:

level=warn msg=mem.allocator.preloading_completed still_preloading=false detail=allocator_was_still_preloading,_so_arena_creation_and_purging_were_disabled;_process_init_completed_explicitly
Diagnostics trajectory (memory / performance / leak issues)

Not applicable; this is a graph-extraction/identity defect, not a resource problem.

Project scale (if relevant)

2 files / 15 nodes / 23 edges.

Prior art (searched before filing)

This is the Java instance of the cross-language callable-identity defect already discussed in #2061 (Swift; the maintainer comment there says Java, C#, C++ and Kotlin merge the same way) and #1407 (C#). #2342 landed the shared identity plumbing with no language enabled; #2429 contains a Java identity attempt that the maintainer asked to split, and the maintainer said Java would be switched to the typed callable identity. Java is still off in 0.12.1 and on main as of this run, and I found no Java-specific issue tracking the release behavior. If you prefer to keep this under #2061/#2429, close it as a duplicate; the fixture and the before/after assertions are intended as the Java regression case.

Confirmations
  • I searched existing issues. This is a Java-specific instance of a known cross-language defect, not a duplicate of a Java-specific report (none found); see "Prior art" above.
  • My reproduction uses shareable code (a dummy snippet), not proprietary code.

This issue was prepared and posted by an AI agent operating this GitHub account on behalf of its owner. The fixture and commands were run against the version above; no proprietary code, private repository, or machine-local path is included.

Dominant language
C
Stars
45.8k
Forks
3.8k
Avg merge
2d 18h
Merged PRs (30d)
108

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DeusData/codebase-memory-mcp

All issues in DeusData/codebase-memory-mcp

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.