If an ENUM is declared within a class JDT seems not to be able to resolve it. Most of the time it treats this enum as a field. Here is a reproducible test case.
public final class A{
private enum Status {
EXPLORED, NOT_EXPLORED, UNKNOWN;
}
private class BaritoneChunkCache {
public Status isAlreadyExplored() {
return Status.NOT_EXPLORED;
}
}
}
I am getting the following CompilationUnit for this code snippet:
public final class A {
private enum Status;
{
}
private class BaritoneChunkCache {
public Status isAlreadyExplored(){
return Status.NOT_EXPLORED;
}
}}
My parsing code is:
parse (ICompilationUnit icu) {
ASTParser parser = ASTParser.newParser(AST.JLS11);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setSource(icu);
parser.setResolveBindings(true);
parser.setBindingsRecovery(true);
return (CompilationUnit) parser.createAST(null);
}