static @Nullable ModCommand addExceptionsToThrowsList(final @NotNull Project project,
                                                        final @NotNull PsiMethod targetMethod,
                                                        final @NotNull Set<? extends PsiClassType> unhandledExceptions,
                                                        @NotNull ThreeState processHierarchy) {
    final PsiMethod[] superMethods = processHierarchy == ThreeState.NO ? PsiMethod.EMPTY_ARRAY : getSuperMethods(targetMethod);

    boolean hasSuperMethodsWithoutExceptions = hasSuperMethodsWithoutExceptions(superMethods, unhandledExceptions);

    final boolean processSuperMethods;
    if (hasSuperMethodsWithoutExceptions && superMethods.length > 0) {
      if (processHierarchy == ThreeState.UNSURE) return null;
      processSuperMethods = true;
    }
    else {
      processSuperMethods = false;
    }

    List<PsiMethod> toModify = new ArrayList<>();
    toModify.add(targetMethod);
    if (processSuperMethods) {
      Collections.addAll(toModify, superMethods);
    }
    return ModCommand.psiUpdate(targetMethod, (e, updater) -> {
      for (PsiMethod method : ContainerUtil.map(toModify, updater::getWritable)) {
        processMethod(project, method, unhandledExceptions);
      }
    });
  }
static @Nullable ModCommand addExceptionsToThrowsList(final @NotNull Project project,
                                                        final @NotNull PsiMethod targetMethod,
                                                        final @NotNull Set<? extends PsiClassType> unhandledExceptions,
                                                        @NotNull ThreeState processHierarchy)