private CommonProblemDescriptor @Nullable [] getDescriptors(@NotNull InspectionManager manager,
                                                              RefModule refModule,
                                                              Module module) {
    VirtualFile[] givenRoots =
      ReadAction.compute(() -> OrderEnumerator.orderEntries(module).withoutSdk()
        .withoutModuleSourceEntries()
        .withoutDepModules()
        .classes()
        .getRoots());

    if (givenRoots.length == 0) return null;

    final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
    final Set<VirtualFile> usedRoots = refModule.getUserData(UnusedLibraryGraphAnnotator.USED_LIBRARY_ROOTS);

    if (usedRoots != null) {
      appendUsedRootDependencies(usedRoots, givenRoots);
    }

    return ReadAction.compute(() -> {
      final List<CommonProblemDescriptor> result = new ArrayList<>();
      for (OrderEntry entry : moduleRootManager.getOrderEntries()) {
        if (entry instanceof LibraryOrderEntry &&
            !((LibraryOrderEntry)entry).isExported() &&
            ((LibraryOrderEntry)entry).getScope() != DependencyScope.RUNTIME) {
          final Set<VirtualFile> files = ContainerUtil.newHashSet(((LibraryOrderEntry)entry).getRootFiles(OrderRootType.CLASSES));
          boolean allRootsUnused = usedRoots == null || !files.removeAll(usedRoots);
          if (allRootsUnused) {
            String message = JavaAnalysisBundle.message("unused.library.problem.descriptor", entry.getPresentableName());
            result.add(manager.createProblemDescriptor(message, module, new RemoveUnusedLibrary(entry.getPresentableName(), null)));
          }
          else if (!files.isEmpty() && !IGNORE_LIBRARY_PARTS) {
            final String unusedLibraryRoots = StringUtil.join(files, file -> file.getPresentableName(), ",");
            String message =
              JavaAnalysisBundle.message("unused.library.roots.problem.descriptor", unusedLibraryRoots, entry.getPresentableName());
            CommonProblemDescriptor descriptor =
              ((LibraryOrderEntry)entry).isModuleLevel()
              ? manager.createProblemDescriptor(message, module, new RemoveUnusedLibrary(entry.getPresentableName(), files))
              : manager.createProblemDescriptor(message);
            result.add(descriptor);
          }
        }
      }

      return result.isEmpty() ? null : result.toArray(CommonProblemDescriptor.EMPTY_ARRAY);
    });
  }
private CommonProblemDescriptor @Nullable [] getDescriptors(@NotNull InspectionManager manager,
                                                              RefModule refModule,
                                                              Module module)