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

Đang mở
#3,044 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
54/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend-api-design

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C
Star
45.8k
Fork
3.8k
Merge trung bình
2 ngày 18 giờ
Pull request đã merge (30 ngày)
108

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DeusData/codebase-memory-mcp

Tất cả issue của DeusData/codebase-memory-mcp

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.