JDT - AstParser - How to get object declaration for the caller object

110 views Asked by At

This is the code.

CompilationUnit cu = prepareCompilationUnitForFile(new File("C:\\Test\\src\\Test.java"));
cu.accept(new ASTVisitor()
{
    public boolean visit(MethodInvocation v)
    {
        System.out.println("> " + v);
        return true;
    }
}

How to:

1) verify the calling object is variable? Like obj.method(), in this case obj is calling object

2) get the declaration of obj. Like SomeObject obj = new SomeObject()

0

There are 0 answers