diff --git a/plugins/source-sections/source-sections-compiler/src/org/jetbrains/kotlin/sourceSections/FilteredSectionsVirtualFile.kt b/plugins/source-sections/source-sections-compiler/src/org/jetbrains/kotlin/sourceSections/FilteredSectionsVirtualFile.kt index 5cfc199ae65..b986c19cd53 100644 --- a/plugins/source-sections/source-sections-compiler/src/org/jetbrains/kotlin/sourceSections/FilteredSectionsVirtualFile.kt +++ b/plugins/source-sections/source-sections-compiler/src/org/jetbrains/kotlin/sourceSections/FilteredSectionsVirtualFile.kt @@ -41,14 +41,7 @@ class FilteredSectionsVirtualFile(val delegate: VirtualFile, val sectionIds: Col override fun getTimeStamp(): Long = delegate.timeStamp override fun getName(): String = delegate.name - override fun contentsToByteArray(): ByteArray { - val res = filterByteContents(sectionIds, delegate.contentsToByteArray(), delegate.charset) - val dbgDumpFile = delegate.canonicalPath?.let { java.io.File(it + ".${sectionIds.joinToString(".")}.dump") } - if (dbgDumpFile != null && !dbgDumpFile.exists()) { - dbgDumpFile.writeText(String(res)) - } - return res - } + override fun contentsToByteArray(): ByteArray = filterByteContents(sectionIds, delegate.contentsToByteArray(), delegate.charset) override fun getInputStream(): InputStream = ByteArrayInputStream(contentsToByteArray()) diff --git a/plugins/source-sections/source-sections-compiler/tests/org/jetbrains/kotlin/sourceSections/SourceSectionsTest.kt b/plugins/source-sections/source-sections-compiler/tests/org/jetbrains/kotlin/sourceSections/SourceSectionsTest.kt index ed64ac5b9c3..1368dbfde70 100644 --- a/plugins/source-sections/source-sections-compiler/tests/org/jetbrains/kotlin/sourceSections/SourceSectionsTest.kt +++ b/plugins/source-sections/source-sections-compiler/tests/org/jetbrains/kotlin/sourceSections/SourceSectionsTest.kt @@ -98,6 +98,7 @@ class SourceSectionsTest : TestCaseWithTmpdir() { .lineSequence() .map(String::trimEnd) .toList() + .dropLastWhile { it.isBlank() } } fun testSourceSectionsFilter() { @@ -110,7 +111,8 @@ class SourceSectionsTest : TestCaseWithTmpdir() { val filteredVF = fileCreator.createPreprocessedFile(StandardFileSystems.local().findFileByPath(source.canonicalPath)) TestCase.assertNotNull("Cannot generate preprocessed file", filteredVF) val expected = expectedResult.inputStream().trimmedLines(Charset.defaultCharset()) - val actual = ByteArrayInputStream(filteredVF!!.contentsToByteArray()).trimmedLines(filteredVF.charset) + val filteredBytes = filteredVF!!.contentsToByteArray() + val actual = ByteArrayInputStream(filteredBytes).trimmedLines(filteredVF.charset) TestCase.assertEquals("Unexpected result on preprocessing file '${source.name}'", expected, actual) } }