public boolean execute() throws BuildException {
    javac.log(
        "Note that you may see messages about skipping *.aj files above. "
            + "These messages can be ignored as these files are handled directly by "
            + "ajc.  Similarly, the messages below about skipping *.java files can be ignored.",
        Project.MSG_INFO);

    // javac task spits out messages that it

    if (null == javac) {
      throw new IllegalStateException("null javac");
    }
    if (!((Boolean) inSelfCall.get()).booleanValue() && afterCleaningDirs()) {
      // if we are not re-calling ourself and we cleaned dirs,
      // then re-call javac to get the list of all source files.
      inSelfCall.set(Boolean.TRUE);
      javac.execute();
      // javac re-invokes us after recalculating file list
    } else {
      try {
        AjcTask ajc = new AjcTask();
        String err = ajc.setupAjc(javac);
        if (null != err) {
          throw new BuildException(err, javac.getLocation());
        }
        addAJFiles(ajc);
        IMessageHolder handler = new MessageHandler();
        ajc.setMessageHolder(handler);

        String logFile = null;
        String[] args = javac.getCurrentCompilerArgs();
        for (int i = 0; i < args.length; i++) {
          if (args[i].equals("-log") && args.length > i) {
            logFile = args[i + 1];
            ajc.setLog(new File(logFile));
            break;
          }
        }

        ajc.execute();

        // if log file is used, this message handler will never show any errors
        IMessage[] messages = handler.getMessages(IMessage.ERROR, true);
        if (messages != IMessage.RA_IMessage && logFile != null) {
          // log messages
          String msg = "Compilation has errors or warnings. Log is available in " + logFile;
          javac.log(msg, Project.MSG_INFO);
          return false;
        } else {
          return ajc.wasCompilationSuccessful();
        }

      } finally {
        inSelfCall.set(Boolean.FALSE);
      }
    }
    return true;
  }
 /** @param ajc */
 private void addAJFiles(AjcTask ajc) {
   ajc.addFiles(getAJFiles());
 }