You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Java: a call through an interface-typed field stops at the interface method (no dispatches_to to implementers) #5319
For C#, Swift and Go, interface_dispatch links an interface method to the methods of
its implementers (dispatches_to, #3003, #4934). Java has the same shape, but no pass
is registered for .java, so a call through an interface-typed field ends at the
interface method and a directed walk cannot reach the class that runs.
// Worker.java
public interface Worker {
void run();
}
// EmailWorker.java
public class EmailWorker implements Worker {
public void run() {
send();
}
private void send() {
}
}
// Job.java
public class Job {
private final Worker worker;
public Job(Worker worker) {
this.worker = worker;
}
public void execute() {
this.worker.run();
}
}
$ GRAPHIFY_BACKEND=none graphify extract <dir> --code-only --out <out>
$ graphify path "Job.execute" "EmailWorker.run" --graph <out>/graphify-out/graph.json
No directed path found between 'Job.execute' and 'EmailWorker.run'. Re-run with --undirected to search ignoring edge direction.
Observed: Job.execute() --calls--> Worker.run() and no dispatches_to edge in the graph
(11 nodes, 13 edges). Nothing links Worker.run() to EmailWorker.run().
Expected: Worker.run() --dispatches_to--> EmailWorker.run(), as for C#/Swift/Go.
Proposal
Register a thin Java wrapper over resolve_interface_dispatch with suffixes=(".java",),
like swift_dispatch.py. The Java extractor already emits implements (classes, enums,
records, generic and nested interfaces) and the interface's method edges, so no extractor
change and no AST cache schema bump is needed (as for Swift, #4035). Same rules as the other
languages: additive INFERRED edges at 0.85 / 0.75 / 0.65 by implementer count, both ends
declared in .java.
I have a branch with this and tests (single implementer, two and three implementers,
overloads paired by signature (now that each Java overload has its own node, #5251), constructor, default method, enum/record/generic implementers, same simple name
in two packages, Kotlin and C# name collisions) and can open the PR.
Known limits I found (would be documented and pinned by tests)
extends (abstract class / subclass override) is not read: a base method may be the real target.
Interface hierarchies (interface Task extends Worker) are not walked, same as C#.
A default method nobody overrides gets no edge: the call really lands on the default body.
implements a.Worker written fully qualified with no import binds to a sourceless stub, so it gets no edge (fails closed); the imported form links.
Out of scope / follow-up
Abstract-class override dispatch (needs inherits); happy to open a separate issue.
Activity
github-actions commentedon Nov 18, 2026
Thanks for opening this issue, @livingforelvis. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.
test(java): a constructor named like the interface method is not a di…
fix(java): a lone implementer method pairs only at the interface meth…
feat(java): dispatch interface method calls to their implementers (Gr…
test(java): a constructor named like the interface method is not a di…
fix(java): a lone implementer method pairs only at the interface meth…