[Analysis] migrate ExceptionAttachmentBuilder to use SmartPrinter
So it can be moved to a compiler module
This commit is contained in:
committed by
Space Team
parent
1cb1420e43
commit
6f429ec072
+6
-4
@@ -9,14 +9,16 @@ import com.intellij.openapi.diagnostic.Attachment
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.PrettyPrinter
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.prettyPrint
|
||||
import org.jetbrains.kotlin.util.SmartPrinter
|
||||
import org.jetbrains.kotlin.util.SourceCodeAnalysisException
|
||||
import org.jetbrains.kotlin.util.shouldIjPlatformExceptionBeRethrown
|
||||
import org.jetbrains.kotlin.util.withIndent
|
||||
import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
|
||||
public class ExceptionAttachmentBuilder {
|
||||
private val printer = PrettyPrinter()
|
||||
private val printer = SmartPrinter(StringBuilder())
|
||||
|
||||
public fun <T> withEntry(name: String, value: T, render: (T & Any) -> String) {
|
||||
withEntry(name) {
|
||||
@@ -30,11 +32,11 @@ public class ExceptionAttachmentBuilder {
|
||||
|
||||
public fun withEntry(name: String, value: String?) {
|
||||
with(printer) {
|
||||
appendLine("- $name:")
|
||||
println("- $name:")
|
||||
withIndent {
|
||||
appendLine(value ?: "<null>")
|
||||
println(value ?: "<null>")
|
||||
}
|
||||
appendLine(separator)
|
||||
println(separator)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user