Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHA missed an invocation about interface #1391

Open
kitty-1998 opened this issue Apr 12, 2024 · 1 comment
Open

CHA missed an invocation about interface #1391

kitty-1998 opened this issue Apr 12, 2024 · 1 comment

Comments

@kitty-1998
Copy link

Hi, I found a code example which may help improve Wala. See the minimized code example below:

package edu.kitty;
public class Main {
    public static void main(String[] args) {
        Inner i = (a) -> a%7;
        System.out.println(i.bar(1));
    }
    interface Inner {
        int bar(int a);
    }
}

The method main called bar and call graph should have this edge, but I used CHA algorithm to construct the call graph and found no callee target of main.

My Wala version: 1.6.4

@msridhar
Copy link
Member

Thanks, yes, this is a known issue. The CHA call graph only includes edges to concrete methods, not abstract methods like Inner.bar. Here, the bar implementation that gets invoked is not immediately evident in the bytecode; the class containing the bar implementation is generated at runtime using invokedynamic (see details here). We do handle such cases with other call graph algorithms, but it's not obviously to me how to handle it in CHA without a good amount of additional complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants