Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Java: a static call through a wildcard import resolves to a same-named class in an unimported package

Offen
#2,976 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

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
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
c, java
Bereich
tooling

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

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus colbymchenry/codegraph

Alle Issues in colbymchenry/codegraph

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.