c2nes / javalang

Pure Python Java parser and tools
MIT License
737 stars 161 forks source link

Get class from MethodInvocation #79

Open paulodamaso opened 4 years ago

paulodamaso commented 4 years ago

I'm having a hard time to find the class some MethodInvocation belongs to. For example, I have the following:

class ClassToCall {
    public void someMethod() {
        ....
    }
}

class Caller {
     private ClassToCall var;

     public void otherMethod() {
          this.var.someMethod();
     }
}

I need to know that in someMethod invocation in Caller.otherMethod() I am calling a method from ClassToCall, but all I got from filter(javalang.tree.MethodInvocation) in Caller is

MethodInvocation(arguments=[], member=someMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)

Is there a way to achieve what I need?