private static Attachment @NotNull [] createAttachments(@Nullable Object trace) {
    return trace == null
           ? Attachment.EMPTY_ARRAY
           : new Attachment[]{trace instanceof Throwable ? new Attachment("invalidation", (Throwable)trace)
                                                         : new Attachment("diagnostic.txt", trace.toString())};
  }
private static Attachment @NotNull [] createAttachments(@Nullable Object trace)