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

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -