ThreadDump (ThreadInfo @NotNull [] threadInfos, boolean stripCoroutineDump) { sort(threadInfos); StringWriter writer = new StringWriter(); StackTraceElement[] edtStack = dumpThreadInfos(threadInfos, writer); String coroutineDump = CoroutineDumperKt.dumpCoroutines(null, stripCoroutineDump); if (coroutineDump != null) { if (stripCoroutineDump) { writer.write("\n" + COROUTINE_DUMP_HEADER_STRIPPED + "\n"); } else { writer.write("\n" + COROUTINE_DUMP_HEADER + "\n"); } writer.write(coroutineDump); } return new ThreadDump(writer.toString(), edtStack, threadInfos); }