Replace JVM StringBuilder.appendln usages with appendLine

This commit is contained in:
Abduqodiri Qurbonzoda
2021-09-16 21:56:53 +03:00
parent aea2db97c5
commit 83364d78f5
3 changed files with 15 additions and 16 deletions
@@ -13,18 +13,17 @@ internal data class CInteropCommonizerGroup(
@get:Input val targets: Set<SharedCommonizerTarget>,
@get:Input val interops: Set<CInteropIdentifier>
) {
@Suppress("deprecation")
override fun toString(): String {
return buildString {
appendln("InteropsGroup {")
appendln("targets: ")
appendLine("InteropsGroup {")
appendLine("targets: ")
targets.sortedBy { it.targets.size }.forEach { target ->
appendln(" $target")
appendLine(" $target")
}
appendln()
appendln("interops: ")
appendLine()
appendLine("interops: ")
interops.sortedBy { it.toString() }.forEach { interop ->
appendln(" $interop")
appendLine(" $interop")
}
appendLine("}")
}
@@ -31,8 +31,8 @@ class ExampleAnnotationProcessor : AbstractProcessor() {
if (kotlinGenerated != null && element.kind == ElementKind.CLASS) {
File(kotlinGenerated, "$simpleName.kt").writer().buffered().use {
it.appendln("package $packageName")
it.appendln("fun $simpleName.customToString() = \"$simpleName: \" + toString()")
it.appendLine("package $packageName")
it.appendLine("fun $simpleName.customToString() = \"$simpleName: \" + toString()")
}
}
}
@@ -54,10 +54,10 @@ fun main(args: Array<String>) {
val uncheckedLibraries = LIBRARIES - implementationTitles
if (uncheckedLibraries.isNotEmpty()) {
errors.appendln("These libraries are not found in the dependencies of this test project, thus their manifests cannot be checked. " +
errors.appendLine("These libraries are not found in the dependencies of this test project, thus their manifests cannot be checked. " +
"Please ensure they are listed in the <dependencies> section in the corresponding pom.xml:\n$uncheckedLibraries")
errors.appendln("(all found libraries: $implementationTitles)")
errors.appendln()
errors.appendLine("(all found libraries: $implementationTitles)")
errors.appendLine()
}
fun renderEntry(entry: Map.Entry<URL, String?>) = buildString {
@@ -69,16 +69,16 @@ fun main(args: Array<String>) {
val incorrectVersionValues = versionValues.filterValues { it != KOTLIN_VERSION_VALUE }
if (incorrectVersionValues.isNotEmpty()) {
errors.appendln("Manifests at these locations do not have the correct value of the $KOTLIN_VERSION attribute ($KOTLIN_VERSION_VALUE). " +
errors.appendLine("Manifests at these locations do not have the correct value of the $KOTLIN_VERSION attribute ($KOTLIN_VERSION_VALUE). " +
"Please ensure that kotlin_language_version in libraries/build.gradle corresponds to the value in kotlin.KotlinVersion:")
incorrectVersionValues.entries.joinTo(errors, "\n", transform = ::renderEntry)
errors.appendln()
errors.appendln()
errors.appendLine()
errors.appendLine()
}
val incorrectRuntimeComponentValues = runtimeComponentValues.filterValues { it != KOTLIN_RUNTIME_COMPONENT_VALUE }
if (incorrectRuntimeComponentValues.isNotEmpty()) {
errors.appendln("Manifests at these locations do not have the correct value of the $KOTLIN_RUNTIME_COMPONENT attribute ($KOTLIN_RUNTIME_COMPONENT_VALUE):")
errors.appendLine("Manifests at these locations do not have the correct value of the $KOTLIN_RUNTIME_COMPONENT attribute ($KOTLIN_RUNTIME_COMPONENT_VALUE):")
incorrectRuntimeComponentValues.entries.joinTo(errors, "\n", transform = ::renderEntry)
}