private static void decreaseLanguageLevel(@NotNull Project project) {
    ApplicationManager.getApplication().runWriteAction(() -> {
      JavaProjectModelModificationService service = JavaProjectModelModificationService.getInstance(project);
      for (Module module : ModuleManager.getInstance(project).getModules()) {
        LanguageLevel languageLevel = LanguageLevelUtil.getCustomLanguageLevel(module);
        if (languageLevel != null && !isLanguageLevelAccepted(languageLevel)) {
          LanguageLevel newLanguageLevel = adjustLanguageLevel(languageLevel);
          service.changeLanguageLevel(module, newLanguageLevel, false);
        }
      }

      LanguageLevelProjectExtension projectExtension = LanguageLevelProjectExtension.getInstance(project);
      if (!isLanguageLevelAccepted(projectExtension.getLanguageLevel())) {
        projectExtension.setLanguageLevel(getHighestAcceptedLevel());
      }
    });
  }
private static void decreaseLanguageLevel(@NotNull Project project)