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 targets: Set<SharedCommonizerTarget>,
@get:Input val interops: Set<CInteropIdentifier> @get:Input val interops: Set<CInteropIdentifier>
) { ) {
@Suppress("deprecation")
override fun toString(): String { override fun toString(): String {
return buildString { return buildString {
appendln("InteropsGroup {") appendLine("InteropsGroup {")
appendln("targets: ") appendLine("targets: ")
targets.sortedBy { it.targets.size }.forEach { target -> targets.sortedBy { it.targets.size }.forEach { target ->
appendln(" $target") appendLine(" $target")
} }
appendln() appendLine()
appendln("interops: ") appendLine("interops: ")
interops.sortedBy { it.toString() }.forEach { interop -> interops.sortedBy { it.toString() }.forEach { interop ->
appendln(" $interop") appendLine(" $interop")
} }
appendLine("}") appendLine("}")
} }
@@ -31,8 +31,8 @@ class ExampleAnnotationProcessor : AbstractProcessor() {
if (kotlinGenerated != null && element.kind == ElementKind.CLASS) { if (kotlinGenerated != null && element.kind == ElementKind.CLASS) {
File(kotlinGenerated, "$simpleName.kt").writer().buffered().use { File(kotlinGenerated, "$simpleName.kt").writer().buffered().use {
it.appendln("package $packageName") it.appendLine("package $packageName")
it.appendln("fun $simpleName.customToString() = \"$simpleName: \" + toString()") it.appendLine("fun $simpleName.customToString() = \"$simpleName: \" + toString()")
} }
} }
} }
@@ -54,10 +54,10 @@ fun main(args: Array<String>) {
val uncheckedLibraries = LIBRARIES - implementationTitles val uncheckedLibraries = LIBRARIES - implementationTitles
if (uncheckedLibraries.isNotEmpty()) { 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") "Please ensure they are listed in the <dependencies> section in the corresponding pom.xml:\n$uncheckedLibraries")
errors.appendln("(all found libraries: $implementationTitles)") errors.appendLine("(all found libraries: $implementationTitles)")
errors.appendln() errors.appendLine()
} }
fun renderEntry(entry: Map.Entry<URL, String?>) = buildString { 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 } val incorrectVersionValues = versionValues.filterValues { it != KOTLIN_VERSION_VALUE }
if (incorrectVersionValues.isNotEmpty()) { 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:") "Please ensure that kotlin_language_version in libraries/build.gradle corresponds to the value in kotlin.KotlinVersion:")
incorrectVersionValues.entries.joinTo(errors, "\n", transform = ::renderEntry) incorrectVersionValues.entries.joinTo(errors, "\n", transform = ::renderEntry)
errors.appendln() errors.appendLine()
errors.appendln() errors.appendLine()
} }
val incorrectRuntimeComponentValues = runtimeComponentValues.filterValues { it != KOTLIN_RUNTIME_COMPONENT_VALUE } val incorrectRuntimeComponentValues = runtimeComponentValues.filterValues { it != KOTLIN_RUNTIME_COMPONENT_VALUE }
if (incorrectRuntimeComponentValues.isNotEmpty()) { 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) incorrectRuntimeComponentValues.entries.joinTo(errors, "\n", transform = ::renderEntry)
} }