Binding not resolved => ClassPath Problem ? [message #696302] |
Wed, 13 July 2011 16:40  |
Eclipse User |
|
|
|
Hi People,
I'm willing to parse some Java files contained in a "normal" directory, that is i'm not working with a java project in a workspace.
Let's asumme in my directory DIR
DIR/src/main/a.java
DIR/src/main/aTest.java
I use AST visitor to get content of files, assume first aTest.java.
This file contains code which calls methods from a.java.
That's why i place it in my sourceClassPath.
Here is roughly my code to parse this file :
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setEnvironment(new String[]{},
new String[]{"DIR/src/main},
null,true);
parser.setResolveBindings(true);
parser.setBindingsRecovery(true);
parser.setStatementsRecovery(true);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
JavaASTRequestor req = new JavaASTRequestor();
String source = "DIR/src/main/aTest.java";
parser.createASTs(new String[] {source},null,new String[] {},req,null);
Problem : in my AstVisitor :
public boolean visit(MethodInvocation mi) {
IMethodBinding mb = mi.resolveMethodBinding();
Syso(mb==null);
[...]
}
always display true. So it does not resolve bindings.
Therefore i can't detect methods from a.java called from aTest.java.
Anybody does see something wrong with this code ?
Thank you very much.
Regards,
Cédric
[Updated on: Wed, 13 July 2011 16:43] by Moderator Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04659 seconds