public static @Nullable String getModuleOutputPath(Module module, boolean forTestClasses) {
    final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
    if (extension == null) {
      return null;
    }
    final String outPathUrl;
    final Application application = ApplicationManager.getApplication();
    if (forTestClasses) {
      if (application.isDispatchThread()) {
        final String url = extension.getCompilerOutputUrlForTests();
        outPathUrl = url != null ? url : extension.getCompilerOutputUrl();
      }
      else {
        outPathUrl = ReadAction.compute(() -> {
          final String url = extension.getCompilerOutputUrlForTests();
          return url != null ? url : extension.getCompilerOutputUrl();
        });
      }
    }
    else { // for ordinary classes
      if (application.isDispatchThread()) {
        outPathUrl = extension.getCompilerOutputUrl();
      }
      else {
        outPathUrl = ReadAction.compute(() -> extension.getCompilerOutputUrl());
      }
    }
    return outPathUrl != null? VirtualFileManager.extractPath(outPathUrl) : null;
  }
public static @Nullable String getModuleOutputPath(Module module, boolean forTestClasses)