private static void generateWhenSmart(@NotNull Project project) {
    LOG.assertTrue(!DumbService.isDumb(project), "Module name index should be ready");
    ProgressManager.getInstance().run(
      new Task.Backgroundable(project, getTitle(), true) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          final List<ModuleFiles> moduleFiles = collectClassFiles(project);
          if (ContainerUtil.exists(moduleFiles, module -> !module.files().isEmpty())) {
            new DescriptorsGenerator(project, new UniqueModuleNames(project), LOG).generate(moduleFiles, indicator);
          }
          else {
            NotificationGroupManager.getInstance().getNotificationGroup("Failed to generate module descriptors")
              .createNotification(getTitle(), JavaRefactoringBundle.message("generate.module.descriptors.build.required.message"), NotificationType.ERROR)
              .setImportant(true)
              .notify(project);
          }
        }
      });
  }
private static void generateWhenSmart(@NotNull Project project)