diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeListingTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeListingTest.kt index 8ca498e726e..b4ccfb74cc7 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeListingTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeListingTest.kt @@ -45,29 +45,18 @@ class BytecodeListingTextCollectingVisitor(val filter: Filter, val withSignature companion object { @JvmOverloads fun getText( - factory: ClassFileFactory, - filter: Filter = Filter.EMPTY, - replaceHash: Boolean = true, - withSignatures: Boolean = false - ) = - factory.getClassFiles() - .sortedBy { it.relativePath } - .mapNotNull { - val cr = ClassReader(it.asByteArray()) - val visitor = BytecodeListingTextCollectingVisitor(filter, withSignatures) - cr.accept(visitor, ClassReader.SKIP_CODE) + factory: ClassFileFactory, + filter: Filter = Filter.EMPTY, + withSignatures: Boolean = false + ) = factory.getClassFiles() + .sortedBy { it.relativePath } + .mapNotNull { + val cr = ClassReader(it.asByteArray()) + val visitor = BytecodeListingTextCollectingVisitor(filter, withSignatures) + cr.accept(visitor, ClassReader.SKIP_CODE) - if (!filter.shouldWriteClass(cr.access, cr.className)) { - return@mapNotNull null - } - - if (replaceHash) { - KotlinTestUtils.replaceHash(visitor.text, "HASH") - } - else { - visitor.text - } - }.joinToString("\n\n", postfix = "\n") + if (!filter.shouldWriteClass(cr.access, cr.className)) null else visitor.text + }.joinToString("\n\n", postfix = "\n") } interface Filter { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractLightAnalysisModeTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractLightAnalysisModeTest.kt index dbb33593ce7..8d852e4bc73 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractLightAnalysisModeTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractLightAnalysisModeTest.kt @@ -61,7 +61,7 @@ abstract class AbstractLightAnalysisModeTest : CodegenTestCase() { val testFiles = loadMultiFiles(files, environment.project) val classFileFactory = GenerationUtils.compileFiles(testFiles.psiFiles, environment, TEST_LIGHT_ANALYSIS).factory - return BytecodeListingTextCollectingVisitor.getText(classFileFactory, ListAnalysisFilter(), replaceHash = false) + return BytecodeListingTextCollectingVisitor.getText(classFileFactory, ListAnalysisFilter()) } protected fun compileWithFullAnalysis( @@ -94,7 +94,7 @@ abstract class AbstractLightAnalysisModeTest : CodegenTestCase() { private fun shouldFilterClass(descriptor: ClassDescriptor): Boolean { return descriptor.visibility == Visibilities.LOCAL || descriptor is SyntheticClassDescriptorForLambda } - }, replaceHash = false) + }) } private open class ListAnalysisFilter : BytecodeListingTextCollectingVisitor.Filter { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java index 4adace84090..e19ab9c097e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java @@ -303,9 +303,6 @@ public class KotlinTestUtils { } }; - // We suspect sequences of eight consecutive hexadecimal digits to be a package part hash code - private static final Pattern STRIP_PACKAGE_PART_HASH_PATTERN = Pattern.compile("\\$([0-9a-f]{8})"); - private KotlinTestUtils() { } @@ -1275,20 +1272,6 @@ public class KotlinTestUtils { return new File(file.getParentFile(), FileUtil.getNameWithoutExtension(file) + (newExtension == null ? "" : "." + newExtension)); } - @NotNull - public static String replaceHashWithStar(@NotNull String string) { - return replaceHash(string, "*"); - } - - public static String replaceHash(@NotNull String string, @NotNull String replacement) { - //TODO: hashes are still used in SamWrapperCodegen - Matcher matcher = STRIP_PACKAGE_PART_HASH_PATTERN.matcher(string); - if (matcher.find()) { - return matcher.replaceAll("\\$" + replacement); - } - return string; - } - public static boolean isAllFilesPresentTest(String testName) { //noinspection SpellCheckingInspection return testName.toLowerCase().startsWith("allfilespresentin"); diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as32 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as32 index 5a8b2cc0c29..ee9f87b08de 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as32 +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as32 @@ -300,9 +300,6 @@ public class KotlinTestUtils { } }; - // We suspect sequences of eight consecutive hexadecimal digits to be a package part hash code - private static final Pattern STRIP_PACKAGE_PART_HASH_PATTERN = Pattern.compile("\\$([0-9a-f]{8})"); - private KotlinTestUtils() { } @@ -1265,20 +1262,6 @@ public class KotlinTestUtils { return new File(file.getParentFile(), FileUtil.getNameWithoutExtension(file) + (newExtension == null ? "" : "." + newExtension)); } - @NotNull - public static String replaceHashWithStar(@NotNull String string) { - return replaceHash(string, "*"); - } - - public static String replaceHash(@NotNull String string, @NotNull String replacement) { - //TODO: hashes are still used in SamWrapperCodegen - Matcher matcher = STRIP_PACKAGE_PART_HASH_PATTERN.matcher(string); - if (matcher.find()) { - return matcher.replaceAll("\\$" + replacement); - } - return string; - } - public static boolean isAllFilesPresentTest(String testName) { //noinspection SpellCheckingInspection return testName.toLowerCase().startsWith("allfilespresentin"); diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt index 5e146f32a74..d577dfb2620 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt @@ -56,7 +56,6 @@ import org.jetbrains.kotlin.jps.targets.KotlinModuleBuildTarget import org.jetbrains.kotlin.platform.impl.isJavaScript import org.jetbrains.kotlin.platform.impl.isJvm import org.jetbrains.kotlin.platform.orDefault -import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.utils.Printer import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream @@ -642,7 +641,7 @@ abstract class AbstractIncrementalJpsTest( } override fun logLine(message: String?) { - logBuf.append(KotlinTestUtils.replaceHashWithStar(message!!.replace("^$rootPath/".toRegex(), " "))).append('\n') + logBuf.append(message!!.replace("^$rootPath/".toRegex(), " ")).append('\n') } } }