public List<OutputItem> compile(final CompilationUnit unit, int throughPhase) {
    try {
      unit.compile(throughPhase);
      return getCompiledFiles(unit);
    }
    catch (CompilationFailedException e) {
      processCompilationException(e);
    }
    catch (IOException | GroovyBugError e) {
      processException(e, "");
    }
    catch (NoClassDefFoundError e) {
      final String className = e.getMessage();
      if (className.contains("org/apache/ivy/")) {
        addMessageWithoutLocation("Cannot @Grab without Ivy, please add it to your module dependencies (NoClassDefFoundError: " + className + ")", true);
      } else {
        throw e;
      }
    }
    catch (TypeNotPresentException e) {
      processException(e, LINKAGE_ERROR);
    }
    catch (IncompatibleClassChangeError e) {
      processException(e, INCOMPATIBLE_CLASS_CHANGE_ERROR);
    }
    catch (LinkageError e) {
      if (e.getCause() instanceof GroovyRuntimeException) {
        processException(e, getExceptionMessage((GroovyRuntimeException)e.getCause()));
      } else {
        processException(e, LINKAGE_ERROR);
      }
    }
    finally {
      addWarnings(unit.getErrorCollector());
    }
    return Collections.emptyList();
  }
public List<OutputItem> compile(final CompilationUnit unit, int throughPhase)