/** This should create an AST without imports or method-body statements */
  public static CompilationUnit createAST(
      IJavaProject javaProject, final ICompilationUnit compilationUnit) {
    if (compilationUnit == null) return null;

    class CompilationUnitRequestor extends ASTRequestor {
      CompilationUnit domUnit = EMPTY_AST_UNIT;

      public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
        if (source == compilationUnit) domUnit = ast;
      }
    }

    CompilationUnitRequestor requestor = new CompilationUnitRequestor();
    ASTParser p = ASTParser.newParser(AST.JLS3);
    p.setResolveBindings(true);
    p.setBindingsRecovery(true);
    p.setProject(javaProject);
    p.setKind(ASTParser.K_COMPILATION_UNIT);
    p.setIgnoreMethodBodies(true);
    p.createASTs(new ICompilationUnit[] {compilationUnit}, NO_KEYS, requestor, null);
    if (AptPlugin.DEBUG) {
      AptPlugin.trace("created DOM AST for " + compilationUnit.getElementName()); // $NON-NLS-1$
    }
    return requestor.domUnit;
  }
  /**
   * Parse and fully resolve all files.
   *
   * @param javaProject
   * @param parseUnits the files to be parsed and resolved.
   */
  static void createASTs(
      final IJavaProject javaProject, final ICompilationUnit[] parseUnits, ASTRequestor requestor) {
    // Construct exactly 1 binding key. When acceptBinding is called we know that
    // All ASTs have been returned. This also means that a pipeline is opened when
    // there are no asts. This is needed by the batch processors.
    String bogusKey = BindingKey.createTypeBindingKey("java.lang.Object"); // $NON-NLS-1$
    String[] keys = new String[] {bogusKey};

    ASTParser p = ASTParser.newParser(AST.JLS3);
    p.setResolveBindings(true);
    p.setBindingsRecovery(true);
    p.setProject(javaProject);
    p.setKind(ASTParser.K_COMPILATION_UNIT);
    p.setIgnoreMethodBodies(true);
    p.createASTs(parseUnits, keys, requestor, null);
  }