public static @Nullable PsiJavaModule findDescriptorByLibrary(@Nullable Library library, @NotNull Project project) {
    if (library == null) return null;
    final VirtualFile[] files = library.getFiles(OrderRootType.CLASSES);
    if (files.length == 0) return null;
    final PsiJavaModule javaModule = findDescriptorInLibrary(project, ProjectFileIndex.getInstance(project), files[0]);
    return javaModule != null && javaModule.isValid() ? javaModule : null;
  }
public static @Nullable PsiJavaModule findDescriptorByLibrary(@Nullable Library library, @NotNull Project project)