public static Promise<Boolean> attachIDEAAnnotationsToJdkAsync(@NotNull Sdk sdk) {
    return ReadAction.nonBlocking(() -> {
      List<String> pathsChecked = new ArrayList<>();
      VirtualFile root = internalJdkAnnotationsPath(pathsChecked, false);
      if (root != null && !isInternalJdkAnnotationRootCorrect(root)) {
        root = null;
      }
      if (root == null) {
        String msg = "Paths checked:\n"+
                     StringUtil.join(pathsChecked, path -> {
                       File file = new File(path);
                       File parentFile = file.getParentFile();
                       return " "+path+"; exists: "+file.exists()+(parentFile == null ? "" : "; siblings: "+Arrays.toString(parentFile.list()));
                     }, "\n");
        LOG.error("JDK annotations not found", msg);
        return null;
      }
        SdkModificator modificator = sdk.getSdkModificator();
      return new Pair<>(root, modificator);
    })
      .finishOnUiThread(ModalityState.nonModal(), rootAndModificator -> {
        if (rootAndModificator == null) {
          return;
        }
        VirtualFile root = rootAndModificator.first;
        SdkModificator modificator = rootAndModificator.second;
        OrderRootType annoType = AnnotationOrderRootType.getInstance();
        if (modificator.getRoots(annoType).length != 0) {
          modificator.removeRoot(root, annoType);
        }
        modificator.addRoot(root, annoType);
        ApplicationManager.getApplication().runWriteAction(() -> modificator.commitChanges());
      })
      .submit(AppExecutorUtil.getAppExecutorService())
      .then(file -> file != null);
  }
public static Promise<Boolean> attachIDEAAnnotationsToJdkAsync(@NotNull Sdk sdk)