public static int intMain2(boolean indy, boolean optimize, boolean forStubs,
                             String argPath, String configScript,
                             @Nullable String targetBytecode,
                             @Nullable Queue<? super Object> mailbox,
                             @NotNull PrintStream out,
                             @NotNull PrintStream err) {
    if (indy) {
      System.setProperty("groovy.target.indy", "true");
    }

    if (!new File(argPath).exists()) {
      err.println("Arguments file for groovy compiler not found");
      return 1;
    }

    ClassLoader loader = optimize ? buildMainLoader(argPath, err) : GroovycRunner.class.getClassLoader();
    if (loader == null) {
      err.println("Cannot find class loader for groovyc; optimized=" + optimize + "; " + GroovycRunner.class.getClassLoader());
      return 1;
    }
    if (optimize) {
      Thread.currentThread().setContextClassLoader(loader);
    }

    try {
      Class.forName("org.codehaus.groovy.control.CompilationUnit", true, loader);
    }
    catch (Throwable e) {
      err.println(GroovyRtConstants.NO_GROOVY);
      e.printStackTrace(err);
      return 1;
    }

    try {
      Class<?> aClass = Class.forName("org.jetbrains.groovy.compiler.rt.DependentGroovycRunner", true, loader);
      Method method = aClass.getDeclaredMethod("runGroovyc", boolean.class, String.class, String.class, String.class,
                                               Queue.class, PrintStream.class, PrintStream.class);
      method.invoke(null, Boolean.valueOf(forStubs), argPath, configScript, targetBytecode, mailbox, out, err);
    }
    catch (Throwable e) {
      //noinspection InstanceofCatchParameter
      while (e instanceof InvocationTargetException) {
        e = e.getCause();
      }
      e.printStackTrace(err);
      return 1;
    }
    return 0;
  }
public static int intMain2(boolean indy, boolean optimize, boolean forStubs,
                             String argPath, String configScript,
                             @Nullable String targetBytecode,
                             @Nullable Queue<? super Object> mailbox,
                             @NotNull PrintStream out,
                             @NotNull PrintStream err)