From c3f8706fe2a9a272d61e40d67f77c062541501f3 Mon Sep 17 00:00:00 2001 From: "Alexander.Likhachev" Date: Mon, 14 Aug 2023 13:54:24 +0200 Subject: [PATCH] Use kotlin-stdlib to fully read a reader in CompilerOutputParser The `FileUtil` requires additional dependency on intellij util artifacts #KT-61449 In Progress --- .../jetbrains/kotlin/compilerRunner/CompilerOutputParser.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/compiler-runner-unshaded/src/org/jetbrains/kotlin/compilerRunner/CompilerOutputParser.kt b/compiler/compiler-runner-unshaded/src/org/jetbrains/kotlin/compilerRunner/CompilerOutputParser.kt index 1b12d75b56f..9e82542a92f 100644 --- a/compiler/compiler-runner-unshaded/src/org/jetbrains/kotlin/compilerRunner/CompilerOutputParser.kt +++ b/compiler/compiler-runner-unshaded/src/org/jetbrains/kotlin/compilerRunner/CompilerOutputParser.kt @@ -16,7 +16,6 @@ package org.jetbrains.kotlin.compilerRunner -import com.intellij.openapi.util.io.FileUtil import com.intellij.util.containers.Stack import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity @@ -43,7 +42,7 @@ object CompilerOutputParser { @Throws(IOException::class) override fun read(cbuf: CharArray, off: Int, len: Int): Int { val read = reader.read(cbuf, off, len) - stringBuilder.append(cbuf, off, len) + stringBuilder.appendRange(cbuf, off, off + len) return read } @@ -68,7 +67,7 @@ object CompilerOutputParser { // Load all the text into the stringBuilder try { // This will not close the reader (see the wrapper above) - FileUtil.loadTextAndClose(wrappingReader) + wrappingReader.readText() } catch (ioException: IOException) { reportException(messageCollector, ioException) }