Java: a static call through a wildcard import resolves to a same-named class in an unimported package
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 52/100
Rechercherichtung
Reproduce with the three Java files in the report and CODEGRAPH_KERNEL=0, then trace the qualified-name resolution path for Util.log and compare it with the new Util() path that already applies package/import visibility. The relevant behavior is static-call candidate selection: own package, explicit imports, then on-demand imports. Done means the wildcard case resolves to com.x.b.Util, the explicit-import case still works, and a regression test covers new Util().run().
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
A static call through a Java on-demand (wildcard) import resolves to a same-named class in a package the file doesn't import, while new of the same name in the same file goes to the right one.
// src/com/x/a/Util.java package com.x.a; public class Util { public static void log(String s) {} public void run() {} }
// src/com/x/b/Util.java package com.x.b; public class Util { public static void log(String s) {} public void run() {} }
// src/com/x/m/Main.java
package com.x.m;
import com.x.b.*;
public class Main {
void go() { Util.log("x"); new Util().run(); }
}
call in go |
edge on main |
expected |
|---|---|---|
Util.log("x") |
log in com/x/a/Util.java (qualified-name) ✗ |
com/x/b/Util.java |
new Util() |
Util in com/x/b/Util.java ✓ |
same |
new Util().run() |
none | run in com/x/b |
With an explicit import com.x.b.Util; the static call resolves correctly.
Reproduced on main at 77ee3484 with CODEGRAPH_KERNEL=0. Linux/WSL2, Node 22.23.2.
Expected. The Class.member (qualified-name) path should apply the same visibility the new path already uses: the file's own package, explicit imports, then on-demand imports. A class in a package the file neither is in nor imports is not a candidate.
- Vorherrschende Sprache
- C
- Sterne
- 73.2k
- Forks
- 4.7k
- Ø Merge
- 3 Std. 15 Min.
- Gemergte PRs (30 T.)
- 576
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus colbymchenry/codegraph
-
mcp: a projectPath naming a file inside a project returns isError ("Path is not a directory")Evtl. vergeben @maxmilian hat das vor 1 Tag übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
colbymchenry/codegraph#2982 ·
Maintainer antworten meist innerhalb von 1 Tag
-
mcp: a non-object tools/call arguments crashes the handler and is reported as an internal error to retryEvtl. vergeben @kjgggggg hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
colbymchenry/codegraph#2981 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
colbymchenry/codegraph#2974 ·
Maintainer antworten meist innerhalb von 1 Tag
-
search: FTS special characters are deleted, not separated, so leaf(entry) matches nothingEvtl. vergeben @kjgggggg hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
colbymchenry/codegraph#2971 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
colbymchenry/codegraph#2959 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in colbymchenry/codegraph
Ähnliche Issues
-
vim.filetype.match() prefixes a URL buffer name with the cwd before passing it to filetype functionsOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
Maintainer antworten meist innerhalb von 1 Tag
-
stream_curl: retry_count never resets after a successful reconnect, so long sequential streams die after 5 dropsEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
mpv-player/mpv#18728 ·
Maintainer antworten meist innerhalb von 1 Tag
-
followup Prio 📌
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
cyrusimap/cyrus-imapd#6640 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 60/100
Maintainer antworten meist innerhalb von 1 Tag