Creating a Compilation Unit with type bindings
Posted
by
hizki
on Stack Overflow
See other posts from Stack Overflow
or by hizki
Published on 2011-01-15T01:51:04Z
Indexed on
2011/01/15
1:53 UTC
Read the original article
Hit count: 582
I am working with the AST API in java, and I am trying to create a Compilation Unit with type bindings. I wrote the following code:
private static CompilationUnit parse(ICompilationUnit unit) {
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setSource(unit);
parser.setResolveBindings(true);
CompilationUnit compiUnit = (CompilationUnit) parser.createAST(null);
return compiUnit;
}
Unfortunately, when I run this code in debug mode and inspect compiUnit
I find that compiUnit.resolver.isRecoveringBindings
is false.
Can anyone think of a reason why it wouldn't be true
, as I specified it to be?
Thank you
© Stack Overflow or respective owner