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

How to get parameter type at call time? #1415

Open
TiddoLangerak opened this issue Jan 30, 2025 · 0 comments
Open

How to get parameter type at call time? #1415

TiddoLangerak opened this issue Jan 30, 2025 · 0 comments

Comments

@TiddoLangerak
Copy link

Consider:

class A {
    public <T> void foo(T value) {}
}

class B {
    public void bar() {
        new A().foo("string");
    }
}

With a DescribedPredicate<JavaMethodCall> I can get a reference to the call to A.foo, but it appears that the JavaMethodCall object only contains type information defined in the method signature. Is there a way to get access to the type information at the call site? I.e. that we're passing a String to the method?

This is somewhat related to #721, but subtly different: I'm not looking to get the call value (which isn't generally statically available), but I'm looking for the call type (which is statically available).

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

1 participant