From 51ab4a54791ecebd61e70fc4b4c6e548d14e622d Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Sun, 27 Aug 2023 11:03:00 +0300 Subject: [PATCH] cleanup (appendLine) GitOrigin-RevId: 536d22bb04c82ad43b8904139bb1e04abeaaa7a8 --- .../performance/TypingLatencyReportDialog.kt | 20 +++++++------- .../BuildOutputInstantReaderImplTest.kt | 22 ++++++++-------- .../hprof/analysis/GCRootPathsTree.kt | 2 +- .../hprof/analysis/HProfAnalysis.kt | 18 ++++++------- .../hprof/analysis/LiveInstanceStats.kt | 12 ++++----- .../diagnostic/hprof/histogram/Histogram.kt | 26 +++++++++---------- .../internal/DebugAttachDetector.java | 3 ++- .../intellij/internal/KeymapToCsvAction.kt | 6 ++--- .../fixtures/BuildViewTestFixture.kt | 4 +-- .../output/GradleBuildScriptErrorParser.kt | 15 ++++++----- .../maven/testFramework/xml/XmlBuilder.kt | 4 +-- .../testFramework/common/TypesTestBase.kt | 2 +- .../testFramework/common/ValuesTestBase.kt | 2 +- .../controlStructures/UDoWhileExpression.kt | 4 +-- .../controlStructures/USwitchExpression.kt | 6 ++--- .../uast/controlStructures/UTryExpression.kt | 6 ++--- .../org/jetbrains/uast/declarations/UClass.kt | 6 ++--- .../uast/declarations/UClassInitializer.kt | 4 +-- .../org/jetbrains/uast/declarations/UFile.kt | 12 ++++----- .../jetbrains/uast/declarations/UVariable.kt | 6 ++--- .../uast/expressions/UBlockExpression.kt | 6 ++--- .../uast/util/IndentedPrintingVisitor.kt | 4 +-- 22 files changed, 96 insertions(+), 94 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/internal/performance/TypingLatencyReportDialog.kt b/platform/lang-impl/src/com/intellij/internal/performance/TypingLatencyReportDialog.kt index 744895ce3359..99823ba5320f 100644 --- a/platform/lang-impl/src/com/intellij/internal/performance/TypingLatencyReportDialog.kt +++ b/platform/lang-impl/src/com/intellij/internal/performance/TypingLatencyReportDialog.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.internal.performance import com.intellij.execution.filters.TextConsoleBuilderFactory @@ -171,21 +171,21 @@ internal class TypingLatencyReportDialog( private fun formatReportAsText(): String { return buildString { - appendln(formatHeader(false)) - appendln() + appendLine(formatHeader(false)) + appendLine() for (row in latencyMap.values.sortedBy { it.key.name }) { - appendln(formatLatency(row.key.name, row.totalLatency, row.key.details)) - appendln("Actions:") + appendLine(formatLatency(row.key.name, row.totalLatency, row.key.details)) + appendLine("Actions:") for (actionLatencyRecord in row.actionLatencyRecords.entries.sortedByDescending { it.value.averageLatency }) { - appendln(" ${formatLatency(actionLatencyRecord.key, actionLatencyRecord.value)}") + appendLine(" ${formatLatency(actionLatencyRecord.key, actionLatencyRecord.value)}") } } - appendln() + appendLine() if (threadDumps.isNotEmpty()) { - appendln("Thread dumps:") + appendLine("Thread dumps:") for (threadDump in threadDumps) { - appendln(threadDump) - appendln("-".repeat(40)) + appendLine(threadDump) + appendLine("-".repeat(40)) } } } diff --git a/platform/lang-impl/testSources/com/intellij/build/output/BuildOutputInstantReaderImplTest.kt b/platform/lang-impl/testSources/com/intellij/build/output/BuildOutputInstantReaderImplTest.kt index ac3577decf17..0de34562c93d 100644 --- a/platform/lang-impl/testSources/com/intellij/build/output/BuildOutputInstantReaderImplTest.kt +++ b/platform/lang-impl/testSources/com/intellij/build/output/BuildOutputInstantReaderImplTest.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.build.output import com.intellij.build.BuildProgressListener @@ -75,8 +75,8 @@ class BuildOutputInstantReaderImplTest { listOf(parser, createParser("[error]", ERROR)), pushBackBufferSize) val inputData = buildString { - appendln("[warning] this is a warning\n".repeat(80)) - appendln("[error] error1\n") + appendLine("[warning] this is a warning\n".repeat(80)) + appendLine("[error] error1\n") } outputReader.append(inputData).closeAndGetFuture().get() @@ -185,14 +185,14 @@ class BuildOutputInstantReaderImplTest { """.trimIndent() val inputData = buildString { trashOut.joinTo(this, "\n", postfix = "\n") - appendln(errLines) - appendln() - appendln(infoLines) - appendln() - appendln(infoLines) /* checks that duplicate messages are not sent */ - appendln() + appendLine(errLines) + appendLine() + appendLine(infoLines) + appendLine() + appendLine(infoLines) /* checks that duplicate messages are not sent */ + appendLine() trashOut.joinTo(this, "\n", postfix = "\n") - appendln(warnLines) + appendLine(warnLines) } outputReader.append(inputData).closeAndGetFuture().get() @@ -217,7 +217,7 @@ class BuildOutputInstantReaderImplTest { val buf = StringBuilder() var nextLine: String? = line.dropWhile { !it.isWhitespace() }.trimStart() while (!nextLine.isNullOrBlank() && !nextLine.startsWith('[')) { - buf.appendln(nextLine) + buf.appendLine(nextLine) nextLine = reader.readLine() } messageConsumer.accept(MessageEventImpl(reader.parentEventId, kind, null, buf.toString().dropLast(1), null)) diff --git a/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/GCRootPathsTree.kt b/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/GCRootPathsTree.kt index 7abdad1ff507..7553c5cbb522 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/GCRootPathsTree.kt +++ b/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/GCRootPathsTree.kt @@ -299,7 +299,7 @@ class GCRootPathsTree( fun createHotPathReport(treeDisplayOptions: AnalysisConfig.TreeDisplayOptions, rootReasonGetter: (Int) -> String): String { val rootList = mutableListOf>() val result = StringBuilder() - val printFunc = { s: String -> result.appendln(s); Unit } + val printFunc = { s: String -> result.appendLine(s); Unit } for (entry in edges.int2ObjectEntrySet().fastIterator()) { rootList.add(Triple(entry.intKey, entry.value.first, entry.value.second)) diff --git a/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/HProfAnalysis.kt b/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/HProfAnalysis.kt index ed0fcfcf8457..91ab85c0c6ad 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/HProfAnalysis.kt +++ b/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/HProfAnalysis.kt @@ -106,7 +106,7 @@ class HProfAnalysis(private val hprofFileChannel: FileChannel, // Currently, there is a maximum count of supported instances. Produce simplified report // (histogram only), if the count exceeds maximum. if (!isSupported(histogram.instanceCount)) { - result.appendln(histogram.prepareReport("All", 50)) + result.appendLine(histogram.prepareReport("All", 50)) return result.toString() } @@ -155,23 +155,23 @@ class HProfAnalysis(private val hprofFileChannel: FileChannel, val analysisReport = analysisCallback(analysisContext, fileBackedListProvider, PartialProgressIndicator(progress, 0.4, 0.4)) if (analysisReport.isNotBlank()) { - result.appendln(analysisReport) + result.appendLine(analysisReport) } analysisStopwatch.stop() if (includeMetaInfo) { - result.appendln(sectionHeader("Analysis information")) - result.appendln("Prepare files duration: $prepareFilesStopwatch") - result.appendln("Analysis duration: $analysisStopwatch") - result.appendln("TOTAL DURATION: $totalStopwatch") - result.appendln("Temp files:") - result.appendln(" heapdump = ${toShortStringAsCount(hprofFileChannel.size())}") + result.appendLine(sectionHeader("Analysis information")) + result.appendLine("Prepare files duration: $prepareFilesStopwatch") + result.appendLine("Analysis duration: $analysisStopwatch") + result.appendLine("TOTAL DURATION: $totalStopwatch") + result.appendLine("Temp files:") + result.appendLine(" heapdump = ${toShortStringAsCount(hprofFileChannel.size())}") tempFiles.forEach { temp -> val channel = temp.channel if (channel.isOpen) { - result.appendln(" ${temp.type} = ${toShortStringAsCount(channel.size())}") + result.appendLine(" ${temp.type} = ${toShortStringAsCount(channel.size())}") } } } diff --git a/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/LiveInstanceStats.kt b/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/LiveInstanceStats.kt index bb69569b219e..6c8f712a998b 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/LiveInstanceStats.kt +++ b/platform/platform-impl/src/com/intellij/diagnostic/hprof/analysis/LiveInstanceStats.kt @@ -27,20 +27,20 @@ internal class LiveInstanceStats { val openProjects = ProjectManager.getInstance().openProjects val projectsOpenCount = openProjects.size - result.appendln("Projects open: $projectsOpenCount") + result.appendLine("Projects open: $projectsOpenCount") openProjects.forEachIndexed { projectIndex, project -> - result.appendln("Project ${projectIndex + 1}:") + result.appendLine("Project ${projectIndex + 1}:") val modulesCount = ModuleManager.getInstance(project).modules.count() - result.appendln(" Module count: $modulesCount") + result.appendLine(" Module count: $modulesCount") val allEditors = FileEditorManager.getInstance(project).allEditors val typeToCount = allEditors.groupingBy { "${it.javaClass.name}[${it.file?.fileType?.javaClass?.name}]" }.eachCount() - result.appendln(" Editors opened: ${allEditors.size}. Counts by type:") + result.appendLine(" Editors opened: ${allEditors.size}. Counts by type:") typeToCount.entries.sortedByDescending { it.value }.forEach { (typeString, count) -> - result.appendln(" * $count $typeString") + result.appendLine(" * $count $typeString") } - result.appendln() + result.appendLine() } return result.toString() } diff --git a/platform/platform-impl/src/com/intellij/diagnostic/hprof/histogram/Histogram.kt b/platform/platform-impl/src/com/intellij/diagnostic/hprof/histogram/Histogram.kt index 2d397de73e18..b46b7330dffd 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/hprof/histogram/Histogram.kt +++ b/platform/platform-impl/src/com/intellij/diagnostic/hprof/histogram/Histogram.kt @@ -40,8 +40,8 @@ class Histogram(val entries: List, val instanceCount: Long) { fun prepareReport(name: String, topClassCount: Int): String { val result = StringBuilder() - result.appendln("Histogram. Top $topClassCount by instance count:") - val appendToResult = { s: String -> result.appendln(s); Unit } + result.appendLine("Histogram. Top $topClassCount by instance count:") + val appendToResult = { s: String -> result.appendLine(s); Unit } var counter = 1 TruncatingPrintBuffer(topClassCount, 0, appendToResult).use { buffer -> @@ -50,13 +50,13 @@ class Histogram(val entries: List, val instanceCount: Long) { counter++ } } - result.appendln(getSummaryLine(this, name)) - result.appendln() - result.appendln("Top 10 by bytes count:") + result.appendLine(getSummaryLine(this, name)) + result.appendLine() + result.appendLine("Top 10 by bytes count:") val entriesByBytes = entries.sortedByDescending { it.totalBytes } for (i in 0 until 10) { val entry = entriesByBytes[i] - result.appendln(formatEntryLine(i + 1, entry)) + result.appendLine(formatEntryLine(i + 1, entry)) } return result.toString() } @@ -72,7 +72,7 @@ class Histogram(val entries: List, val instanceCount: Long) { secondaryHistogram: Histogram, secondaryHistogramName: String, options: AnalysisConfig.HistogramOptions): String { val result = StringBuilder() - val appendToResult = { s: String -> result.appendln(s); Unit } + val appendToResult = { s: String -> result.appendLine(s); Unit } val mapClassNameToEntrySecondary = HashMap() secondaryHistogram.entries.forEach { @@ -83,7 +83,7 @@ class Histogram(val entries: List, val instanceCount: Long) { "${getSummaryLine(mainHistogram, mainHistogramName)}\n${getSummaryLine(secondaryHistogram, secondaryHistogramName)}" if (options.includeByCount) { - result.appendln("Histogram. Top ${options.classByCountLimit} by instance count [All-objects] [Only-strong-ref]:") + result.appendLine("Histogram. Top ${options.classByCountLimit} by instance count [All-objects] [Only-strong-ref]:") var counter = 1 TruncatingPrintBuffer(options.classByCountLimit, 0, appendToResult).use { buffer -> @@ -93,24 +93,24 @@ class Histogram(val entries: List, val instanceCount: Long) { counter++ } } - result.appendln(summary) + result.appendLine(summary) } if (options.includeBySize && options.includeByCount) { - result.appendln() + result.appendLine() } if (options.includeBySize) { val classCountInByBytesSection = min(mainHistogram.entries.size, options.classBySizeLimit) - result.appendln("Top $classCountInByBytesSection by size:") + result.appendLine("Top $classCountInByBytesSection by size:") val entriesByBytes = mainHistogram.entries.sortedByDescending { it.totalBytes } for (i in 0 until classCountInByBytesSection) { val entry = entriesByBytes[i] val entry2 = mapClassNameToEntrySecondary[entry.classDefinition.name] - result.appendln(formatEntryLineMerged(i + 1, entry, entry2)) + result.appendLine(formatEntryLineMerged(i + 1, entry, entry2)) } if (!options.includeByCount) { - result.appendln(summary) + result.appendLine(summary) } } return result.toString() diff --git a/platform/platform-impl/src/com/intellij/internal/DebugAttachDetector.java b/platform/platform-impl/src/com/intellij/internal/DebugAttachDetector.java index 8247c1862054..de858e5db9e7 100644 --- a/platform/platform-impl/src/com/intellij/internal/DebugAttachDetector.java +++ b/platform/platform-impl/src/com/intellij/internal/DebugAttachDetector.java @@ -111,7 +111,8 @@ public final class DebugAttachDetector { return true; } Properties properties = ApplicationManager.getApplication().getService(DebugAttachDetector.class).myAgentProperties; - if (properties == null) { // For now return true if can not detect + // for now, return true if you can not detect + if (properties == null) { return true; } return isAttached(properties); diff --git a/platform/platform-impl/src/com/intellij/internal/KeymapToCsvAction.kt b/platform/platform-impl/src/com/intellij/internal/KeymapToCsvAction.kt index a64cd87e5bf9..fa71d565c578 100644 --- a/platform/platform-impl/src/com/intellij/internal/KeymapToCsvAction.kt +++ b/platform/platform-impl/src/com/intellij/internal/KeymapToCsvAction.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.internal import com.intellij.openapi.actionSystem.ActionUpdateThread @@ -50,7 +50,7 @@ internal class KeymapToCsvAction : AnAction() { } val result = buildString { - appendln("key," + columns.joinToString(",")) + appendLine("key," + columns.joinToString(",")) for ((key, shortcutsForKey) in allShortcuts) { append(key) for (column in columns) { @@ -58,7 +58,7 @@ internal class KeymapToCsvAction : AnAction() { val actionsForShortcut = shortcutsForKey[column] ?: emptyList() append(actionsForShortcut.joinToString("|")) } - appendln() + appendLine() } } diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/BuildViewTestFixture.kt b/platform/testFramework/src/com/intellij/testFramework/fixtures/BuildViewTestFixture.kt index d9ad0d9ced9f..3909f8a652c2 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/BuildViewTestFixture.kt +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/BuildViewTestFixture.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.testFramework.fixtures import com.intellij.build.* @@ -205,7 +205,7 @@ class BuildViewTestFixture(private val myProject: Project) : IdeaTestFixture { list.add(buffer.toString()) buffer.clear() } - buffer.appendln(line) + buffer.appendLine(line) } if (buffer.isNotEmpty()) { list.add(buffer.toString()) diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/build/output/GradleBuildScriptErrorParser.kt b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/build/output/GradleBuildScriptErrorParser.kt index eb1df237feb3..eb7d13707444 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/build/output/GradleBuildScriptErrorParser.kt +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/build/output/GradleBuildScriptErrorParser.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.plugins.gradle.execution.build.output import com.intellij.build.FilePosition @@ -46,7 +46,7 @@ class GradleBuildScriptErrorParser : BuildOutputParser { val description = StringBuilder() if (location != null) { - description.appendln(location).appendln() + description.appendLine(location).appendLine() } @NlsSafe var reason = reader.readLine() ?: return false val parentId: Any @@ -57,11 +57,11 @@ class GradleBuildScriptErrorParser : BuildOutputParser { parentId = reader.parentEventId } - description.appendln(reason) + description.appendLine(reason) loop@ while (true) { val nextLine = reader.readLine() ?: return false if (nextLine.isBlank()) break - description.appendln(nextLine) + description.appendLine(nextLine) val trimStart = nextLine.trimStart() if (trimStart.startsWith("> ")) { reason = trimStart.substringAfter("> ").trimEnd('.') //NON-NLS @@ -79,7 +79,8 @@ class GradleBuildScriptErrorParser : BuildOutputParser { var exception: StringBuilder? = null while (true) { val nextLine = reader.readLine() ?: break - if (nextLine == "BUILD FAILED" || nextLine == "* Get more help at https://help.gradle.org" || nextLine.startsWith("CONFIGURE FAILED")) break + if (nextLine == "BUILD FAILED" || nextLine == "* Get more help at https://help.gradle.org" || nextLine.startsWith( + "CONFIGURE FAILED")) break if (nextLine == "* Exception is:") { exception = StringBuilder() } @@ -88,10 +89,10 @@ class GradleBuildScriptErrorParser : BuildOutputParser { } else { if (exception != null) { - exception.appendln(nextLine) + exception.appendLine(nextLine) } else if (trySuggestions != null && nextLine.isNotBlank()) { - trySuggestions.appendln(nextLine) + trySuggestions.appendLine(nextLine) } } } diff --git a/plugins/maven/testFramework/src/com/intellij/maven/testFramework/xml/XmlBuilder.kt b/plugins/maven/testFramework/src/com/intellij/maven/testFramework/xml/XmlBuilder.kt index 018c9640ddb7..cb7552dd7105 100644 --- a/plugins/maven/testFramework/src/com/intellij/maven/testFramework/xml/XmlBuilder.kt +++ b/plugins/maven/testFramework/src/com/intellij/maven/testFramework/xml/XmlBuilder.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.maven.testFramework.xml open class XmlBuilder { @@ -37,7 +37,7 @@ open class XmlBuilder { } fun text(text: String) { - state.appendln(" ".repeat(indent) + text) + state.appendLine(" ".repeat(indent) + text) } open fun generate(): String { diff --git a/uast/testFramework/src/com/intellij/platform/uast/testFramework/common/TypesTestBase.kt b/uast/testFramework/src/com/intellij/platform/uast/testFramework/common/TypesTestBase.kt index 32a6310da046..cbe53ae6366e 100644 --- a/uast/testFramework/src/com/intellij/platform/uast/testFramework/common/TypesTestBase.kt +++ b/uast/testFramework/src/com/intellij/platform/uast/testFramework/common/TypesTestBase.kt @@ -60,7 +60,7 @@ interface TypesTestBase { builder.append(psiType) } } - builder.appendln() + builder.appendLine() level++ return false } diff --git a/uast/testFramework/src/com/intellij/platform/uast/testFramework/common/ValuesTestBase.kt b/uast/testFramework/src/com/intellij/platform/uast/testFramework/common/ValuesTestBase.kt index a954df66e483..a16c5d7329f3 100644 --- a/uast/testFramework/src/com/intellij/platform/uast/testFramework/common/ValuesTestBase.kt +++ b/uast/testFramework/src/com/intellij/platform/uast/testFramework/common/ValuesTestBase.kt @@ -63,7 +63,7 @@ interface ValuesTestBase { } builder.append(" = ").append(value ?: "NON-EVALUATED") } - builder.appendln() + builder.appendLine() level++ return false } diff --git a/uast/uast-common/src/org/jetbrains/uast/controlStructures/UDoWhileExpression.kt b/uast/uast-common/src/org/jetbrains/uast/controlStructures/UDoWhileExpression.kt index d82695b6e65b..37cba91e84a3 100644 --- a/uast/uast-common/src/org/jetbrains/uast/controlStructures/UDoWhileExpression.kt +++ b/uast/uast-common/src/org/jetbrains/uast/controlStructures/UDoWhileExpression.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast import org.jetbrains.uast.internal.acceptList @@ -45,7 +45,7 @@ interface UDoWhileExpression : ULoopExpression { override fun asRenderString(): String = buildString { append("do ") append(body.asRenderString()) - appendln("while (${condition.asRenderString()})") + appendLine("while (${condition.asRenderString()})") } override fun asLogString(): String = log() diff --git a/uast/uast-common/src/org/jetbrains/uast/controlStructures/USwitchExpression.kt b/uast/uast-common/src/org/jetbrains/uast/controlStructures/USwitchExpression.kt index 7586b034e8dd..e3dccc76bb9c 100644 --- a/uast/uast-common/src/org/jetbrains/uast/controlStructures/USwitchExpression.kt +++ b/uast/uast-common/src/org/jetbrains/uast/controlStructures/USwitchExpression.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast import org.jetbrains.uast.internal.acceptList @@ -50,8 +50,8 @@ interface USwitchExpression : UExpression { override fun asRenderString(): String = buildString { val expr = expression?.let { "(" + it.asRenderString() + ") " } ?: "" - appendln("switch $expr") - appendln(body.asRenderString()) + appendLine("switch $expr") + appendLine(body.asRenderString()) } } diff --git a/uast/uast-common/src/org/jetbrains/uast/controlStructures/UTryExpression.kt b/uast/uast-common/src/org/jetbrains/uast/controlStructures/UTryExpression.kt index 3c5bcbc77def..2efb15b268e7 100644 --- a/uast/uast-common/src/org/jetbrains/uast/controlStructures/UTryExpression.kt +++ b/uast/uast-common/src/org/jetbrains/uast/controlStructures/UTryExpression.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast import com.intellij.psi.PsiType @@ -83,8 +83,8 @@ interface UTryExpression : UExpression { append(resourceVariables.joinToString("\n") { it.asRenderString() }) append(")") } - appendln(tryClause.asRenderString().trim('\n', '\r')) - catchClauses.forEach { appendln(it.asRenderString().trim('\n', '\r')) } + appendLine(tryClause.asRenderString().trim('\n', '\r')) + catchClauses.forEach { appendLine(it.asRenderString().trim('\n', '\r')) } finallyClause?.let { append("finally ").append(it.asRenderString().trim('\n', '\r')) } } diff --git a/uast/uast-common/src/org/jetbrains/uast/declarations/UClass.kt b/uast/uast-common/src/org/jetbrains/uast/declarations/UClass.kt index e065218f91d2..090be18f5c83 100644 --- a/uast/uast-common/src/org/jetbrains/uast/declarations/UClass.kt +++ b/uast/uast-common/src/org/jetbrains/uast/declarations/UClass.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast import com.intellij.psi.PsiAnonymousClass @@ -79,9 +79,9 @@ interface UClass : UDeclaration, PsiClass { append(" : ") append(superTypes.joinToString { it.asRenderString() }) } - appendln(" {") + appendLine(" {") uastDeclarations.forEachIndexed { _, declaration -> - appendln(declaration.asRenderString().withMargin) + appendLine(declaration.asRenderString().withMargin) } append("}") } diff --git a/uast/uast-common/src/org/jetbrains/uast/declarations/UClassInitializer.kt b/uast/uast-common/src/org/jetbrains/uast/declarations/UClassInitializer.kt index 7eea6db7d89b..5855bbbbf016 100644 --- a/uast/uast-common/src/org/jetbrains/uast/declarations/UClassInitializer.kt +++ b/uast/uast-common/src/org/jetbrains/uast/declarations/UClassInitializer.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast import com.intellij.psi.PsiClassInitializer @@ -30,7 +30,7 @@ interface UClassInitializer : UDeclaration, PsiClassInitializer { override fun asRenderString(): String = buildString { append(modifierList) - appendln(uastBody.asRenderString().withMargin) + appendLine(uastBody.asRenderString().withMargin) } override fun accept(visitor: UastTypedVisitor, data: D): R = diff --git a/uast/uast-common/src/org/jetbrains/uast/declarations/UFile.kt b/uast/uast-common/src/org/jetbrains/uast/declarations/UFile.kt index 02088f5c2643..99d348042a34 100644 --- a/uast/uast-common/src/org/jetbrains/uast/declarations/UFile.kt +++ b/uast/uast-common/src/org/jetbrains/uast/declarations/UFile.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast import com.intellij.psi.PsiFile @@ -62,17 +62,17 @@ interface UFile : UElement, UAnnotated { } val packageName = this@UFile.packageName - if (packageName.isNotEmpty()) appendln("package $packageName").appendln() + if (packageName.isNotEmpty()) appendLine("package $packageName").appendLine() val imports = this@UFile.imports if (imports.isNotEmpty()) { - imports.forEach { appendln(it.asRenderString()) } - appendln() + imports.forEach { appendLine(it.asRenderString()) } + appendLine() } classes.forEachIndexed { index, clazz -> - if (index > 0) appendln() - appendln(clazz.asRenderString()) + if (index > 0) appendLine() + appendLine(clazz.asRenderString()) } } diff --git a/uast/uast-common/src/org/jetbrains/uast/declarations/UVariable.kt b/uast/uast-common/src/org/jetbrains/uast/declarations/UVariable.kt index b30482fef632..cd9e69f0c1ae 100644 --- a/uast/uast-common/src/org/jetbrains/uast/declarations/UVariable.kt +++ b/uast/uast-common/src/org/jetbrains/uast/declarations/UVariable.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast import com.intellij.psi.* @@ -163,9 +163,9 @@ interface UEnumConstant : UField, UCallExpression, PsiEnumConstant { valueArguments.joinTo(this, prefix = "(", postfix = ")", transform = UExpression::asRenderString) } initializingClass?.let { - appendln(" {") + appendLine(" {") it.uastDeclarations.forEach { declaration -> - appendln(declaration.asRenderString().withMargin) + appendLine(declaration.asRenderString().withMargin) } append("}") } diff --git a/uast/uast-common/src/org/jetbrains/uast/expressions/UBlockExpression.kt b/uast/uast-common/src/org/jetbrains/uast/expressions/UBlockExpression.kt index 610250455457..587540c10b10 100644 --- a/uast/uast-common/src/org/jetbrains/uast/expressions/UBlockExpression.kt +++ b/uast/uast-common/src/org/jetbrains/uast/expressions/UBlockExpression.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast import org.jetbrains.uast.internal.acceptList @@ -28,8 +28,8 @@ interface UBlockExpression : UExpression { override fun asLogString(): String = log() override fun asRenderString(): String = buildString { - appendln("{") - expressions.forEach { appendln(it.asRenderString().withMargin) } + appendLine("{") + expressions.forEach { appendLine(it.asRenderString().withMargin) } append("}") } } \ No newline at end of file diff --git a/uast/uast-common/src/org/jetbrains/uast/util/IndentedPrintingVisitor.kt b/uast/uast-common/src/org/jetbrains/uast/util/IndentedPrintingVisitor.kt index 189c9c032a8f..26a812961135 100644 --- a/uast/uast-common/src/org/jetbrains/uast/util/IndentedPrintingVisitor.kt +++ b/uast/uast-common/src/org/jetbrains/uast/util/IndentedPrintingVisitor.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast.util import com.intellij.psi.PsiElement @@ -18,7 +18,7 @@ abstract class IndentedPrintingVisitor(val shouldIndent: (PsiElement) -> Boolean if (charSequence != null) { builder.append(" ".repeat(level)) builder.append(charSequence) - builder.appendln() + builder.appendLine() } val shouldIndent = shouldIndent(element)