public static void attachSourceJar(@NotNull File sourceJar, @NotNull Collection<? extends Library> libraries) {
    VirtualFile srcFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(sourceJar);
    if (srcFile == null) return;

    VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(srcFile);
    if (jarRoot == null) return;

    VirtualFile[] roots = LibrarySourceRootDetectorUtil.scanAndSelectDetectedJavaSourceRoots(null, new VirtualFile[]{jarRoot});
    if (roots.length == 0) {
      roots = new VirtualFile[]{jarRoot};
    }

    doAttachSourceJars(libraries, roots);
  }
public static void attachSourceJar(@NotNull File sourceJar, @NotNull Collection<? extends Library> libraries)