help on getting binding information in AST [message #821718] |
Thu, 15 March 2012 14:33  |
Eclipse User |
|
|
|
Hi, I'm using the eclipse JDT AST parser to process some Java code and get binding information e.g. ITypeBinding, but resolveBinding() returns null all the time.
Here are some relevant codes:
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setSource(javaSource.toCharArray()); // the type of javasource is string
parser.setResolveBindings(true);
I found that maybe the reason is When source is supplied by setSource(char[]), the location must be established explicitly by setting an environment using setProject(IJavaProject) or setEnvironment(String[], String[], String[], boolean).
Can you give me any sample program to set the environment or get IJavaProject from the project or create an ICompilationUnit instance? Thank you.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03188 seconds