Skip to content

Java member calls lose receiver type information #1696

Closed

Description

@oleksii-tumanov

Context

On v8, Java method_invocation entries drop receiver and type information. With same-named methods in multiple classes, resolution is ambiguous and no call edges are emitted.

Reproducer

Services.java

class PaymentGateway { static void ping() {} void charge() {} }
class AuditLog { static void ping() {} void charge() {} }

Checkout.java

class Checkout {
    PaymentGateway gateway;

    void run(PaymentGateway parameter) {
        PaymentGateway.ping();
        gateway.charge();
        this.gateway.charge();
        parameter.charge();
    }
}

Current behavior

Representative cache shapes (paths, locations, and repeated call sites omitted):

[
  {"callee": "ping", "is_member_call": false, "receiver": null},
  {"callee": "charge", "is_member_call": false, "receiver": null}
]

All four call sites are stored without receiver information.

Expected

Preserve the receiver and static receiver type per call site, then resolve only unambiguous owners:

run -> PaymentGateway.ping [EXTRACTED]
run -> PaymentGateway.charge [INFERRED]

The three charge() calls remain separate in the cache but deduplicate to one graph edge. No edge should target the same-named AuditLog methods.

Scope

Cover explicit type receivers, current-class fields, parameters, and explicitly typed locals. Defer inherited fields, chained receivers, interface/runtime dispatch, and target overload selection.

Activity

  1. safishamsi commented on Jul 10, 2026

    @safishamsi
    Member

    Fixed on v8 in dae602c (credited to @oleksii-tumanov from #1697), shipping in 0.9.12. Java member calls now resolve against the receiver's declared type (fields/params/explicit locals via a method-scoped type table; explicit-type receivers and this exact), skipping ambiguous/inherited/chained receivers instead of matching by bare method name. gw.charge() binds to PaymentGateway.charge, not a same-named method on another class. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions