@Nullable
  private static GroovycContinuation waitForStubGeneration(Future<Void> future,
                                                           LinkedBlockingQueue<?> mailbox,
                                                           GroovycOutputParser parser,
                                                           JointCompilationClassLoader loader) throws InterruptedException {
    while (true) {
      Object msg = mailbox.poll(1, TimeUnit.MINUTES);
      if (GROOVYC_FINISHED.equals(msg)) {
        return null;
      }
      else if (msg instanceof Queue) {
        // a signal that stubs are generated, so we can continue to other builders
        // and use the passed queue to notify the suspended thread to continue compiling groovy

        //noinspection unchecked
        Queue<String> toGroovyc = (Queue<String>)msg;
        loader.resetCache();
        return createContinuation(future, toGroovyc, parser, loader);
      }
      else if (msg != null) {
        throw new AssertionError("Unknown message: " + msg);
      }
    }
  }
@Nullable
  private static GroovycContinuation waitForStubGeneration(Future<Void> future,
                                                           LinkedBlockingQueue<?> mailbox,
                                                           GroovycOutputParser parser,
                                                           JointCompilationClassLoader loader)