Replace deprecated join with joinToString
This commit is contained in:
@@ -40,8 +40,8 @@ public class SMAPBuilder(val source: String,
|
||||
return null;
|
||||
}
|
||||
|
||||
val fileIds = "*F" + realMappings.mapIndexed { id, file -> "\n${file.toSMAPFile(id + 1)}" }.join("")
|
||||
val lineMappings = "*L" + realMappings.map { it.toSMAPMapping() }.join("")
|
||||
val fileIds = "*F" + realMappings.mapIndexed { id, file -> "\n${file.toSMAPFile(id + 1)}" }.joinToString("")
|
||||
val lineMappings = "*L" + realMappings.joinToString("") { it.toSMAPMapping() }
|
||||
|
||||
return "$header\n$fileIds\n$lineMappings\n*E\n"
|
||||
}
|
||||
@@ -58,9 +58,7 @@ public class SMAPBuilder(val source: String,
|
||||
|
||||
//TODO inline
|
||||
fun FileMapping.toSMAPMapping(): String {
|
||||
return lineMappings.map {
|
||||
"\n${it.toSMAP(id)}"
|
||||
}.join("")
|
||||
return lineMappings.joinToString("") { "\n${it.toSMAP(id)}" }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -283,12 +283,12 @@ private object DebugTextBuildingVisitor : KtVisitor<String, Unit>() {
|
||||
|
||||
fun renderChildren(element: KtElementImplStub<*>, separator: String, prefix: String = "", postfix: String = ""): String? {
|
||||
val childrenTexts = element.getStub()?.getChildrenStubs()?.map { (it?.getPsi() as? KtElement)?.getDebugText() }
|
||||
return childrenTexts?.filterNotNull()?.join(separator, prefix, postfix) ?: element.getText()
|
||||
return childrenTexts?.filterNotNull()?.joinToString(separator, prefix, postfix) ?: element.getText()
|
||||
}
|
||||
|
||||
fun render(element: KtElementImplStub<*>, vararg relevantChildren: KtElement?): String? {
|
||||
if (element.getStub() == null) return element.getText()
|
||||
return relevantChildren.filterNotNull().map { it.getDebugText() }.join("", "", "")
|
||||
return relevantChildren.filterNotNull().map { it.getDebugText() }.joinToString("", "", "")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public abstract class KtCodeFragment(
|
||||
}
|
||||
|
||||
override fun importsToString(): String {
|
||||
return myImports.join(IMPORT_SEPARATOR)
|
||||
return myImports.joinToString(IMPORT_SEPARATOR)
|
||||
}
|
||||
|
||||
override fun addImportsFromString(imports: String?) {
|
||||
@@ -110,7 +110,7 @@ public abstract class KtCodeFragment(
|
||||
}
|
||||
|
||||
public fun importsAsImportList(): KtImportList? {
|
||||
return KtPsiFactory(this).createFile(myImports.join("\n")).getImportList()
|
||||
return KtPsiFactory(this).createFile(myImports.joinToString("\n")).getImportList()
|
||||
}
|
||||
|
||||
override fun setVisibilityChecker(checker: JavaCodeFragment.VisibilityChecker?) { }
|
||||
|
||||
@@ -36,7 +36,7 @@ public open class KotlinStubBaseImpl<T : KtElementImplStub<*>>(parent: StubEleme
|
||||
if (propertiesValues.isEmpty()) {
|
||||
return ""
|
||||
}
|
||||
return propertiesValues.join(separator = ", ", prefix = "[", postfix = "]")
|
||||
return propertiesValues.joinToString(separator = ", ", prefix = "[", postfix = "]")
|
||||
}
|
||||
|
||||
private fun renderPropertyValues(stubInterface: Class<out Any?>): List<String> {
|
||||
|
||||
@@ -67,7 +67,7 @@ class LazyOperationsLog(
|
||||
return groupedByOwner.map {
|
||||
val (owner, records) = it
|
||||
renderOwner(owner, records)
|
||||
}.sortedBy(stringSanitizer).join("\n").renumberObjects()
|
||||
}.sortedBy(stringSanitizer).joinToString("\n").renumberObjects()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ class LazyOperationsLog(
|
||||
sb.append(data.field?.getName() ?: "in ${data.lambdaCreatedIn.getDeclarationName()}")
|
||||
|
||||
if (!data.arguments.isEmpty()) {
|
||||
sb.append(data.arguments.map { render(it) }.join(", ", "(", ")"))
|
||||
data.arguments.joinTo(sb, ", ", "(", ")") { render(it) }
|
||||
}
|
||||
|
||||
sb.append(" = ${render(data.result)}")
|
||||
@@ -176,10 +176,8 @@ class LazyOperationsLog(
|
||||
sb.append("[empty]")
|
||||
}
|
||||
else {
|
||||
val size = o.size()
|
||||
sb.append("[$size] { ").append(o.take(3).map { render(it) }.join(", "))
|
||||
if (o.size() > 3) sb.append(", ...")
|
||||
sb.append(" }")
|
||||
sb.append("[${o.size}] ")
|
||||
o.joinTo(sb, ", ", prefix = "{", postfix = "}", limit = 3) { render(it) }
|
||||
}
|
||||
}
|
||||
o is KotlinTypeImpl -> {
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import kotlin.StringsKt;
|
||||
import org.jetbrains.kotlin.utils.StringsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult;
|
||||
@@ -128,7 +128,7 @@ public class CodegenTestUtil {
|
||||
classpath.addAll(additionalClasspath);
|
||||
|
||||
List<String> options = new ArrayList<String>(Arrays.asList(
|
||||
"-classpath", StringsKt.join(classpath, File.pathSeparator, "", "", -1, ""),
|
||||
"-classpath", StringsKt.join(classpath, File.pathSeparator),
|
||||
"-d", javaClassesTempDirectory.getPath()
|
||||
));
|
||||
options.addAll(additionalOptions);
|
||||
|
||||
@@ -67,7 +67,7 @@ public interface AbstractSMAPBaseTest {
|
||||
val compiledData = extractSMAPFromClasses(outputFiles).groupBy {
|
||||
it.sourceFile
|
||||
}.map {
|
||||
val smap = it.getValue().map { replaceHash(it.smap) }.filterNotNull().join("\n")
|
||||
val smap = it.getValue().map { replaceHash(it.smap) }.filterNotNull().joinToString("\n")
|
||||
SMAPAndFile(if (smap.isNotEmpty()) smap else null, it.key)
|
||||
}.toMap { it.sourceFile }
|
||||
|
||||
@@ -85,7 +85,7 @@ public interface AbstractSMAPBaseTest {
|
||||
|
||||
val files = data.substring(fileSectionStart, lineSection).split("\n")
|
||||
|
||||
val cleaned = files.join("\n")
|
||||
val cleaned = files.joinToString("\n")
|
||||
|
||||
return data.substring(0, fileSectionStart) + cleaned + data.substring(lineSection)
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public abstract class AbstractWriteSignatureTest : TestCaseWithTmpdir() {
|
||||
methodExpectations.filterNotTo(uncheckedExpectations) { it.isChecked() }
|
||||
fieldExpectations.filterNotTo(uncheckedExpectations) { it.isChecked() }
|
||||
Assert.assertTrue(
|
||||
"Unchecked expectations (${uncheckedExpectations.size()} total):\n " + uncheckedExpectations.join("\n "),
|
||||
"Unchecked expectations (${uncheckedExpectations.size()} total):\n " + uncheckedExpectations.joinToString("\n "),
|
||||
uncheckedExpectations.isEmpty())
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -110,10 +110,10 @@ abstract public class AbstractConstraintSystemTest() : KotlinLiteFixture() {
|
||||
val parameterType = testDeclarations.getType(it.getName().asString())
|
||||
val resultType = resultingSubstitutor.substitute(parameterType, Variance.INVARIANT)
|
||||
"${it.getName()}=${resultType?.let { DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(it) }}"
|
||||
}.join("\n", prefix = "result:\n")
|
||||
}.joinToString("\n", prefix = "result:\n")
|
||||
|
||||
val boundsFile = File(filePath.replace("constraints", "bounds"))
|
||||
KotlinTestUtils.assertEqualsToFile(boundsFile, "${constraintsFileText.join("\n")}\n\n$resultingStatus\n\n$result")
|
||||
KotlinTestUtils.assertEqualsToFile(boundsFile, "${constraintsFileText.joinToString("\n")}\n\n$resultingStatus\n\n$result")
|
||||
}
|
||||
|
||||
class MyConstraint(val kind: MyConstraintKind, val firstType: String, val secondType: String)
|
||||
|
||||
Reference in New Issue
Block a user