eclipse jdt - Find MethodInvocation method bindings in JDT ASTVisitor -
i have java file uses java.sql.statement.execute below.
public class dummy { public void execute(string q) throws sqlexception { ... statement stmt = conn.createstatement(); ... stmt.execute(q); ... } }
my use case want identify classes , method names use "statement.execute(string)" using jdt astvisitor. possible?
i found below entry using eclipse astview plugin.
method binding: statement.execute(string)
how can method binding value in astvisitor.
i tried this.
@override public boolean visit(methodinvocation node) { imethodbinding imethod = (imethodbinding) node.resolvemethodbinding(); if(imethod != null) system.out.println("binding "+imethod.getname()); return super.visit(node); }
but node.resolvemethodbinding() returns null.
... want identify classes , method names using "statement.execute(string)"
this sounds job org.eclipse.jdt.core.search.searchengine
, produce results faster traversing source files using visitor.
... node.resolvemethodbinding() returns null
this depends on how obtained ast. see, e.g., org.eclipse.jdt.core.dom.astparser.setresolvebindings(boolean)
Comments
Post a Comment