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

Aperta
#3,044 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C
Stelle
45.8k
Fork
3.8k
Merge medio
2g 18h
PR unite (30g)
108

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DeusData/codebase-memory-mcp

Tutte le issue di DeusData/codebase-memory-mcp

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.