private boolean validateCompilerConfiguration(@NotNull final CompileScope scope, @NotNull final ProgressIndicator progress) {
    ApplicationManager.getApplication().assertIsNonDispatchThread();
    try {
      final Pair<List<Module>, List<Module>> scopeModules = runWithReadAccess(progress, () -> {
        final Module[] affectedModules = scope.getAffectedModules();
        final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
        return Pair.create(Arrays.asList(affectedModules), ContainerUtil.filter(affectedModules, module -> {
          if (!compilerManager.isValidationEnabled(module)) {
            return false;
          }
          final boolean hasSources = hasSources(module, JavaSourceRootType.SOURCE);
          final boolean hasTestSources = hasSources(module, JavaSourceRootType.TEST_SOURCE);
          if (!hasSources && !hasTestSources) {
            // If module contains no sources, shouldn't have to select JDK or output directory (SCR #19333)
            // todo still there may be problems with this approach if some generated files are attributed by this module
            return false;
          }
          return true;
        }));
      });
      final List<Module> modulesWithSources = scopeModules.second;

      if (!validateJdks(modulesWithSources, true)) {
        return false;
      }
      return runWithReadAccess(progress, () -> validateOutputs(modulesWithSources) && validateCyclicDependencies(scopeModules.first));
    }
    catch (ProcessCanceledException e) {
      return false;
    }
    catch (Throwable e) {
      LOG.error(e);
      return false;
    }
  }
private boolean validateCompilerConfiguration(@NotNull final CompileScope scope, @NotNull final ProgressIndicator progress)