CompilationUnit (final boolean forStubs, final CompilerConfiguration config, final GroovyClassLoader classLoader, Queue<? super Object> mailbox, GroovyCompilerWrapper wrapper, final PrintStream out, PrintStream err) { final GroovyClassLoader transformLoader = new GroovyClassLoader(classLoader); try { if (forStubs) { return createStubGenerator(config, classLoader, transformLoader, mailbox, wrapper, out, err); } } catch (NoClassDefFoundError ignore) { // older groovy distributions just don't have stub generation capability } CompilationUnit unit; try { unit = new CompilationUnit(config, null, classLoader, transformLoader) { @Override public void gotoPhase(int phase) throws CompilationFailedException { super.gotoPhase(phase); if (phase <= Phases.ALL) { out.println(GroovyRtConstants.PRESENTABLE_MESSAGE + "Groovyc: " + getPhaseDescription()); } } }; } catch (NoSuchMethodError e) { //groovy 1.5.x unit = new CompilationUnit(config, null, classLoader) { @Override public void gotoPhase(int phase) throws CompilationFailedException { super.gotoPhase(phase); if (phase <= Phases.ALL) { out.println(GroovyRtConstants.PRESENTABLE_MESSAGE + "Groovyc: " + getPhaseDescription()); } } }; } return unit; }