public static void attachJdkAnnotations(@NotNull SdkModificator modificator) {
    LocalFileSystem lfs = LocalFileSystem.getInstance();
    List<String> pathsChecked = new ArrayList<>();
    // community idea under idea
    String path =
        FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/java/jdkAnnotations";
    VirtualFile root = lfs.findFileByPath(path);
    pathsChecked.add(path);

    if (root == null) { // idea under idea
      path =
          FileUtil.toSystemIndependentName(PathManager.getHomePath())
              + "/community/java/jdkAnnotations";
      root = lfs.findFileByPath(path);
      pathsChecked.add(path);
    }
    if (root == null) { // build
      String url =
          "jar://"
              + FileUtil.toSystemIndependentName(PathManager.getHomePath())
              + "/lib/jdkAnnotations.jar!/";
      root = VirtualFileManager.getInstance().findFileByUrl(url);
      pathsChecked.add(
          FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/lib/jdkAnnotations.jar");
    }
    if (root == null) {
      String msg = "Paths checked:\n";
      for (String p : pathsChecked) {
        File file = new File(p);
        msg +=
            "Path: '"
                + p
                + "' "
                + (file.exists() ? "Found" : "Not found")
                + "; directory children: "
                + Arrays.toString(file.getParentFile().listFiles())
                + "\n";
      }
      LOG.error("JDK annotations not found", msg);
      return;
    }

    OrderRootType annoType = AnnotationOrderRootType.getInstance();
    modificator.removeRoot(root, annoType);
    modificator.addRoot(root, annoType);
  }
 @Nullable
 private static String getProjectPath(final Project project) {
   final String path = project.getPresentableUrl();
   if (path == null) {
     return null;
   }
   final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(path);
   return vFile != null ? vFile.getPath() : null;
 }
 @Nullable
 private static VirtualFile findDocs(@NotNull File file, @NotNull String relativePath) {
   file =
       new File(
           file.getAbsolutePath()
               + File.separator
               + relativePath.replace('/', File.separatorChar));
   if (!file.exists() || !file.isDirectory()) return null;
   String path = file.getAbsolutePath().replace(File.separatorChar, '/');
   return LocalFileSystem.getInstance().findFileByPath(path);
 }
  @Nullable
  @SuppressWarnings("HardCodedStringLiteral")
  private static VirtualFile findSources(File file, final String srcName) {
    File jarFile = new File(file, srcName + ".jar");
    if (!jarFile.exists()) {
      jarFile = new File(file, srcName + ".zip");
    }

    if (jarFile.exists()) {
      VirtualFile vFile = findInJar(jarFile, "src");
      if (vFile != null) return vFile;
      // try 1.4 format
      vFile = findInJar(jarFile, "");
      return vFile;
    } else {
      File srcDir = new File(file, "src");
      if (!srcDir.exists() || !srcDir.isDirectory()) return null;
      String path = srcDir.getAbsolutePath().replace(File.separatorChar, '/');
      return LocalFileSystem.getInstance().findFileByPath(path);
    }
  }