code: public void init(JavacTask task, String[] args, boolean addTaskListener) {
          env = new Env();
          for (int i = 0; i < args.length; i++) {
              String arg = args[i];
              if (arg.equals(XMSGS_OPTION)) {
                  env.messages.setOptions(null);
              } else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) {
                  env.messages.setOptions(arg.substring(arg.indexOf(":") + 1));
              } else if (arg.matches(XIMPLICIT_HEADERS + "[1-6]")) {
                  char ch = arg.charAt(arg.length() - 1);
                  env.setImplicitHeaders(Character.digit(ch, 10));
              } else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) {
                  env.setCustomTags(arg.substring(arg.indexOf(":") + 1));
              } else
                  throw new IllegalArgumentException(arg);
          }
          env.init(task);
  
          checker = new Checker(env);
  
          if (addTaskListener) {
              final DeclScanner ds = new DeclScanner() {
                  @Override
                  void visitDecl(Tree tree, Name name) {
                      TreePath p = getCurrentPath();
                      DocCommentTree dc = env.trees.getDocCommentTree(p);
  
                      checker.scan(dc, p);
                  }
              };
  
              TaskListener tl = new TaskListener() {
                  @Override
                  public void started(TaskEvent e) {
                      switch (e.getKind()) {
                          case ANALYZE:
                              CompilationUnitTree tree;
                              while ((tree = todo.poll()) != null)
                                  ds.scan(tree, null);
                              break;
                      }
                  }
  
                  @Override
                  public void finished(TaskEvent e) {
                      switch (e.getKind()) {
                          case PARSE:
                              todo.add(e.getCompilationUnit());
                              break;
                      }
                  }
  
                  Queue<CompilationUnitTree> todo = new LinkedList<CompilationUnitTree>();
              };
  
              task.addTaskListener(tl);
          }
      }
docs: <editor-fold defaultstate="collapsed" desc="Embedding API">