private static @Nullable PsiElement processElementOrFail(@NotNull PostFormatProcessor processor,
                                                           @NotNull PsiElement element,
                                                           @NotNull CodeStyleSettings settings) {
    PsiElement result = element;
    try {
      result = processor.processElement(result, settings);
      if (!result.isValid()) {
        LOG.error(new RuntimeExceptionWithAttachments(String.format("PSI crash detected: processor=%s, result=%s", processor,
                                                                    result), new Attachment("text", result.getText())));
        return null;
      }
    }
    catch (ProcessCanceledException e) {
      throw e;
    }
    catch (Throwable e) {
      LOG.error(PluginException.createByClass(e, processor.getClass()));
    }
    return result;
  }
private static @Nullable PsiElement processElementOrFail(@NotNull PostFormatProcessor processor,
                                                           @NotNull PsiElement element,
                                                           @NotNull CodeStyleSettings settings)