@Override
  public CommonProblemDescriptor @Nullable [] checkElement(@NotNull RefEntity refEntity,
                                                           @NotNull AnalysisScope analysisScope,
                                                           @NotNull InspectionManager inspectionManager,
                                                           @NotNull GlobalInspectionContext globalInspectionContext) {
    if (!(refEntity instanceof RefModule refModule)) {
      return null;
    }
    final ModuleFileIndex index = ModuleRootManager.getInstance(refModule.getModule()).getFileIndex();
    final Project project = inspectionManager.getProject();
    final PsiManager psiManager = PsiManager.getInstance(project);
    final int[] count = {0};
    index.iterateContent(fileOrDir -> {
      if (fileOrDir.isDirectory()) return true;
      if (!analysisScope.contains(fileOrDir)) return true;
      final PsiFile file = psiManager.findFile(fileOrDir);
      if (!(file instanceof PsiClassOwner)) return true;
      count[0] += ((PsiClassOwner)file).getClasses().length;
      return true;
    });
    if (count[0] <= limit) {
      return null;
    }
    final String errorString = InspectionGadgetsBundle.message("module.with.too.many.classes.problem.descriptor",
                                                               refEntity.getName(), Integer.valueOf(count[0]), Integer.valueOf(limit));
    return new CommonProblemDescriptor[]{
      inspectionManager.createProblemDescriptor(errorString)
    };
  }
@Override
  public CommonProblemDescriptor @Nullable [] checkElement(@NotNull RefEntity refEntity,
                                                           @NotNull AnalysisScope analysisScope,
                                                           @NotNull InspectionManager inspectionManager,
                                                           @NotNull GlobalInspectionContext globalInspectionContext)