Replace appendln with appendLine in project
This commit is contained in:
@@ -23,28 +23,28 @@ open class ManyImplicitReceiversBenchmark : AbstractSimpleFileBenchmark() {
|
|||||||
|
|
||||||
override fun buildText(): String {
|
override fun buildText(): String {
|
||||||
return buildString {
|
return buildString {
|
||||||
appendln("inline fun <T, R> with(receiver: T, block: T.() -> R): R = block()")
|
appendLine("inline fun <T, R> with(receiver: T, block: T.() -> R): R = block()")
|
||||||
|
|
||||||
for (i in 1..size) {
|
for (i in 1..size) {
|
||||||
appendln("interface A$i {")
|
appendLine("interface A$i {")
|
||||||
appendln(" fun foo$i()")
|
appendLine(" fun foo$i()")
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
appendln()
|
appendLine()
|
||||||
append("fun test(")
|
append("fun test(")
|
||||||
append((1..size).joinToString(", ") { "a$it: A$it" })
|
append((1..size).joinToString(", ") { "a$it: A$it" })
|
||||||
appendln(" {")
|
appendLine(" {")
|
||||||
for (i in 1..size) {
|
for (i in 1..size) {
|
||||||
appendln("with(a$i) {")
|
appendLine("with(a$i) {")
|
||||||
}
|
}
|
||||||
for (i in 1..size) {
|
for (i in 1..size) {
|
||||||
appendln("foo$i()")
|
appendLine("foo$i()")
|
||||||
}
|
}
|
||||||
for (i in 1..size) {
|
for (i in 1..size) {
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+8
-7
@@ -22,7 +22,7 @@ open class PlusAssignOperatorDesugaringBenchmark : AbstractInferenceBenchmark()
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun buildText(): String = buildString {
|
override fun buildText(): String = buildString {
|
||||||
appendln(
|
appendLine(
|
||||||
"""
|
"""
|
||||||
class A {
|
class A {
|
||||||
operator fun <T : Number> plus(other: (Int) -> T): A = this
|
operator fun <T : Number> plus(other: (Int) -> T): A = this
|
||||||
@@ -30,19 +30,20 @@ open class PlusAssignOperatorDesugaringBenchmark : AbstractInferenceBenchmark()
|
|||||||
}
|
}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
)
|
)
|
||||||
appendln("fun test() {")
|
appendLine("fun test() {")
|
||||||
appendln("var a = A()")
|
appendLine("var a = A()")
|
||||||
for (i in 1..size) {
|
for (i in 1..size) {
|
||||||
appendln("a += {")
|
appendLine("a += {")
|
||||||
}
|
}
|
||||||
for (i in 1..size) {
|
for (i in 1..size) {
|
||||||
appendln(
|
appendLine(
|
||||||
"""
|
"""
|
||||||
it.inc()
|
it.inc()
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
""".trimIndent())
|
""".trimIndent()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+15
-15
@@ -685,13 +685,13 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
|||||||
else -> "?"
|
else -> "?"
|
||||||
}
|
}
|
||||||
val compiledPort: Int? = daemonInfo.trim().split(" ").last().toIntOrNull()
|
val compiledPort: Int? = daemonInfo.trim().split(" ").last().toIntOrNull()
|
||||||
appendln("#$i\tcompiled on $daemonInfo, session ${daemonInfos[i]?.second}, result ${resultCodes[i]}; started daemon on port ${port2logs[i]?.first}, log: ${logFiles[i]?.canonicalPath}")
|
appendLine("#$i\tcompiled on $daemonInfo, session ${daemonInfos[i]?.second}, result ${resultCodes[i]}; started daemon on port ${port2logs[i]?.first}, log: ${logFiles[i]?.canonicalPath}")
|
||||||
if (resultCodes[i] != 0 || electionLogs[i] == null) {
|
if (resultCodes[i] != 0 || electionLogs[i] == null) {
|
||||||
appendln("--- out $i, result ${resultCodes[i]}:\n${outStreams[i].toByteArray().toString(Charset.defaultCharset())}\n---")
|
appendLine("--- out $i, result ${resultCodes[i]}:\n${outStreams[i].toByteArray().toString(Charset.defaultCharset())}\n---")
|
||||||
compiledPort?.let { port -> port2logs.find { it?.first == port } }?.second?.let { logFile ->
|
compiledPort?.let { port -> port2logs.find { it?.first == port } }?.second?.let { logFile ->
|
||||||
appendln("--- log file ${logFile.name}:\n${logFile.readText()}\n---")
|
appendLine("--- log file ${logFile.name}:\n${logFile.readText()}\n---")
|
||||||
}
|
}
|
||||||
?: appendln("--- log not found (port: $compiledPort)")
|
?: appendLine("--- log not found (port: $compiledPort)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -917,20 +917,20 @@ internal fun generateLargeKotlinFile(size: Int): String {
|
|||||||
return buildString {
|
return buildString {
|
||||||
append("package large\n\n")
|
append("package large\n\n")
|
||||||
(0..size).forEach {
|
(0..size).forEach {
|
||||||
appendln("class Class$it")
|
appendLine("class Class$it")
|
||||||
appendln("{")
|
appendLine("{")
|
||||||
appendln("\tfun foo(): Long = $it")
|
appendLine("\tfun foo(): Long = $it")
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
appendln("\n")
|
appendLine("\n")
|
||||||
repeat(2000) {
|
repeat(2000) {
|
||||||
appendln("// kotlin rules ... and stuff")
|
appendLine("// kotlin rules ... and stuff")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appendln("fun main(args: Array<String>)")
|
appendLine("fun main(args: Array<String>)")
|
||||||
appendln("{")
|
appendLine("{")
|
||||||
appendln("\tval result = Class5().foo() + Class$size().foo()")
|
appendLine("\tval result = Class5().foo() + Class$size().foo()")
|
||||||
appendln("\tprintln(result)")
|
appendLine("\tprintln(result)")
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-15
@@ -980,13 +980,13 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
|||||||
else -> "?"
|
else -> "?"
|
||||||
}
|
}
|
||||||
val compiledPort: Int? = daemonInfo.trim().split(" ").last().toIntOrNull()
|
val compiledPort: Int? = daemonInfo.trim().split(" ").last().toIntOrNull()
|
||||||
appendln("#$i\tcompiled on $daemonInfo, session ${daemonInfos[i]?.second}, result ${resultCodes[i]}; started daemon on port ${port2logs[i]?.first}, log: ${logFiles[i]?.canonicalPath}")
|
appendLine("#$i\tcompiled on $daemonInfo, session ${daemonInfos[i]?.second}, result ${resultCodes[i]}; started daemon on port ${port2logs[i]?.first}, log: ${logFiles[i]?.canonicalPath}")
|
||||||
if (resultCodes[i] != 0 || electionLogs[i] == null) {
|
if (resultCodes[i] != 0 || electionLogs[i] == null) {
|
||||||
appendln("--- out $i, result ${resultCodes[i]}:\n${outStreams[i].toByteArray().toString(Charset.defaultCharset())}\n---")
|
appendLine("--- out $i, result ${resultCodes[i]}:\n${outStreams[i].toByteArray().toString(Charset.defaultCharset())}\n---")
|
||||||
compiledPort?.let { port -> port2logs.find { it?.first == port } }?.second?.let { logFile ->
|
compiledPort?.let { port -> port2logs.find { it?.first == port } }?.second?.let { logFile ->
|
||||||
appendln("--- log file ${logFile.name}:\n${logFile.readText()}\n---")
|
appendLine("--- log file ${logFile.name}:\n${logFile.readText()}\n---")
|
||||||
}
|
}
|
||||||
?: appendln("--- log not found (port: $compiledPort)")
|
?: appendLine("--- log not found (port: $compiledPort)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1371,20 +1371,20 @@ internal fun generateLargeKotlinFile(size: Int): String {
|
|||||||
return buildString {
|
return buildString {
|
||||||
append("package large\n\n")
|
append("package large\n\n")
|
||||||
(0..size).forEach {
|
(0..size).forEach {
|
||||||
appendln("class Class$it")
|
appendLine("class Class$it")
|
||||||
appendln("{")
|
appendLine("{")
|
||||||
appendln("\tfun foo(): Long = $it")
|
appendLine("\tfun foo(): Long = $it")
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
appendln("\n")
|
appendLine("\n")
|
||||||
repeat(2000) {
|
repeat(2000) {
|
||||||
appendln("// kotlin rules ... and stuff")
|
appendLine("// kotlin rules ... and stuff")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appendln("fun main(args: Array<String>)")
|
appendLine("fun main(args: Array<String>)")
|
||||||
appendln("{")
|
appendLine("{")
|
||||||
appendln("\tval result = Class5().foo() + Class$size().foo()")
|
appendLine("\tval result = Class5().foo() + Class$size().foo()")
|
||||||
appendln("\tprintln(result)")
|
appendLine("\tprintln(result)")
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -66,7 +66,7 @@ abstract class AbstractFirLoadCompiledKotlin : AbstractFirResolveWithSessionTest
|
|||||||
for (name in provider.getAllCallableNamesInPackage(packageFqName)) {
|
for (name in provider.getAllCallableNamesInPackage(packageFqName)) {
|
||||||
for (symbol in provider.getTopLevelCallableSymbols(packageFqName, name)) {
|
for (symbol in provider.getTopLevelCallableSymbols(packageFqName, name)) {
|
||||||
symbol.fir.accept(firRenderer)
|
symbol.fir.accept(firRenderer)
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ abstract class AbstractFirLoadCompiledKotlin : AbstractFirResolveWithSessionTest
|
|||||||
provider.getClassLikeSymbolByFqName(ClassId.topLevel(packageFqName.child(name))) as FirClassSymbol?
|
provider.getClassLikeSymbolByFqName(ClassId.topLevel(packageFqName.child(name))) as FirClassSymbol?
|
||||||
?: continue
|
?: continue
|
||||||
classLikeSymbol.fir.accept(firRenderer)
|
classLikeSymbol.fir.accept(firRenderer)
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
val testDataDirectoryPath =
|
val testDataDirectoryPath =
|
||||||
|
|||||||
+2
-2
@@ -42,7 +42,7 @@ class BuiltInsDeserializationForFirTestCase : AbstractFirResolveWithSessionTestC
|
|||||||
for (name in provider.getAllCallableNamesInPackage(packageFqName)) {
|
for (name in provider.getAllCallableNamesInPackage(packageFqName)) {
|
||||||
for (symbol in provider.getTopLevelCallableSymbols(packageFqName, name)) {
|
for (symbol in provider.getTopLevelCallableSymbols(packageFqName, name)) {
|
||||||
symbol.fir.accept(firRenderer)
|
symbol.fir.accept(firRenderer)
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ class BuiltInsDeserializationForFirTestCase : AbstractFirResolveWithSessionTestC
|
|||||||
provider.getClassLikeSymbolByFqName(ClassId.topLevel(packageFqName.child(name))) as FirClassSymbol?
|
provider.getClassLikeSymbolByFqName(ClassId.topLevel(packageFqName.child(name))) as FirClassSymbol?
|
||||||
?: continue
|
?: continue
|
||||||
classLikeSymbol.fir.accept(firRenderer)
|
classLikeSymbol.fir.accept(firRenderer)
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ abstract class AbstractFirOldFrontendLightClassesTest : AbstractFirOldFrontendDi
|
|||||||
)
|
)
|
||||||
|
|
||||||
psiClass.appendMirrorText(0, stringBuilder)
|
psiClass.appendMirrorText(0, stringBuilder)
|
||||||
stringBuilder.appendln()
|
stringBuilder.appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
val expectedPath = testDataFile.path.replace(".kt", ".txt")
|
val expectedPath = testDataFile.path.replace(".kt", ".txt")
|
||||||
|
|||||||
+6
-6
@@ -173,22 +173,22 @@ abstract class AbstractBuilderConfigurator<T : AbstractFirTreeBuilder>(val firTr
|
|||||||
return if (type == null) {
|
return if (type == null) {
|
||||||
allImplementations.filter { it.kind?.hasLeafBuilder == true }.singleOrNull() ?: this@AbstractBuilderConfigurator.run {
|
allImplementations.filter { it.kind?.hasLeafBuilder == true }.singleOrNull() ?: this@AbstractBuilderConfigurator.run {
|
||||||
val message = buildString {
|
val message = buildString {
|
||||||
appendln("${this@extractImplementation} has multiple implementations:")
|
appendLine("${this@extractImplementation} has multiple implementations:")
|
||||||
for (implementation in allImplementations) {
|
for (implementation in allImplementations) {
|
||||||
appendln(" - ${implementation.type}")
|
appendLine(" - ${implementation.type}")
|
||||||
}
|
}
|
||||||
appendln("Please specify implementation is needed")
|
appendLine("Please specify implementation is needed")
|
||||||
}
|
}
|
||||||
throw IllegalArgumentException(message)
|
throw IllegalArgumentException(message)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
allImplementations.firstOrNull { it.type == type } ?: this@AbstractBuilderConfigurator.run {
|
allImplementations.firstOrNull { it.type == type } ?: this@AbstractBuilderConfigurator.run {
|
||||||
val message = buildString {
|
val message = buildString {
|
||||||
appendln("${this@extractImplementation} has not implementation $type. Existing implementations:")
|
appendLine("${this@extractImplementation} has not implementation $type. Existing implementations:")
|
||||||
for (implementation in allImplementations) {
|
for (implementation in allImplementations) {
|
||||||
appendln(" - ${implementation.type}")
|
appendLine(" - ${implementation.type}")
|
||||||
}
|
}
|
||||||
appendln("Please specify implementation is needed")
|
appendLine("Please specify implementation is needed")
|
||||||
}
|
}
|
||||||
throw IllegalArgumentException(message)
|
throw IllegalArgumentException(message)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -64,11 +64,11 @@ class IncompatibleExpectedActualClassScopesRenderer(
|
|||||||
|
|
||||||
open class MultiplatformDiagnosticRenderingMode {
|
open class MultiplatformDiagnosticRenderingMode {
|
||||||
open fun newLine(sb: StringBuilder) {
|
open fun newLine(sb: StringBuilder) {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun renderList(sb: StringBuilder, elements: List<() -> Unit>) {
|
open fun renderList(sb: StringBuilder, elements: List<() -> Unit>) {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
for (element in elements) {
|
for (element in elements) {
|
||||||
element()
|
element()
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ open class MultiplatformDiagnosticRenderingMode {
|
|||||||
open fun renderDescriptor(sb: StringBuilder, descriptor: DeclarationDescriptor, context: RenderingContext, indent: String) {
|
open fun renderDescriptor(sb: StringBuilder, descriptor: DeclarationDescriptor, context: RenderingContext, indent: String) {
|
||||||
sb.append(indent)
|
sb.append(indent)
|
||||||
sb.append(INDENTATION_UNIT)
|
sb.append(INDENTATION_UNIT)
|
||||||
sb.appendln(Renderers.COMPACT_WITH_MODIFIERS.render(descriptor, context))
|
sb.appendLine(Renderers.COMPACT_WITH_MODIFIERS.render(descriptor, context))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ fun getExceptionMessage(
|
|||||||
location: String?
|
location: String?
|
||||||
): String = ApplicationManager.getApplication().runReadAction<String> {
|
): String = ApplicationManager.getApplication().runReadAction<String> {
|
||||||
buildString {
|
buildString {
|
||||||
append(subsystemName).append(" Internal error: ").appendln(message)
|
append(subsystemName).append(" Internal error: ").appendLine(message)
|
||||||
|
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
append("File being compiled: ").appendln(location)
|
append("File being compiled: ").appendLine(location)
|
||||||
} else {
|
} else {
|
||||||
appendln("File is unknown")
|
appendLine("File is unknown")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cause != null) {
|
if (cause != null) {
|
||||||
|
|||||||
+10
-10
@@ -104,20 +104,20 @@ fun dumpBuildLog(buildSteps: Iterable<BuildStep>): String {
|
|||||||
|
|
||||||
for ((i, step) in buildSteps.withIndex()) {
|
for ((i, step) in buildSteps.withIndex()) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.appendln("================ Step #${i + 1} =================")
|
sb.appendLine("================ Step #${i + 1} =================")
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
sb.appendln(BEGIN_COMPILED_FILES)
|
sb.appendLine(BEGIN_COMPILED_FILES)
|
||||||
step.compiledKotlinFiles.sorted().forEach { sb.appendln(it) }
|
step.compiledKotlinFiles.sorted().forEach { sb.appendLine(it) }
|
||||||
step.compiledJavaFiles.sorted().forEach { sb.appendln(it) }
|
step.compiledJavaFiles.sorted().forEach { sb.appendLine(it) }
|
||||||
sb.appendln(END_COMPILED_FILES)
|
sb.appendLine(END_COMPILED_FILES)
|
||||||
sb.appendln("------------------------------------------")
|
sb.appendLine("------------------------------------------")
|
||||||
|
|
||||||
if (!step.compileSucceeded) {
|
if (!step.compileSucceeded) {
|
||||||
sb.appendln(BEGIN_ERRORS)
|
sb.appendLine(BEGIN_ERRORS)
|
||||||
step.compileErrors.forEach { sb.appendln(it) }
|
step.compileErrors.forEach { sb.appendLine(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ fun BasicBlock.dump(builder: StringBuilder = StringBuilder(), indent: String = "
|
|||||||
builder.append(indent)
|
builder.append(indent)
|
||||||
builder.append(String.format("%3d ", index + 1))
|
builder.append(String.format("%3d ", index + 1))
|
||||||
val dump = element.cfgDump()
|
val dump = element.cfgDump()
|
||||||
builder.appendln(dump.lines().first())
|
builder.appendLine(dump.lines().first())
|
||||||
}
|
}
|
||||||
return builder.toString()
|
return builder.toString()
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ fun BasicBlock.dump(builder: StringBuilder = StringBuilder(), indent: String = "
|
|||||||
fun BlockConnector.dump(builder: StringBuilder = StringBuilder(), indent: String = ""): String {
|
fun BlockConnector.dump(builder: StringBuilder = StringBuilder(), indent: String = ""): String {
|
||||||
builder.append(indent)
|
builder.append(indent)
|
||||||
val dump = element.cfgDump()
|
val dump = element.cfgDump()
|
||||||
builder.appendln(dump.lines().first())
|
builder.appendLine(dump.lines().first())
|
||||||
return builder.toString()
|
return builder.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,21 +56,21 @@ fun ControlFlowGraph.dump(): String {
|
|||||||
}
|
}
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
for ((index, block) in blocks.withIndex()) {
|
for ((index, block) in blocks.withIndex()) {
|
||||||
builder.appendln("BB $index")
|
builder.appendLine("BB $index")
|
||||||
val incoming = block.incoming
|
val incoming = block.incoming
|
||||||
if (incoming != null) {
|
if (incoming != null) {
|
||||||
builder.appendln(incoming.previousBlocks.joinToString(prefix = "INCOMING <- BB ") { blockIndex[it].toString() })
|
builder.appendLine(incoming.previousBlocks.joinToString(prefix = "INCOMING <- BB ") { blockIndex[it].toString() })
|
||||||
incoming.dump(builder, " ")
|
incoming.dump(builder, " ")
|
||||||
}
|
}
|
||||||
builder.appendln("CONTENT")
|
builder.appendLine("CONTENT")
|
||||||
block.dump(builder, " ")
|
block.dump(builder, " ")
|
||||||
val outgoing = block.outgoing
|
val outgoing = block.outgoing
|
||||||
if (outgoing != null) {
|
if (outgoing != null) {
|
||||||
if (outgoing.nextBlocks.isEmpty()) {
|
if (outgoing.nextBlocks.isEmpty()) {
|
||||||
builder.appendln("OUTGOING -> NONE")
|
builder.appendLine("OUTGOING -> NONE")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
builder.appendln(outgoing.nextBlocks.joinToString(prefix = "OUTGOING -> BB ") { blockIndex[it].toString() })
|
builder.appendLine(outgoing.nextBlocks.joinToString(prefix = "OUTGOING -> BB ") { blockIndex[it].toString() })
|
||||||
}
|
}
|
||||||
outgoing.dump(builder, " ")
|
outgoing.dump(builder, " ")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,13 +115,13 @@ class MutableContextInfo private constructor(
|
|||||||
this.entries.filter { it.value.isNotEmpty() }.forEach { (key, value) ->
|
this.entries.filter { it.value.isNotEmpty() }.forEach { (key, value) ->
|
||||||
append(key.toString())
|
append(key.toString())
|
||||||
append(" $separator ")
|
append(" $separator ")
|
||||||
appendln(value.toString())
|
appendLine(value.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
append("Fired effects: ")
|
append("Fired effects: ")
|
||||||
append(info.firedEffects.joinToString(separator = ", "))
|
append(info.firedEffects.joinToString(separator = ", "))
|
||||||
appendln("")
|
appendLine("")
|
||||||
|
|
||||||
subtypes.printMapEntriesWithSeparator("is")
|
subtypes.printMapEntriesWithSeparator("is")
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ abstract class AbstractPseudoValueTest : AbstractPseudocodeTest() {
|
|||||||
"%1$-${valueColumnWidth}s".format(valueDecl(value)) +
|
"%1$-${valueColumnWidth}s".format(valueDecl(value)) +
|
||||||
" " +
|
" " +
|
||||||
"%1$-${valueDescColumnWidth}s".format(description)
|
"%1$-${valueDescColumnWidth}s".format(description)
|
||||||
out.appendln(line.trimEnd())
|
out.appendLine(line.trimEnd())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -74,12 +74,12 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
|
|||||||
append(" : " + superTypes.joinToString())
|
append(" : " + superTypes.joinToString())
|
||||||
}
|
}
|
||||||
|
|
||||||
appendln(" {")
|
appendLine(" {")
|
||||||
|
|
||||||
fields.joinTo(this, LINE_SEPARATOR.repeat(2)) { renderField(it, showTypeAnnotations).withMargin() }
|
fields.joinTo(this, LINE_SEPARATOR.repeat(2)) { renderField(it, showTypeAnnotations).withMargin() }
|
||||||
|
|
||||||
if (fields.isNotEmpty()) {
|
if (fields.isNotEmpty()) {
|
||||||
appendln().appendln()
|
appendLine().appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
methods.joinTo(this, LINE_SEPARATOR.repeat(2)) {
|
methods.joinTo(this, LINE_SEPARATOR.repeat(2)) {
|
||||||
@@ -87,7 +87,7 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
|
|||||||
renderMethod(it, showBytecode, showLocalVariables, showTypeAnnotations).withMargin()
|
renderMethod(it, showBytecode, showLocalVariables, showTypeAnnotations).withMargin()
|
||||||
}
|
}
|
||||||
|
|
||||||
appendln().append("}")
|
appendLine().append("}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
|
|||||||
val actualShowLocalVariables = showLocalVariables && method.localVariables?.takeIf { it.isNotEmpty() } != null
|
val actualShowLocalVariables = showLocalVariables && method.localVariables?.takeIf { it.isNotEmpty() } != null
|
||||||
|
|
||||||
if (actualShowBytecode || actualShowLocalVariables) {
|
if (actualShowBytecode || actualShowLocalVariables) {
|
||||||
appendln(" {")
|
appendLine(" {")
|
||||||
|
|
||||||
if (actualShowLocalVariables) {
|
if (actualShowLocalVariables) {
|
||||||
val localVariableTable = buildLocalVariableTable(method)
|
val localVariableTable = buildLocalVariableTable(method)
|
||||||
@@ -158,12 +158,12 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
|
|||||||
|
|
||||||
if (actualShowBytecode) {
|
if (actualShowBytecode) {
|
||||||
if (actualShowLocalVariables) {
|
if (actualShowLocalVariables) {
|
||||||
appendln().appendln()
|
appendLine().appendLine()
|
||||||
}
|
}
|
||||||
append(renderBytecodeInstructions(method.instructions).trimEnd().withMargin())
|
append(renderBytecodeInstructions(method.instructions).trimEnd().withMargin())
|
||||||
}
|
}
|
||||||
|
|
||||||
appendln().append("}")
|
appendLine().append("}")
|
||||||
|
|
||||||
method.visibleTypeAnnotations
|
method.visibleTypeAnnotations
|
||||||
}
|
}
|
||||||
@@ -188,7 +188,7 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
|
|||||||
return buildString {
|
return buildString {
|
||||||
append("Local variables:")
|
append("Local variables:")
|
||||||
for (variable in localVariables) {
|
for (variable in localVariables) {
|
||||||
appendln().append((variable.index.toString() + " " + variable.name + ": " + variable.desc).withMargin())
|
appendLine().append((variable.index.toString() + " " + variable.name + ": " + variable.desc).withMargin())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,12 +205,12 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
|
|||||||
|
|
||||||
private fun StringBuilder.renderInstruction(node: AbstractInsnNode, labelMappings: LabelMappings) {
|
private fun StringBuilder.renderInstruction(node: AbstractInsnNode, labelMappings: LabelMappings) {
|
||||||
if (node is LabelNode) {
|
if (node is LabelNode) {
|
||||||
appendln("LABEL (L" + labelMappings[node.label] + ")")
|
appendLine("LABEL (L" + labelMappings[node.label] + ")")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node is LineNumberNode) {
|
if (node is LineNumberNode) {
|
||||||
appendln("LINENUMBER (" + node.line + ")")
|
appendLine("LINENUMBER (" + node.line + ")")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
|
|||||||
is LdcInsnNode -> append(" (" + node.cst + ")")
|
is LdcInsnNode -> append(" (" + node.cst + ")")
|
||||||
}
|
}
|
||||||
|
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun String.withMargin(margin: String = " "): String {
|
private fun String.withMargin(margin: String = " "): String {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ object SMAPTestUtil {
|
|||||||
StringReader(file.content).forEachLine { line ->
|
StringReader(file.content).forEachLine { line ->
|
||||||
// Strip comments
|
// Strip comments
|
||||||
if (!line.startsWith("//")) {
|
if (!line.startsWith("//")) {
|
||||||
appendln(line.trim())
|
appendLine(line.trim())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.trim()
|
}.trim()
|
||||||
|
|||||||
+4
-4
@@ -79,15 +79,15 @@ abstract class AbstractFirDiagnosticsWithLightTreeTest : AbstractFirDiagnosticsT
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wasExpected.isNotEmpty()) {
|
if (wasExpected.isNotEmpty()) {
|
||||||
appendln("Some diagnostics was expected:")
|
appendLine("Some diagnostics was expected:")
|
||||||
wasExpected.forEach {
|
wasExpected.forEach {
|
||||||
appendln(it.errorMessage())
|
appendLine(it.errorMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isActual.isNotEmpty()) {
|
if (isActual.isNotEmpty()) {
|
||||||
appendln("Some new diagnostics:")
|
appendLine("Some new diagnostics:")
|
||||||
isActual.forEach {
|
isActual.forEach {
|
||||||
appendln(it.errorMessage())
|
appendLine(it.errorMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -63,9 +63,9 @@ abstract class AbstractFirOldFrontendDiagnosticsTest : AbstractFirDiagnosticsTes
|
|||||||
|
|
||||||
private fun checkFailureFile(failure: FirRuntimeException, failureFile: File) {
|
private fun checkFailureFile(failure: FirRuntimeException, failureFile: File) {
|
||||||
val failureMessage = buildString {
|
val failureMessage = buildString {
|
||||||
appendln(failure.message)
|
appendLine(failure.message)
|
||||||
append("Cause: ")
|
append("Cause: ")
|
||||||
appendln(failure.cause)
|
appendLine(failure.cause)
|
||||||
}
|
}
|
||||||
KotlinTestUtils.assertEqualsToFile(failureFile, failureMessage)
|
KotlinTestUtils.assertEqualsToFile(failureFile, failureMessage)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class RTableContext {
|
|||||||
out.append(HLINE.repeat(size))
|
out.append(HLINE.repeat(size))
|
||||||
}
|
}
|
||||||
out.append(postfix)
|
out.append(postfix)
|
||||||
out.appendln()
|
out.appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
appendHLine(CORNER_LU, TOP_T, CORNER_RU)
|
appendHLine(CORNER_LU, TOP_T, CORNER_RU)
|
||||||
@@ -93,7 +93,7 @@ class RTableContext {
|
|||||||
out.append(VLINE)
|
out.append(VLINE)
|
||||||
out.append(" ")
|
out.append(" ")
|
||||||
}
|
}
|
||||||
out.appendln()
|
out.appendLine()
|
||||||
}
|
}
|
||||||
is Row.Separator -> {
|
is Row.Separator -> {
|
||||||
appendHLine(LEFT_T, CROSS, RIGHT_T)
|
appendHLine(LEFT_T, CROSS, RIGHT_T)
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ abstract class AbstractIrCfgTestCase : AbstractIrGeneratorTestCase() {
|
|||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
for (declaration in this.declarations) {
|
for (declaration in this.declarations) {
|
||||||
if (declaration is IrFunction) {
|
if (declaration is IrFunction) {
|
||||||
builder.appendln("// FUN: ${declaration.name}")
|
builder.appendLine("// FUN: ${declaration.name}")
|
||||||
val cfg = FunctionGenerator(declaration).generate()
|
val cfg = FunctionGenerator(declaration).generate()
|
||||||
builder.appendln(cfg.dump())
|
builder.appendLine(cfg.dump())
|
||||||
builder.appendln("// END FUN: ${declaration.name}")
|
builder.appendLine("// END FUN: ${declaration.name}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return builder.toString()
|
return builder.toString()
|
||||||
@@ -43,10 +43,10 @@ abstract class AbstractIrCfgTestCase : AbstractIrGeneratorTestCase() {
|
|||||||
private fun IrModuleFragment.cfgDump(): String {
|
private fun IrModuleFragment.cfgDump(): String {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
for (file in this.files) {
|
for (file in this.files) {
|
||||||
builder.appendln("// FILE: ${file.path}")
|
builder.appendLine("// FILE: ${file.path}")
|
||||||
builder.appendln(file.cfgDump())
|
builder.appendLine(file.cfgDump())
|
||||||
builder.appendln("// END FILE: ${file.path}")
|
builder.appendLine("// END FILE: ${file.path}")
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
}
|
}
|
||||||
return builder.toString()
|
return builder.toString()
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -40,13 +40,13 @@ abstract class AbstractEnhancedSignaturesResolvedCallsTest : AbstractResolvedCal
|
|||||||
|
|
||||||
return buildString {
|
return buildString {
|
||||||
lines.forEachIndexed { lineIndex, line ->
|
lines.forEachIndexed { lineIndex, line ->
|
||||||
appendln(line)
|
appendLine(line)
|
||||||
callsByLine[lineIndex]?.let { calls ->
|
callsByLine[lineIndex]?.let { calls ->
|
||||||
val indent = line.takeWhile(Char::isWhitespace) + " "
|
val indent = line.takeWhile(Char::isWhitespace) + " "
|
||||||
calls.forEach { resolvedCall ->
|
calls.forEach { resolvedCall ->
|
||||||
appendln("$indent// ${resolvedCall?.status}")
|
appendLine("$indent// ${resolvedCall?.status}")
|
||||||
appendln("$indent// ORIGINAL: ${resolvedCall?.run { resultingDescriptor!!.original.getText() }}")
|
appendLine("$indent// ORIGINAL: ${resolvedCall?.run { resultingDescriptor!!.original.getText() }}")
|
||||||
appendln("$indent// SUBSTITUTED: ${resolvedCall?.run { resultingDescriptor!!.getText() }}")
|
appendLine("$indent// SUBSTITUTED: ${resolvedCall?.run { resultingDescriptor!!.getText() }}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -131,30 +131,30 @@ internal fun DeclarationDescriptor.getText(): String = when (this) {
|
|||||||
|
|
||||||
internal fun ResolvedCall<*>.renderToText(): String {
|
internal fun ResolvedCall<*>.renderToText(): String {
|
||||||
return buildString {
|
return buildString {
|
||||||
appendln("Resolved call:")
|
appendLine("Resolved call:")
|
||||||
appendln()
|
appendLine()
|
||||||
|
|
||||||
if (candidateDescriptor != resultingDescriptor) {
|
if (candidateDescriptor != resultingDescriptor) {
|
||||||
appendln("Candidate descriptor: ${candidateDescriptor!!.getText()}")
|
appendLine("Candidate descriptor: ${candidateDescriptor!!.getText()}")
|
||||||
}
|
}
|
||||||
appendln("Resulting descriptor: ${resultingDescriptor!!.getText()}")
|
appendLine("Resulting descriptor: ${resultingDescriptor!!.getText()}")
|
||||||
appendln()
|
appendLine()
|
||||||
|
|
||||||
appendln("Explicit receiver kind = ${explicitReceiverKind}")
|
appendLine("Explicit receiver kind = ${explicitReceiverKind}")
|
||||||
appendln("Dispatch receiver = ${dispatchReceiver.getText()}")
|
appendLine("Dispatch receiver = ${dispatchReceiver.getText()}")
|
||||||
appendln("Extension receiver = ${extensionReceiver.getText()}")
|
appendLine("Extension receiver = ${extensionReceiver.getText()}")
|
||||||
|
|
||||||
val valueArguments = call.valueArguments
|
val valueArguments = call.valueArguments
|
||||||
if (!valueArguments.isEmpty()) {
|
if (!valueArguments.isEmpty()) {
|
||||||
appendln()
|
appendLine()
|
||||||
appendln("Value arguments mapping:")
|
appendLine("Value arguments mapping:")
|
||||||
appendln()
|
appendLine()
|
||||||
|
|
||||||
for (valueArgument in valueArguments) {
|
for (valueArgument in valueArguments) {
|
||||||
val argumentText = valueArgument!!.getText()
|
val argumentText = valueArgument!!.getText()
|
||||||
val argumentMappingText = getArgumentMapping(valueArgument).getText()
|
val argumentMappingText = getArgumentMapping(valueArgument).getText()
|
||||||
|
|
||||||
appendln("$argumentMappingText $argumentText")
|
appendLine("$argumentMappingText $argumentText")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class ServiceLoaderLiteTest : AbstractServiceLoaderLiteTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testSeveralProcessors() {
|
fun testSeveralProcessors() {
|
||||||
val processorsContent = buildString { appendln("test.Foo").appendln("test.Bar") }
|
val processorsContent = buildString { appendLine("test.Foo").appendLine("test.Bar") }
|
||||||
|
|
||||||
applyForDirAndJar("test", processors(processorsContent)) { file ->
|
applyForDirAndJar("test", processors(processorsContent)) { file ->
|
||||||
val impls = ServiceLoaderLite.findImplementations(Processor::class.java, listOf(file))
|
val impls = ServiceLoaderLite.findImplementations(Processor::class.java, listOf(file))
|
||||||
@@ -98,11 +98,11 @@ class ServiceLoaderLiteTest : AbstractServiceLoaderLiteTest() {
|
|||||||
|
|
||||||
fun testCommentsAndWhitespaces() {
|
fun testCommentsAndWhitespaces() {
|
||||||
val processorsContent = buildString {
|
val processorsContent = buildString {
|
||||||
appendln(" test.Foo #comment")
|
appendLine(" test.Foo #comment")
|
||||||
appendln("#comment2")
|
appendLine("#comment2")
|
||||||
appendln().appendln()
|
appendLine().appendLine()
|
||||||
appendln("test.Bar #anotherComemnt")
|
appendLine("test.Bar #anotherComemnt")
|
||||||
appendln("test.Zoo ")
|
appendLine("test.Zoo ")
|
||||||
}
|
}
|
||||||
|
|
||||||
applyForDirAndJar("test", processors(processorsContent)) { file ->
|
applyForDirAndJar("test", processors(processorsContent)) { file ->
|
||||||
|
|||||||
+1
-1
@@ -127,7 +127,7 @@ class ServiceLoaderLiteTestWithClassLoader : AbstractServiceLoaderLiteTest() {
|
|||||||
private inline fun <reified Intf : Any> impls(vararg impls: KClass<out Intf>): Entry {
|
private inline fun <reified Intf : Any> impls(vararg impls: KClass<out Intf>): Entry {
|
||||||
val content = buildString {
|
val content = buildString {
|
||||||
for (impl in impls) {
|
for (impl in impls) {
|
||||||
appendln(impl.java.name)
|
appendLine(impl.java.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Entry("META-INF/services/" + Intf::class.java.name, content)
|
return Entry("META-INF/services/" + Intf::class.java.name, content)
|
||||||
|
|||||||
@@ -206,8 +206,8 @@ class CodeConformanceTest : TestCase() {
|
|||||||
for (test in tests) {
|
for (test in tests) {
|
||||||
if (test.result.isNotEmpty()) {
|
if (test.result.isNotEmpty()) {
|
||||||
append(test.message.format(test.result.size, test.result.joinToString("\n")))
|
append(test.message.format(test.result.size, test.result.joinToString("\n")))
|
||||||
appendln()
|
appendLine()
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -55,10 +55,10 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
|
|||||||
)
|
)
|
||||||
val result = buildString {
|
val result = buildString {
|
||||||
for (annotationClassId in mapping.moduleData.annotations) {
|
for (annotationClassId in mapping.moduleData.annotations) {
|
||||||
appendln("@$annotationClassId")
|
appendLine("@$annotationClassId")
|
||||||
}
|
}
|
||||||
for ((fqName, packageParts) in mapping.packageFqName2Parts) {
|
for ((fqName, packageParts) in mapping.packageFqName2Parts) {
|
||||||
appendln(fqName)
|
appendLine(fqName)
|
||||||
for (part in packageParts.parts) {
|
for (part in packageParts.parts) {
|
||||||
append(" ")
|
append(" ")
|
||||||
append(part)
|
append(part)
|
||||||
@@ -68,7 +68,7 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
|
|||||||
append(facadeName)
|
append(facadeName)
|
||||||
append(")")
|
append(")")
|
||||||
}
|
}
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,20 +38,20 @@ class CompilerFileLimitTest : CompilerSmokeTestBase() {
|
|||||||
return buildString {
|
return buildString {
|
||||||
append("package large\n\n")
|
append("package large\n\n")
|
||||||
(0..size).forEach {
|
(0..size).forEach {
|
||||||
appendln("class Class$it")
|
appendLine("class Class$it")
|
||||||
appendln("{")
|
appendLine("{")
|
||||||
appendln("\tfun foo(): Long = $it")
|
appendLine("\tfun foo(): Long = $it")
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
appendln("\n")
|
appendLine("\n")
|
||||||
repeat(2000) {
|
repeat(2000) {
|
||||||
appendln("// kotlin rules ... and stuff")
|
appendLine("// kotlin rules ... and stuff")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appendln("fun main()")
|
appendLine("fun main()")
|
||||||
appendln("{")
|
appendLine("{")
|
||||||
appendln("\tval result = Class5().foo() + Class$size().foo()")
|
appendLine("\tval result = Class5().foo() + Class$size().foo()")
|
||||||
appendln("\tprintln(result)")
|
appendLine("\tprintln(result)")
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -81,33 +81,33 @@ class CompilerFileLimitTest : CompilerSmokeTestBase() {
|
|||||||
return buildString {
|
return buildString {
|
||||||
append("package usesLarge\n\n")
|
append("package usesLarge\n\n")
|
||||||
append("import large.Large\n\n")
|
append("import large.Large\n\n")
|
||||||
appendln("fun main()")
|
appendLine("fun main()")
|
||||||
appendln("{")
|
appendLine("{")
|
||||||
appendln("\tval result = Large.Class0().foo() + Large.Class$size().foo()")
|
appendLine("\tval result = Large.Class0().foo() + Large.Class$size().foo()")
|
||||||
appendln("\tprintln(result)")
|
appendLine("\tprintln(result)")
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateLargeJavaFile(size: Int): String {
|
private fun generateLargeJavaFile(size: Int): String {
|
||||||
return buildString {
|
return buildString {
|
||||||
append("package large;\n\n")
|
append("package large;\n\n")
|
||||||
appendln("public class Large")
|
appendLine("public class Large")
|
||||||
appendln("{")
|
appendLine("{")
|
||||||
(0..size).forEach {
|
(0..size).forEach {
|
||||||
appendln("\tpublic static class Class$it")
|
appendLine("\tpublic static class Class$it")
|
||||||
appendln("\t{")
|
appendLine("\t{")
|
||||||
appendln("\t\tpublic long foo()")
|
appendLine("\t\tpublic long foo()")
|
||||||
appendln("\t\t{")
|
appendLine("\t\t{")
|
||||||
appendln("\t\t\t return $it;")
|
appendLine("\t\t\t return $it;")
|
||||||
appendln("\t\t}")
|
appendLine("\t\t}")
|
||||||
appendln("\t}")
|
appendLine("\t}")
|
||||||
appendln("\n")
|
appendLine("\n")
|
||||||
repeat(2000) {
|
repeat(2000) {
|
||||||
appendln("// kotlin rules ... and stuff")
|
appendLine("// kotlin rules ... and stuff")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-17
@@ -54,31 +54,31 @@ abstract class AbstractMultiPlatformIntegrationTest : KtUsefulTestCase() {
|
|||||||
val jvm2Dest = File(tmpdir, "jvm2").absolutePath.takeIf { jvm2Src != null }
|
val jvm2Dest = File(tmpdir, "jvm2").absolutePath.takeIf { jvm2Src != null }
|
||||||
|
|
||||||
val result = buildString {
|
val result = buildString {
|
||||||
appendln("-- Common --")
|
appendLine("-- Common --")
|
||||||
appendln(K2MetadataCompiler().compile(commonSrc, null, "-d", commonDest, *optionalStdlibCommon))
|
appendLine(K2MetadataCompiler().compile(commonSrc, null, "-d", commonDest, *optionalStdlibCommon))
|
||||||
|
|
||||||
if (jvmSrc != null) {
|
if (jvmSrc != null) {
|
||||||
appendln()
|
appendLine()
|
||||||
appendln("-- JVM --")
|
appendLine("-- JVM --")
|
||||||
appendln(K2JVMCompiler().compile(jvmSrc, commonSrc, "-d", jvmDest!!))
|
appendLine(K2JVMCompiler().compile(jvmSrc, commonSrc, "-d", jvmDest!!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jsSrc != null) {
|
if (jsSrc != null) {
|
||||||
appendln()
|
appendLine()
|
||||||
appendln("-- JS --")
|
appendLine("-- JS --")
|
||||||
appendln(K2JSCompiler().compile(jsSrc, commonSrc, "-output", jsDest!!))
|
appendLine(K2JSCompiler().compile(jsSrc, commonSrc, "-output", jsDest!!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (common2Src != null) {
|
if (common2Src != null) {
|
||||||
appendln()
|
appendLine()
|
||||||
appendln("-- Common (2) --")
|
appendLine("-- Common (2) --")
|
||||||
appendln(K2MetadataCompiler().compile(common2Src, null, "-d", common2Dest!!, "-cp", commonDest, *optionalStdlibCommon))
|
appendLine(K2MetadataCompiler().compile(common2Src, null, "-d", common2Dest!!, "-cp", commonDest, *optionalStdlibCommon))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jvm2Src != null) {
|
if (jvm2Src != null) {
|
||||||
appendln()
|
appendLine()
|
||||||
appendln("-- JVM (2) --")
|
appendLine("-- JVM (2) --")
|
||||||
appendln(
|
appendLine(
|
||||||
K2JVMCompiler().compile(
|
K2JVMCompiler().compile(
|
||||||
jvm2Src, common2Src, "-d", jvm2Dest!!,
|
jvm2Src, common2Src, "-d", jvm2Dest!!,
|
||||||
"-cp", listOfNotNull(commonDest, common2Dest, jvmDest).joinToString(File.pathSeparator)
|
"-cp", listOfNotNull(commonDest, common2Dest, jvmDest).joinToString(File.pathSeparator)
|
||||||
@@ -110,9 +110,9 @@ abstract class AbstractMultiPlatformIntegrationTest : KtUsefulTestCase() {
|
|||||||
"-Xmulti-platform" + mainArguments +
|
"-Xmulti-platform" + mainArguments +
|
||||||
loadExtraArguments(listOfNotNull(sources, commonSources))
|
loadExtraArguments(listOfNotNull(sources, commonSources))
|
||||||
)
|
)
|
||||||
appendln("Exit code: $exitCode")
|
appendLine("Exit code: $exitCode")
|
||||||
appendln("Output:")
|
appendLine("Output:")
|
||||||
appendln(output)
|
appendLine(output)
|
||||||
}.trimTrailingWhitespacesAndAddNewlineAtEOF().trimEnd('\r', '\n')
|
}.trimTrailingWhitespacesAndAddNewlineAtEOF().trimEnd('\r', '\n')
|
||||||
|
|
||||||
private fun loadExtraArguments(sources: List<File>): List<String> = sources.flatMap { source ->
|
private fun loadExtraArguments(sources: List<File>): List<String> = sources.flatMap { source ->
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ abstract class AbstractReplInterpreterTest : KtUsefulTestCase() {
|
|||||||
|
|
||||||
val value = StringBuilder()
|
val value = StringBuilder()
|
||||||
while (lines.isNotEmpty() && !START_PATTERN.matcher(lines.peek()!!).matches()) {
|
while (lines.isNotEmpty() && !START_PATTERN.matcher(lines.peek()!!).matches()) {
|
||||||
value.appendln(lines.poll()!!)
|
value.appendLine(lines.poll()!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
result.add(OneLine(code, value.toString()))
|
result.add(OneLine(code, value.toString()))
|
||||||
|
|||||||
+4
-4
@@ -97,10 +97,10 @@ class CapturedTypeApproximationTest : KotlinTestWithEnvironment() {
|
|||||||
val typeParameters = functionFoo.typeParameters
|
val typeParameters = functionFoo.typeParameters
|
||||||
val type = functionFoo.returnType
|
val type = functionFoo.returnType
|
||||||
|
|
||||||
appendln(testType)
|
appendLine(testType)
|
||||||
|
|
||||||
if (bindingContext.diagnostics.noSuppression().any { it.severity == Severity.ERROR }) {
|
if (bindingContext.diagnostics.noSuppression().any { it.severity == Severity.ERROR }) {
|
||||||
appendln(" compiler error\n")
|
appendLine(" compiler error\n")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,9 +119,9 @@ class CapturedTypeApproximationTest : KotlinTestWithEnvironment() {
|
|||||||
if (testSubstitution.size > 1) append("${typeParameter.name} = ")
|
if (testSubstitution.size > 1) append("${typeParameter.name} = ")
|
||||||
append("${testSubstitution[typeParameter]}. ")
|
append("${testSubstitution[typeParameter]}. ")
|
||||||
}
|
}
|
||||||
appendln("lower: $lower; upper: $upper; substitution: $substitution")
|
appendLine("lower: $lower; upper: $upper; substitution: $substitution")
|
||||||
}
|
}
|
||||||
if (testTypes.lastIndex != index) appendln()
|
if (testTypes.lastIndex != index) appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ internal class DescriptorRendererImpl(
|
|||||||
) {
|
) {
|
||||||
append(renderAnnotation(annotation, target))
|
append(renderAnnotation(annotation, target))
|
||||||
if (eachAnnotationOnNewLine) {
|
if (eachAnnotationOnNewLine) {
|
||||||
appendln()
|
appendLine()
|
||||||
} else {
|
} else {
|
||||||
append(" ")
|
append(" ")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ fun findCorrespondingSupertype(
|
|||||||
private fun KotlinType.approximate() = approximateCapturedTypes(this).upper
|
private fun KotlinType.approximate() = approximateCapturedTypes(this).upper
|
||||||
|
|
||||||
private fun TypeConstructor.debugInfo() = buildString {
|
private fun TypeConstructor.debugInfo() = buildString {
|
||||||
operator fun String.unaryPlus() = appendln(this)
|
operator fun String.unaryPlus() = appendLine(this)
|
||||||
|
|
||||||
+ "type: ${this@debugInfo}"
|
+ "type: ${this@debugInfo}"
|
||||||
+ "hashCode: ${this@debugInfo.hashCode()}"
|
+ "hashCode: ${this@debugInfo.hashCode()}"
|
||||||
|
|||||||
+11
-11
@@ -120,7 +120,7 @@ private class KotlinIdeaResolutionException(
|
|||||||
init {
|
init {
|
||||||
withAttachment("info.txt", buildString {
|
withAttachment("info.txt", buildString {
|
||||||
append(resolvingWhat.description())
|
append(resolvingWhat.description())
|
||||||
appendln("---------------------------------------------")
|
appendLine("---------------------------------------------")
|
||||||
append(creationPlace.description())
|
append(creationPlace.description())
|
||||||
})
|
})
|
||||||
for (element in resolvingWhat.elements.withIndex()) {
|
for (element in resolvingWhat.elements.withIndex()) {
|
||||||
@@ -137,15 +137,15 @@ private class CreationPlace(
|
|||||||
private val platform: TargetPlatform?
|
private val platform: TargetPlatform?
|
||||||
) {
|
) {
|
||||||
fun description() = buildString {
|
fun description() = buildString {
|
||||||
appendln("Resolver created for:")
|
appendLine("Resolver created for:")
|
||||||
for (element in elements) {
|
for (element in elements) {
|
||||||
appendElement(element)
|
appendElement(element)
|
||||||
}
|
}
|
||||||
if (moduleInfo != null) {
|
if (moduleInfo != null) {
|
||||||
appendln("Provided module info: $moduleInfo")
|
appendLine("Provided module info: $moduleInfo")
|
||||||
}
|
}
|
||||||
if (platform != null) {
|
if (platform != null) {
|
||||||
appendln("Provided platform: $platform")
|
appendLine("Provided platform: $platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,22 +161,22 @@ private class ResolvingWhat(
|
|||||||
|
|
||||||
fun description(): String {
|
fun description(): String {
|
||||||
return buildString {
|
return buildString {
|
||||||
appendln("Failed performing task:")
|
appendLine("Failed performing task:")
|
||||||
if (serviceClass != null) {
|
if (serviceClass != null) {
|
||||||
appendln("Getting service: ${serviceClass.name}")
|
appendLine("Getting service: ${serviceClass.name}")
|
||||||
} else {
|
} else {
|
||||||
append("Analyzing code")
|
append("Analyzing code")
|
||||||
if (bodyResolveMode != null) {
|
if (bodyResolveMode != null) {
|
||||||
append(" in BodyResolveMode.$bodyResolveMode")
|
append(" in BodyResolveMode.$bodyResolveMode")
|
||||||
}
|
}
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
appendln("Elements:")
|
appendLine("Elements:")
|
||||||
for (element in elements) {
|
for (element in elements) {
|
||||||
appendElement(element)
|
appendElement(element)
|
||||||
}
|
}
|
||||||
if (moduleDescriptor != null) {
|
if (moduleDescriptor != null) {
|
||||||
appendln("Provided module descriptor for module ${moduleDescriptor.getCapability(ModuleInfo.Capability)}")
|
appendLine("Provided module descriptor for module ${moduleDescriptor.getCapability(ModuleInfo.Capability)}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -184,10 +184,10 @@ private class ResolvingWhat(
|
|||||||
|
|
||||||
private fun StringBuilder.appendElement(element: PsiElement) {
|
private fun StringBuilder.appendElement(element: PsiElement) {
|
||||||
fun info(key: String, value: String?) {
|
fun info(key: String, value: String?) {
|
||||||
appendln(" $key = $value")
|
appendLine(" $key = $value")
|
||||||
}
|
}
|
||||||
|
|
||||||
appendln("Element of type: ${element.javaClass.simpleName}:")
|
appendLine("Element of type: ${element.javaClass.simpleName}:")
|
||||||
if (element is PsiNamedElement) {
|
if (element is PsiNamedElement) {
|
||||||
info("name", element.name)
|
info("name", element.name)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -175,7 +175,7 @@ class PluginDeclarationProviderFactory(
|
|||||||
append(it.name)
|
append(it.name)
|
||||||
append(" isPhysical=${it.isPhysical}")
|
append(" isPhysical=${it.isPhysical}")
|
||||||
append(" modStamp=${it.modificationStamp}")
|
append(" modStamp=${it.modificationStamp}")
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class KotlinDecompilerServiceImpl : KotlinDecompilerService {
|
|||||||
decompiledText.values.singleOrNull()?.let { return it }
|
decompiledText.values.singleOrNull()?.let { return it }
|
||||||
return buildString {
|
return buildString {
|
||||||
for ((filename, content) in decompiledText) {
|
for ((filename, content) in decompiledText) {
|
||||||
appendln("// $filename")
|
appendLine("// $filename")
|
||||||
append(content)
|
append(content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -79,9 +79,9 @@ class ModulesEditorToolbarDecorator(
|
|||||||
buildString {
|
buildString {
|
||||||
val moduleName = selectedModule?.name!!
|
val moduleName = selectedModule?.name!!
|
||||||
if (tree.selectedSettingItem.safeAs<Module>()?.kind != ModuleKind.target) {
|
if (tree.selectedSettingItem.safeAs<Module>()?.kind != ModuleKind.target) {
|
||||||
appendln(KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.module", moduleName))
|
appendLine(KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.module", moduleName))
|
||||||
} else {
|
} else {
|
||||||
appendln(KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.target", moduleName))
|
appendLine(KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.target", moduleName))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.question", moduleKindText),
|
KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.question", moduleKindText),
|
||||||
|
|||||||
+3
-3
@@ -59,9 +59,9 @@ abstract class AbstractAsyncStackTraceTest : KotlinDescriptorTestCaseWithSteppin
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun renderAsyncStackTrace(trace: List<StackFrameItem>) = buildString {
|
private fun renderAsyncStackTrace(trace: List<StackFrameItem>) = buildString {
|
||||||
appendln("Async stack trace:")
|
appendLine("Async stack trace:")
|
||||||
for (item in trace) {
|
for (item in trace) {
|
||||||
append(MARGIN).appendln(item.toString())
|
append(MARGIN).appendLine(item.toString())
|
||||||
val declaredFields = listDeclaredFields(item.javaClass)
|
val declaredFields = listDeclaredFields(item.javaClass)
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
@@ -77,7 +77,7 @@ abstract class AbstractAsyncStackTraceTest : KotlinDescriptorTestCaseWithSteppin
|
|||||||
val name = descriptor.calcValueName()
|
val name = descriptor.calcValueName()
|
||||||
val value = descriptor.calcValue(evaluationContext)
|
val value = descriptor.calcValue(evaluationContext)
|
||||||
|
|
||||||
append(MARGIN).append(MARGIN).append(name).append(" = ").appendln(value)
|
append(MARGIN).append(MARGIN).append(name).append(" = ").appendLine(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ abstract class AbstractCoroutineDumpTest : KotlinDescriptorTestCaseWithStepping(
|
|||||||
|
|
||||||
private fun stringDump(infoData: List<CoroutineInfoData>) = buildString {
|
private fun stringDump(infoData: List<CoroutineInfoData>) = buildString {
|
||||||
infoData.forEach {
|
infoData.forEach {
|
||||||
appendln("\"${it.key.name}\", state: ${it.key.state}")
|
appendLine("\"${it.key.name}\", state: ${it.key.state}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -117,7 +117,7 @@ abstract class AbstractFileRankingTest : LowLevelDebuggerTestBase() {
|
|||||||
|
|
||||||
if (problems.isNotEmpty()) {
|
if (problems.isNotEmpty()) {
|
||||||
throw AssertionError(buildString {
|
throw AssertionError(buildString {
|
||||||
appendln("There were association errors:").appendln()
|
appendLine("There were association errors:").appendLine()
|
||||||
problems.joinTo(this, "\n\n")
|
problems.joinTo(this, "\n\n")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -258,9 +258,9 @@ class PerformanceNativeProjectsTest : AbstractPerformanceProjectsTest() {
|
|||||||
buildString {
|
buildString {
|
||||||
originalKtFileContents.forEachIndexed { index, line ->
|
originalKtFileContents.forEachIndexed { index, line ->
|
||||||
if (index == packageLineIndex) {
|
if (index == packageLineIndex) {
|
||||||
appendln(line.replace("perfTestPackage1", "perfTestPackage$n"))
|
appendLine(line.replace("perfTestPackage1", "perfTestPackage$n"))
|
||||||
} else {
|
} else {
|
||||||
appendln(line)
|
appendLine(line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Stats(
|
|||||||
init {
|
init {
|
||||||
statsOutput = statsFile.bufferedWriter()
|
statsOutput = statsFile.bufferedWriter()
|
||||||
|
|
||||||
statsOutput.appendln(header.joinToString())
|
statsOutput.appendLine(header.joinToString())
|
||||||
|
|
||||||
PerformanceCounter.setTimeCounterEnabled(true)
|
PerformanceCounter.setTimeCounterEnabled(true)
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ class Stats(
|
|||||||
private fun append(values: Array<Any>) {
|
private fun append(values: Array<Any>) {
|
||||||
require(values.size == header.size) { "Expected ${header.size} values, actual ${values.size} values" }
|
require(values.size == header.size) { "Expected ${header.size} values, actual ${values.size} values" }
|
||||||
with(statsOutput) {
|
with(statsOutput) {
|
||||||
appendln(values.joinToString { it.toString() })
|
appendLine(values.joinToString { it.toString() })
|
||||||
flush()
|
flush()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -52,20 +52,20 @@ class StatefulTestGradleProjectRefreshCallback(
|
|||||||
val error = error ?: return
|
val error = error ?: return
|
||||||
|
|
||||||
val failure = buildString {
|
val failure = buildString {
|
||||||
appendln("Gradle import failed for ${project.name} at $projectPath")
|
appendLine("Gradle import failed for ${project.name} at $projectPath")
|
||||||
|
|
||||||
project.guessProjectDir()
|
project.guessProjectDir()
|
||||||
|
|
||||||
append("=".repeat(40)).appendln(" Error message:")
|
append("=".repeat(40)).appendLine(" Error message:")
|
||||||
appendln(error.message.trimEnd())
|
appendLine(error.message.trimEnd())
|
||||||
|
|
||||||
append("=".repeat(40)).appendln(" Error details:")
|
append("=".repeat(40)).appendLine(" Error details:")
|
||||||
appendln(error.details?.trimEnd().orEmpty())
|
appendLine(error.details?.trimEnd().orEmpty())
|
||||||
|
|
||||||
append("=".repeat(40)).appendln(" Gradle process output:")
|
append("=".repeat(40)).appendLine(" Gradle process output:")
|
||||||
appendln(GradleProcessOutputInterceptor.getInstance()?.getOutput()?.trimEnd() ?: "<interceptor not installed>")
|
appendLine(GradleProcessOutputInterceptor.getInstance()?.getOutput()?.trimEnd() ?: "<interceptor not installed>")
|
||||||
|
|
||||||
appendln("=".repeat(40))
|
appendLine("=".repeat(40))
|
||||||
}
|
}
|
||||||
|
|
||||||
fail(failure)
|
fail(failure)
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class WrapValueParameterHandler(val base: DescriptorRenderer.ValueParametersHand
|
|||||||
|
|
||||||
override fun appendAfterValueParameters(parameterCount: Int, builder: StringBuilder) {
|
override fun appendAfterValueParameters(parameterCount: Int, builder: StringBuilder) {
|
||||||
if (parameterCount > 0) {
|
if (parameterCount > 0) {
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
}
|
}
|
||||||
base.appendAfterValueParameters(parameterCount, builder)
|
base.appendAfterValueParameters(parameterCount, builder)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -202,13 +202,13 @@ internal abstract class AbstractCompletionBenchmarkScenario(
|
|||||||
if (result == JFileChooser.APPROVE_OPTION) {
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
val file = jfc.selectedFile
|
val file = jfc.selectedFile
|
||||||
file.writeText(buildString {
|
file.writeText(buildString {
|
||||||
appendln("n, file, lines, ff, full")
|
appendLine("n, file, lines, ff, full")
|
||||||
var i = 0
|
var i = 0
|
||||||
allResults.forEach {
|
allResults.forEach {
|
||||||
append(i++)
|
append(i++)
|
||||||
append(", ")
|
append(", ")
|
||||||
it.toCSV(this)
|
it.toCSV(this)
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -204,13 +204,13 @@ internal abstract class AbstractCompletionBenchmarkScenario(
|
|||||||
if (result == JFileChooser.APPROVE_OPTION) {
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
val file = jfc.selectedFile
|
val file = jfc.selectedFile
|
||||||
file.writeText(buildString {
|
file.writeText(buildString {
|
||||||
appendln("n, file, lines, ff, full")
|
appendLine("n, file, lines, ff, full")
|
||||||
var i = 0
|
var i = 0
|
||||||
allResults.forEach {
|
allResults.forEach {
|
||||||
append(i++)
|
append(i++)
|
||||||
append(", ")
|
append(", ")
|
||||||
it.toCSV(this)
|
it.toCSV(this)
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -205,13 +205,13 @@ class HighlightingBenchmarkAction : AnAction() {
|
|||||||
if (result == JFileChooser.APPROVE_OPTION) {
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
val file = jfc.selectedFile
|
val file = jfc.selectedFile
|
||||||
file.writeText(buildString {
|
file.writeText(buildString {
|
||||||
appendln("n, file, lines, status, time")
|
appendLine("n, file, lines, status, time")
|
||||||
var i = 0
|
var i = 0
|
||||||
allResults.forEach {
|
allResults.forEach {
|
||||||
append(i++)
|
append(i++)
|
||||||
append(", ")
|
append(", ")
|
||||||
it.toCSV(this)
|
it.toCSV(this)
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ class JavaContextDeclarationRenderer {
|
|||||||
buildString {
|
buildString {
|
||||||
for (member in this@render) {
|
for (member in this@render) {
|
||||||
renderJavaDeclaration(member)
|
renderJavaDeclaration(member)
|
||||||
appendln()
|
appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ object KDocRenderer {
|
|||||||
sb.append("<$tag>")
|
sb.append("<$tag>")
|
||||||
processChildren()
|
processChildren()
|
||||||
sb.append("</$tag>")
|
sb.append("</$tag>")
|
||||||
if (newline) sb.appendln()
|
if (newline) sb.appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
val nodeType = node.type
|
val nodeType = node.type
|
||||||
|
|||||||
+4
-4
@@ -51,12 +51,12 @@ abstract class AbstractKotlinTypeAliasByExpansionShortNameIndexTest : KotlinLigh
|
|||||||
val result = index.get(key, project, scope)
|
val result = index.get(key, project, scope)
|
||||||
if (value !in result.map { it.name }) {
|
if (value !in result.map { it.name }) {
|
||||||
Assert.fail(buildString {
|
Assert.fail(buildString {
|
||||||
appendln("Record $record not found in index")
|
appendLine("Record $record not found in index")
|
||||||
appendln("Index contents:")
|
appendLine("Index contents:")
|
||||||
index.getAllKeys(project).asSequence().forEach {
|
index.getAllKeys(project).asSequence().forEach {
|
||||||
appendln("KEY: $it")
|
appendLine("KEY: $it")
|
||||||
index.get(it, project, scope).forEach {
|
index.get(it, project, scope).forEach {
|
||||||
appendln(" ${it.name}")
|
appendLine(" ${it.name}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ object UltraLightChecker {
|
|||||||
val initializingClass = initializingClass ?: return name
|
val initializingClass = initializingClass ?: return name
|
||||||
|
|
||||||
return buildString {
|
return buildString {
|
||||||
appendln("$name {")
|
appendLine("$name {")
|
||||||
append(initializingClass.renderMembers())
|
append(initializingClass.renderMembers())
|
||||||
append("}")
|
append("}")
|
||||||
}
|
}
|
||||||
@@ -272,7 +272,7 @@ object UltraLightChecker {
|
|||||||
append(typeParameters.renderTypeParams())
|
append(typeParameters.renderTypeParams())
|
||||||
append(extendsList.renderRefList("extends"))
|
append(extendsList.renderRefList("extends"))
|
||||||
append(implementsList.renderRefList("implements"))
|
append(implementsList.renderRefList("implements"))
|
||||||
appendln(" {")
|
appendLine(" {")
|
||||||
|
|
||||||
if (isEnum) {
|
if (isEnum) {
|
||||||
append(
|
append(
|
||||||
|
|||||||
+5
-5
@@ -212,12 +212,12 @@ abstract class AbstractLookupTrackerTest : TestWithWorkingDir() {
|
|||||||
fun doTest(path: String) {
|
fun doTest(path: String) {
|
||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
fun StringBuilder.indentln(string: String) {
|
fun StringBuilder.indentln(string: String) {
|
||||||
appendln(" $string")
|
appendLine(" $string")
|
||||||
}
|
}
|
||||||
fun CompilerOutput.logOutput(stepName: String) {
|
fun CompilerOutput.logOutput(stepName: String) {
|
||||||
sb.appendln("==== $stepName ====")
|
sb.appendLine("==== $stepName ====")
|
||||||
|
|
||||||
sb.appendln("Compiling files:")
|
sb.appendLine("Compiling files:")
|
||||||
for (compiledFile in compiledFiles.sortedBy { it.canonicalPath }) {
|
for (compiledFile in compiledFiles.sortedBy { it.canonicalPath }) {
|
||||||
val lookupsFromFile = lookups[compiledFile]
|
val lookupsFromFile = lookups[compiledFile]
|
||||||
val lookupStatus = when {
|
val lookupStatus = when {
|
||||||
@@ -229,10 +229,10 @@ abstract class AbstractLookupTrackerTest : TestWithWorkingDir() {
|
|||||||
sb.indentln("$relativePath$lookupStatus")
|
sb.indentln("$relativePath$lookupStatus")
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.appendln("Exit code: $exitCode")
|
sb.appendLine("Exit code: $exitCode")
|
||||||
errors.forEach(sb::indentln)
|
errors.forEach(sb::indentln)
|
||||||
|
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
val testDir = File(path)
|
val testDir = File(path)
|
||||||
|
|||||||
@@ -716,12 +716,12 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() {
|
|||||||
|
|
||||||
for (i in 0..classCount) {
|
for (i in 0..classCount) {
|
||||||
val code = buildString {
|
val code = buildString {
|
||||||
appendln("package foo")
|
appendLine("package foo")
|
||||||
appendln("class Foo$i {")
|
appendLine("class Foo$i {")
|
||||||
for (j in 0..methodCount) {
|
for (j in 0..methodCount) {
|
||||||
appendln(" fun get${j*j}(): Int = square($j)")
|
appendLine(" fun get${j*j}(): Int = square($j)")
|
||||||
}
|
}
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
|
|
||||||
}
|
}
|
||||||
File(srcDir, "Foo$i.kt").writeText(code)
|
File(srcDir, "Foo$i.kt").writeText(code)
|
||||||
|
|||||||
@@ -716,12 +716,12 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() {
|
|||||||
|
|
||||||
for (i in 0..classCount) {
|
for (i in 0..classCount) {
|
||||||
val code = buildString {
|
val code = buildString {
|
||||||
appendln("package foo")
|
appendLine("package foo")
|
||||||
appendln("class Foo$i {")
|
appendLine("class Foo$i {")
|
||||||
for (j in 0..methodCount) {
|
for (j in 0..methodCount) {
|
||||||
appendln(" fun get${j*j}(): Int = square($j)")
|
appendLine(" fun get${j*j}(): Int = square($j)")
|
||||||
}
|
}
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
|
|
||||||
}
|
}
|
||||||
File(srcDir, "Foo$i.kt").writeText(code)
|
File(srcDir, "Foo$i.kt").writeText(code)
|
||||||
|
|||||||
+11
-11
@@ -343,9 +343,9 @@ class MppJpsIncTestsGenerator(val txt: ModulesTxt, val testCaseDirProvider: (Tes
|
|||||||
|
|
||||||
serviceKtFile(module, fileNameSuffix).setFileContent(buildString {
|
serviceKtFile(module, fileNameSuffix).setFileContent(buildString {
|
||||||
if (settings.generatePlatformDependent)
|
if (settings.generatePlatformDependent)
|
||||||
appendln("expect fun ${module.platformDependentFunName}(): String")
|
appendLine("expect fun ${module.platformDependentFunName}(): String")
|
||||||
|
|
||||||
appendln("fun ${module.platformIndependentFunName}() = \"common$fileNameSuffix\"")
|
appendLine("fun ${module.platformIndependentFunName}() = \"common$fileNameSuffix\"")
|
||||||
|
|
||||||
appendTestFun(module, settings)
|
appendTestFun(module, settings)
|
||||||
})
|
})
|
||||||
@@ -364,14 +364,14 @@ class MppJpsIncTestsGenerator(val txt: ModulesTxt, val testCaseDirProvider: (Tes
|
|||||||
serviceKtFile(module, fileNameSuffix).setFileContent(buildString {
|
serviceKtFile(module, fileNameSuffix).setFileContent(buildString {
|
||||||
if (settings.generatePlatformDependent) {
|
if (settings.generatePlatformDependent) {
|
||||||
for (expectedBy in settings.generateActualDeclarationsFor) {
|
for (expectedBy in settings.generateActualDeclarationsFor) {
|
||||||
appendln(
|
appendLine(
|
||||||
"actual fun ${expectedBy.platformDependentFunName}(): String" +
|
"actual fun ${expectedBy.platformDependentFunName}(): String" +
|
||||||
" = \"${module.name}$fileNameSuffix\""
|
" = \"${module.name}$fileNameSuffix\""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appendln(
|
appendLine(
|
||||||
"fun ${module.platformOnlyFunName}()" +
|
"fun ${module.platformOnlyFunName}()" +
|
||||||
" = \"${module.name}$fileNameSuffix\""
|
" = \"${module.name}$fileNameSuffix\""
|
||||||
)
|
)
|
||||||
@@ -398,29 +398,29 @@ class MppJpsIncTestsGenerator(val txt: ModulesTxt, val testCaseDirProvider: (Tes
|
|||||||
module: ModulesTxt.Module,
|
module: ModulesTxt.Module,
|
||||||
settings: ModuleContentSettings
|
settings: ModuleContentSettings
|
||||||
) {
|
) {
|
||||||
appendln()
|
appendLine()
|
||||||
appendln("fun Test${module.serviceName}() {")
|
appendLine("fun Test${module.serviceName}() {")
|
||||||
|
|
||||||
val thisAndDependencies = mutableSetOf(module)
|
val thisAndDependencies = mutableSetOf(module)
|
||||||
module.collectDependenciesRecursivelyTo(thisAndDependencies)
|
module.collectDependenciesRecursivelyTo(thisAndDependencies)
|
||||||
thisAndDependencies.forEach { thisOrDependent ->
|
thisAndDependencies.forEach { thisOrDependent ->
|
||||||
if (thisOrDependent.isCommonModule) {
|
if (thisOrDependent.isCommonModule) {
|
||||||
appendln(" ${thisOrDependent.platformIndependentFunName}()")
|
appendLine(" ${thisOrDependent.platformIndependentFunName}()")
|
||||||
|
|
||||||
if (settings.generatePlatformDependent) {
|
if (settings.generatePlatformDependent) {
|
||||||
appendln(" ${thisOrDependent.platformDependentFunName}()")
|
appendLine(" ${thisOrDependent.platformDependentFunName}()")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// platform module
|
// platform module
|
||||||
appendln(" ${thisOrDependent.platformOnlyFunName}()")
|
appendLine(" ${thisOrDependent.platformOnlyFunName}()")
|
||||||
|
|
||||||
if (thisOrDependent.isJvmModule && thisOrDependent.contentsSettings.generateJavaFile) {
|
if (thisOrDependent.isJvmModule && thisOrDependent.contentsSettings.generateJavaFile) {
|
||||||
appendln(" ${thisOrDependent.javaClassName}().doStuff()")
|
appendLine(" ${thisOrDependent.javaClassName}().doStuff()")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ModulesTxt.Module.collectDependenciesRecursivelyTo(
|
private fun ModulesTxt.Module.collectDependenciesRecursivelyTo(
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ fun String.underlineAsText(from: Int, to: Int): String {
|
|||||||
|
|
||||||
if (isEndOfLine(c.toInt())) {
|
if (isEndOfLine(c.toInt())) {
|
||||||
if (lineWasMarked) {
|
if (lineWasMarked) {
|
||||||
lines.appendln(marks.toString().trimEnd())
|
lines.appendLine(marks.toString().trimEnd())
|
||||||
lineWasMarked = false
|
lineWasMarked = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ fun String.underlineAsText(from: Int, to: Int): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lineWasMarked) {
|
if (lineWasMarked) {
|
||||||
lines.appendln()
|
lines.appendLine()
|
||||||
lines.append(marks.toString())
|
lines.append(marks.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-6
@@ -51,15 +51,17 @@ class ExampleAnnotationProcessor : AbstractProcessor() {
|
|||||||
val simpleName = element.simpleName.toString()
|
val simpleName = element.simpleName.toString()
|
||||||
val generatedJavaClassName = generatedFilePrefix.capitalize() + simpleName.capitalize() + generatedFileSuffix
|
val generatedJavaClassName = generatedFilePrefix.capitalize() + simpleName.capitalize() + generatedFileSuffix
|
||||||
|
|
||||||
filer.createSourceFile(packageName + '.' + generatedJavaClassName).openWriter().use { with(it) {
|
filer.createSourceFile(packageName + '.' + generatedJavaClassName).openWriter().use {
|
||||||
appendln("package $packageName;")
|
with(it) {
|
||||||
appendln("public final class $generatedJavaClassName {}")
|
appendLine("package $packageName;")
|
||||||
}}
|
appendLine("public final class $generatedJavaClassName {}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (generateKotlinCode && kotlinGenerated != null && element.kind == ElementKind.CLASS) {
|
if (generateKotlinCode && 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() = \"$generatedJavaClassName: \" + toString()")
|
it.appendLine("fun $simpleName.customToString() = \"$generatedJavaClassName: \" + toString()")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,26 +33,26 @@ fun main(args: Array<String>) {
|
|||||||
val pkg = e.value.first().second
|
val pkg = e.value.first().second
|
||||||
|
|
||||||
File(dir, fileName).bufferedWriter().use { w ->
|
File(dir, fileName).bufferedWriter().use { w ->
|
||||||
w.appendln("package $pkg;")
|
w.appendLine("package $pkg;")
|
||||||
w.appendln()
|
w.appendLine()
|
||||||
w.appendln()
|
w.appendLine()
|
||||||
|
|
||||||
e.value.forEach { (url) ->
|
e.value.forEach { (url) ->
|
||||||
println("Loading $url...")
|
println("Loading $url...")
|
||||||
|
|
||||||
w.appendln("// Downloaded from $url")
|
w.appendLine("// Downloaded from $url")
|
||||||
val content = fetch(url)
|
val content = fetch(url)
|
||||||
|
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
if (url.endsWith(".idl")) {
|
if (url.endsWith(".idl")) {
|
||||||
w.appendln(content)
|
w.appendLine(content)
|
||||||
} else {
|
} else {
|
||||||
extractIDLText(content, w)
|
extractIDLText(content, w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
w.appendln()
|
w.appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,9 +69,9 @@ private fun fetch(url: String): String? {
|
|||||||
|
|
||||||
private fun Appendable.append(element: Element) {
|
private fun Appendable.append(element: Element) {
|
||||||
val text = element.text()
|
val text = element.text()
|
||||||
appendln(text)
|
appendLine(text)
|
||||||
if (!text.trimEnd().endsWith(";")) {
|
if (!text.trimEnd().endsWith(";")) {
|
||||||
appendln(";")
|
appendLine(";")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -354,11 +354,11 @@ abstract class BaseGradleIT {
|
|||||||
|
|
||||||
val errors = "(?m)^.*\\[ERROR] \\[\\S+] (.*)$".toRegex().findAll(output)
|
val errors = "(?m)^.*\\[ERROR] \\[\\S+] (.*)$".toRegex().findAll(output)
|
||||||
val errorMessage = buildString {
|
val errorMessage = buildString {
|
||||||
appendln("Gradle build failed")
|
appendLine("Gradle build failed")
|
||||||
appendln()
|
appendLine()
|
||||||
if (errors.any()) {
|
if (errors.any()) {
|
||||||
appendln("Possible errors:")
|
appendLine("Possible errors:")
|
||||||
errors.forEach { match -> appendln(match.groupValues[1]) }
|
errors.forEach { match -> appendLine(match.groupValues[1]) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fail(errorMessage)
|
fail(errorMessage)
|
||||||
@@ -669,10 +669,10 @@ Finished executing task ':$taskName'|
|
|||||||
}
|
}
|
||||||
|
|
||||||
val xmlString = buildString {
|
val xmlString = buildString {
|
||||||
appendln("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
|
appendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
|
||||||
appendln("<results>")
|
appendLine("<results>")
|
||||||
files.forEach {
|
files.forEach {
|
||||||
appendln(
|
appendLine(
|
||||||
it.readText()
|
it.readText()
|
||||||
.trimTrailingWhitespaces()
|
.trimTrailingWhitespaces()
|
||||||
.replace(projectDir.absolutePath, "/\$PROJECT_DIR$")
|
.replace(projectDir.absolutePath, "/\$PROJECT_DIR$")
|
||||||
@@ -680,7 +680,7 @@ Finished executing task ':$taskName'|
|
|||||||
.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
|
.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
appendln("</results>")
|
appendLine("</results>")
|
||||||
}
|
}
|
||||||
|
|
||||||
val doc = SAXBuilder().build(xmlString.reader())
|
val doc = SAXBuilder().build(xmlString.reader())
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ class KotlinGradleIT : BaseGradleIT() {
|
|||||||
wd1.deleteRecursively()
|
wd1.deleteRecursively()
|
||||||
if (wd1.exists()) {
|
if (wd1.exists()) {
|
||||||
val files = buildString {
|
val files = buildString {
|
||||||
wd1.walk().forEach { appendln(" " + it.relativeTo(wd1).path) }
|
wd1.walk().forEach { appendLine(" " + it.relativeTo(wd1).path) }
|
||||||
}
|
}
|
||||||
error("Some files in $wd1 were not removed:\n$files")
|
error("Some files in $wd1 were not removed:\n$files")
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -52,11 +52,11 @@ class MppHighlightingTestDataWithGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
// create Gradle Kotlin source sets for project roots:
|
// create Gradle Kotlin source sets for project roots:
|
||||||
val scriptCustomization = buildString {
|
val scriptCustomization = buildString {
|
||||||
appendln()
|
appendLine()
|
||||||
appendln("kotlin {\n sourceSets {")
|
appendLine("kotlin {\n sourceSets {")
|
||||||
sourceRoots.forEach { sourceRoot ->
|
sourceRoots.forEach { sourceRoot ->
|
||||||
if (sourceRoot.kotlinSourceSetName != "commonMain") {
|
if (sourceRoot.kotlinSourceSetName != "commonMain") {
|
||||||
appendln(
|
appendLine(
|
||||||
""" create("${sourceRoot.kotlinSourceSetName}") {
|
""" create("${sourceRoot.kotlinSourceSetName}") {
|
||||||
| dependsOn(getByName("commonMain"))
|
| dependsOn(getByName("commonMain"))
|
||||||
| listOf(${cliCompiler.targets.joinToString { "$it()" }}).forEach {
|
| listOf(${cliCompiler.targets.joinToString { "$it()" }}).forEach {
|
||||||
@@ -67,7 +67,7 @@ class MppHighlightingTestDataWithGradleIT : BaseGradleIT() {
|
|||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
appendln(" // commonMain source set used for common module")
|
appendLine(" // commonMain source set used for common module")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,11 +76,11 @@ class MppHighlightingTestDataWithGradleIT : BaseGradleIT() {
|
|||||||
sourceRoot.dependencies.forEach { dependency ->
|
sourceRoot.dependencies.forEach { dependency ->
|
||||||
sourceRoots.find { it.qualifiedName == dependency }?.let { depSourceRoot ->
|
sourceRoots.find { it.qualifiedName == dependency }?.let { depSourceRoot ->
|
||||||
val depSourceSet = depSourceRoot.kotlinSourceSetName
|
val depSourceSet = depSourceRoot.kotlinSourceSetName
|
||||||
appendln(""" getByName("${sourceRoot.kotlinSourceSetName}").dependsOn(getByName("$depSourceSet"))""")
|
appendLine(""" getByName("${sourceRoot.kotlinSourceSetName}").dependsOn(getByName("$depSourceSet"))""")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appendln(" }\n}")
|
appendLine(" }\n}")
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleBuildScript().appendText("\n" + scriptCustomization)
|
gradleBuildScript().appendText("\n" + scriptCustomization)
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ fun runProcess(
|
|||||||
if (options?.forceOutputToStdout ?: false) {
|
if (options?.forceOutputToStdout ?: false) {
|
||||||
println(it)
|
println(it)
|
||||||
}
|
}
|
||||||
sb.appendln(it)
|
sb.appendLine(it)
|
||||||
}
|
}
|
||||||
val exitCode = process.waitFor()
|
val exitCode = process.waitFor()
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -20,8 +20,8 @@ class MyProcessor() : AbstractProcessor() {
|
|||||||
fileCreated = true
|
fileCreated = true
|
||||||
val file = processingEnv.filer.createSourceFile("Check")
|
val file = processingEnv.filer.createSourceFile("Check")
|
||||||
file.openWriter().use {
|
file.openWriter().use {
|
||||||
it.appendln("// $annotations")
|
it.appendLine("// $annotations")
|
||||||
it.appendln("public class Check {}")
|
it.appendLine("public class Check {}")
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ class Kotlinp(private val settings: KotlinpSettings) {
|
|||||||
is KotlinClassMetadata.FileFacade -> FileFacadePrinter(settings).print(classFile)
|
is KotlinClassMetadata.FileFacade -> FileFacadePrinter(settings).print(classFile)
|
||||||
is KotlinClassMetadata.SyntheticClass -> {
|
is KotlinClassMetadata.SyntheticClass -> {
|
||||||
if (classFile.isLambda) LambdaPrinter(settings).print(classFile)
|
if (classFile.isLambda) LambdaPrinter(settings).print(classFile)
|
||||||
else buildString { appendln("synthetic class") }
|
else buildString { appendLine("synthetic class") }
|
||||||
}
|
}
|
||||||
is KotlinClassMetadata.MultiFileClassFacade -> MultiFileClassFacadePrinter().print(classFile)
|
is KotlinClassMetadata.MultiFileClassFacade -> MultiFileClassFacadePrinter().print(classFile)
|
||||||
is KotlinClassMetadata.MultiFileClassPart -> MultiFileClassPartPrinter(settings).print(classFile)
|
is KotlinClassMetadata.MultiFileClassPart -> MultiFileClassPartPrinter(settings).print(classFile)
|
||||||
is KotlinClassMetadata.Unknown -> buildString { appendln("unknown file (k=${classFile.header.kind})") }
|
is KotlinClassMetadata.Unknown -> buildString { appendLine("unknown file (k=${classFile.header.kind})") }
|
||||||
null -> buildString { appendln("unsupported file") }
|
null -> buildString { appendLine("unsupported file") }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun readClassFile(file: File): KotlinClassMetadata? {
|
internal fun readClassFile(file: File): KotlinClassMetadata? {
|
||||||
@@ -36,7 +36,7 @@ class Kotlinp(private val settings: KotlinpSettings) {
|
|||||||
|
|
||||||
internal fun renderModuleFile(metadata: KotlinModuleMetadata?): String =
|
internal fun renderModuleFile(metadata: KotlinModuleMetadata?): String =
|
||||||
if (metadata != null) ModuleFilePrinter(settings).print(metadata)
|
if (metadata != null) ModuleFilePrinter(settings).print(metadata)
|
||||||
else buildString { appendln("unsupported file") }
|
else buildString { appendLine("unsupported file") }
|
||||||
|
|
||||||
internal fun readModuleFile(file: File): KotlinModuleMetadata? =
|
internal fun readModuleFile(file: File): KotlinModuleMetadata? =
|
||||||
KotlinModuleMetadata.read(file.readBytes())
|
KotlinModuleMetadata.read(file.readBytes())
|
||||||
|
|||||||
@@ -57,15 +57,15 @@ private fun visitFunction(settings: KotlinpSettings, sb: StringBuilder, flags: F
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitEnd() {
|
override fun visitEnd() {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
if (lambdaClassOriginName != null) {
|
if (lambdaClassOriginName != null) {
|
||||||
sb.appendln(" // lambda class origin: $lambdaClassOriginName")
|
sb.appendLine(" // lambda class origin: $lambdaClassOriginName")
|
||||||
}
|
}
|
||||||
for (versionRequirement in versionRequirements) {
|
for (versionRequirement in versionRequirements) {
|
||||||
sb.appendln(" // $versionRequirement")
|
sb.appendLine(" // $versionRequirement")
|
||||||
}
|
}
|
||||||
if (jvmSignature != null) {
|
if (jvmSignature != null) {
|
||||||
sb.appendln(" // signature: $jvmSignature")
|
sb.appendLine(" // signature: $jvmSignature")
|
||||||
}
|
}
|
||||||
sb.append(" ")
|
sb.append(" ")
|
||||||
sb.appendFlags(flags, FUNCTION_FLAGS_MAP)
|
sb.appendFlags(flags, FUNCTION_FLAGS_MAP)
|
||||||
@@ -82,9 +82,9 @@ private fun visitFunction(settings: KotlinpSettings, sb: StringBuilder, flags: F
|
|||||||
if (returnType != null) {
|
if (returnType != null) {
|
||||||
sb.append(": ").append(returnType)
|
sb.append(": ").append(returnType)
|
||||||
}
|
}
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
if (contract != null) {
|
if (contract != null) {
|
||||||
sb.appendln(" $contract")
|
sb.appendLine(" $contract")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,24 +141,24 @@ private fun visitProperty(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitEnd() {
|
override fun visitEnd() {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
for (versionRequirement in versionRequirements) {
|
for (versionRequirement in versionRequirements) {
|
||||||
sb.appendln(" // $versionRequirement")
|
sb.appendLine(" // $versionRequirement")
|
||||||
}
|
}
|
||||||
if (jvmFieldSignature != null) {
|
if (jvmFieldSignature != null) {
|
||||||
sb.appendln(" // field: $jvmFieldSignature")
|
sb.appendLine(" // field: $jvmFieldSignature")
|
||||||
}
|
}
|
||||||
if (jvmGetterSignature != null) {
|
if (jvmGetterSignature != null) {
|
||||||
sb.appendln(" // getter: $jvmGetterSignature")
|
sb.appendLine(" // getter: $jvmGetterSignature")
|
||||||
}
|
}
|
||||||
if (jvmSetterSignature != null) {
|
if (jvmSetterSignature != null) {
|
||||||
sb.appendln(" // setter: $jvmSetterSignature")
|
sb.appendLine(" // setter: $jvmSetterSignature")
|
||||||
}
|
}
|
||||||
if (jvmSyntheticMethodForAnnotationsSignature != null) {
|
if (jvmSyntheticMethodForAnnotationsSignature != null) {
|
||||||
sb.appendln(" // synthetic method for annotations: $jvmSyntheticMethodForAnnotationsSignature")
|
sb.appendLine(" // synthetic method for annotations: $jvmSyntheticMethodForAnnotationsSignature")
|
||||||
}
|
}
|
||||||
if (isMovedFromInterfaceCompanion) {
|
if (isMovedFromInterfaceCompanion) {
|
||||||
sb.appendln(" // is moved from interface companion")
|
sb.appendLine(" // is moved from interface companion")
|
||||||
}
|
}
|
||||||
sb.append(" ")
|
sb.append(" ")
|
||||||
sb.appendFlags(flags, PROPERTY_FLAGS_MAP)
|
sb.appendFlags(flags, PROPERTY_FLAGS_MAP)
|
||||||
@@ -177,11 +177,11 @@ private fun visitProperty(
|
|||||||
if (Flag.Property.HAS_CONSTANT(flags)) {
|
if (Flag.Property.HAS_CONSTANT(flags)) {
|
||||||
sb.append(" /* = ... */")
|
sb.append(" /* = ... */")
|
||||||
}
|
}
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
if (Flag.Property.HAS_GETTER(flags)) {
|
if (Flag.Property.HAS_GETTER(flags)) {
|
||||||
sb.append(" ")
|
sb.append(" ")
|
||||||
sb.appendFlags(getterFlags, PROPERTY_ACCESSOR_FLAGS_MAP)
|
sb.appendFlags(getterFlags, PROPERTY_ACCESSOR_FLAGS_MAP)
|
||||||
sb.appendln("get")
|
sb.appendLine("get")
|
||||||
}
|
}
|
||||||
if (Flag.Property.HAS_SETTER(flags)) {
|
if (Flag.Property.HAS_SETTER(flags)) {
|
||||||
sb.append(" ")
|
sb.append(" ")
|
||||||
@@ -190,7 +190,7 @@ private fun visitProperty(
|
|||||||
if (setterParameter != null) {
|
if (setterParameter != null) {
|
||||||
sb.append("(").append(setterParameter).append(")")
|
sb.append("(").append(setterParameter).append(")")
|
||||||
}
|
}
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,18 +217,18 @@ private fun visitConstructor(sb: StringBuilder, flags: Flags): KmConstructorVisi
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitEnd() {
|
override fun visitEnd() {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
for (versionRequirement in versionRequirements) {
|
for (versionRequirement in versionRequirements) {
|
||||||
sb.appendln(" // $versionRequirement")
|
sb.appendLine(" // $versionRequirement")
|
||||||
}
|
}
|
||||||
if (jvmSignature != null) {
|
if (jvmSignature != null) {
|
||||||
sb.appendln(" // signature: $jvmSignature")
|
sb.appendLine(" // signature: $jvmSignature")
|
||||||
}
|
}
|
||||||
sb.append(" ")
|
sb.append(" ")
|
||||||
sb.appendFlags(flags, CONSTRUCTOR_FLAGS_MAP)
|
sb.appendFlags(flags, CONSTRUCTOR_FLAGS_MAP)
|
||||||
sb.append("constructor(")
|
sb.append("constructor(")
|
||||||
params.joinTo(sb)
|
params.joinTo(sb)
|
||||||
sb.appendln(")")
|
sb.appendLine(")")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,12 +257,12 @@ private fun visitTypeAlias(settings: KotlinpSettings, sb: StringBuilder, flags:
|
|||||||
printVersionRequirement { versionRequirements.add(it) }
|
printVersionRequirement { versionRequirements.add(it) }
|
||||||
|
|
||||||
override fun visitEnd() {
|
override fun visitEnd() {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
for (versionRequirement in versionRequirements) {
|
for (versionRequirement in versionRequirements) {
|
||||||
sb.appendln(" // $versionRequirement")
|
sb.appendLine(" // $versionRequirement")
|
||||||
}
|
}
|
||||||
for (annotation in annotations) {
|
for (annotation in annotations) {
|
||||||
sb.append(" ").append("@").append(renderAnnotation(annotation)).appendln()
|
sb.append(" ").append("@").append(renderAnnotation(annotation)).appendLine()
|
||||||
}
|
}
|
||||||
sb.append(" ")
|
sb.append(" ")
|
||||||
sb.appendFlags(flags, VISIBILITY_FLAGS_MAP)
|
sb.appendFlags(flags, VISIBILITY_FLAGS_MAP)
|
||||||
@@ -276,7 +276,7 @@ private fun visitTypeAlias(settings: KotlinpSettings, sb: StringBuilder, flags:
|
|||||||
if (expandedType != null) {
|
if (expandedType != null) {
|
||||||
sb.append(" /* = ").append(expandedType).append(" */")
|
sb.append(" /* = ").append(expandedType).append(" */")
|
||||||
}
|
}
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,12 +537,12 @@ private fun StringBuilder.appendDeclarationContainerExtensions(
|
|||||||
moduleName: String?
|
moduleName: String?
|
||||||
) {
|
) {
|
||||||
for ((i, sb) in localDelegatedProperties.withIndex()) {
|
for ((i, sb) in localDelegatedProperties.withIndex()) {
|
||||||
appendln()
|
appendLine()
|
||||||
appendln(" // local delegated property #$i")
|
appendLine(" // local delegated property #$i")
|
||||||
for (line in sb.lineSequence()) {
|
for (line in sb.lineSequence()) {
|
||||||
if (line.isBlank()) continue
|
if (line.isBlank()) continue
|
||||||
// Comment all uncommented lines to not make it look like these properties are declared here
|
// Comment all uncommented lines to not make it look like these properties are declared here
|
||||||
appendln(
|
appendLine(
|
||||||
if (line.startsWith(" ") && !line.startsWith(" //")) line.replaceFirst(" ", " // ")
|
if (line.startsWith(" ") && !line.startsWith(" //")) line.replaceFirst(" ", " // ")
|
||||||
else line
|
else line
|
||||||
)
|
)
|
||||||
@@ -550,8 +550,8 @@ private fun StringBuilder.appendDeclarationContainerExtensions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (settings.isVerbose && moduleName != null) {
|
if (settings.isVerbose && moduleName != null) {
|
||||||
appendln()
|
appendLine()
|
||||||
appendln(" // module name: $moduleName")
|
appendLine(" // module name: $moduleName")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,9 +564,9 @@ private fun printContract(output: (String) -> Unit): KmContractVisitor =
|
|||||||
|
|
||||||
override fun visitEnd() {
|
override fun visitEnd() {
|
||||||
output(buildString {
|
output(buildString {
|
||||||
appendln("contract {")
|
appendLine("contract {")
|
||||||
for (effect in effects) {
|
for (effect in effects) {
|
||||||
appendln(" $effect")
|
appendLine(" $effect")
|
||||||
}
|
}
|
||||||
append(" }")
|
append(" }")
|
||||||
})
|
})
|
||||||
@@ -705,10 +705,10 @@ class ClassPrinter(private val settings: KotlinpSettings) : KmClassVisitor(), Ab
|
|||||||
|
|
||||||
override fun visitEnd() {
|
override fun visitEnd() {
|
||||||
if (anonymousObjectOriginName != null) {
|
if (anonymousObjectOriginName != null) {
|
||||||
result.appendln("// anonymous object origin: $anonymousObjectOriginName")
|
result.appendLine("// anonymous object origin: $anonymousObjectOriginName")
|
||||||
}
|
}
|
||||||
for (versionRequirement in versionRequirements) {
|
for (versionRequirement in versionRequirements) {
|
||||||
result.appendln("// $versionRequirement")
|
result.appendLine("// $versionRequirement")
|
||||||
}
|
}
|
||||||
result.appendFlags(flags!!, CLASS_FLAGS_MAP)
|
result.appendFlags(flags!!, CLASS_FLAGS_MAP)
|
||||||
result.append(name)
|
result.append(name)
|
||||||
@@ -719,9 +719,9 @@ class ClassPrinter(private val settings: KotlinpSettings) : KmClassVisitor(), Ab
|
|||||||
result.append(" : ")
|
result.append(" : ")
|
||||||
supertypes.joinTo(result)
|
supertypes.joinTo(result)
|
||||||
}
|
}
|
||||||
result.appendln(" {")
|
result.appendLine(" {")
|
||||||
result.append(sb)
|
result.append(sb)
|
||||||
result.appendln("}")
|
result.appendLine("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitTypeParameter(flags: Flags, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor? =
|
override fun visitTypeParameter(flags: Flags, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor? =
|
||||||
@@ -743,23 +743,23 @@ class ClassPrinter(private val settings: KotlinpSettings) : KmClassVisitor(), Ab
|
|||||||
visitTypeAlias(settings, sb, flags, name)
|
visitTypeAlias(settings, sb, flags, name)
|
||||||
|
|
||||||
override fun visitCompanionObject(name: String) {
|
override fun visitCompanionObject(name: String) {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
sb.appendln(" // companion object: $name")
|
sb.appendLine(" // companion object: $name")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitNestedClass(name: String) {
|
override fun visitNestedClass(name: String) {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
sb.appendln(" // nested class: $name")
|
sb.appendLine(" // nested class: $name")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitEnumEntry(name: String) {
|
override fun visitEnumEntry(name: String) {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
sb.appendln(" $name,")
|
sb.appendLine(" $name,")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitSealedSubclass(name: ClassName) {
|
override fun visitSealedSubclass(name: ClassName) {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
sb.appendln(" // sealed subclass: $name")
|
sb.appendLine(" // sealed subclass: $name")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitVersionRequirement(): KmVersionRequirementVisitor? =
|
override fun visitVersionRequirement(): KmVersionRequirementVisitor? =
|
||||||
@@ -799,11 +799,11 @@ class ClassPrinter(private val settings: KotlinpSettings) : KmClassVisitor(), Ab
|
|||||||
|
|
||||||
abstract class PackagePrinter(private val settings: KotlinpSettings) : KmPackageVisitor() {
|
abstract class PackagePrinter(private val settings: KotlinpSettings) : KmPackageVisitor() {
|
||||||
internal val sb = StringBuilder().apply {
|
internal val sb = StringBuilder().apply {
|
||||||
appendln("package {")
|
appendLine("package {")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitEnd() {
|
override fun visitEnd() {
|
||||||
sb.appendln("}")
|
sb.appendLine("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitFunction(flags: Flags, name: String): KmFunctionVisitor? =
|
override fun visitFunction(flags: Flags, name: String): KmFunctionVisitor? =
|
||||||
@@ -843,14 +843,14 @@ class FileFacadePrinter(settings: KotlinpSettings) : PackagePrinter(settings), A
|
|||||||
|
|
||||||
class LambdaPrinter(private val settings: KotlinpSettings) : KmLambdaVisitor(), AbstractPrinter<KotlinClassMetadata.SyntheticClass> {
|
class LambdaPrinter(private val settings: KotlinpSettings) : KmLambdaVisitor(), AbstractPrinter<KotlinClassMetadata.SyntheticClass> {
|
||||||
private val sb = StringBuilder().apply {
|
private val sb = StringBuilder().apply {
|
||||||
appendln("lambda {")
|
appendLine("lambda {")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitFunction(flags: Flags, name: String): KmFunctionVisitor? =
|
override fun visitFunction(flags: Flags, name: String): KmFunctionVisitor? =
|
||||||
visitFunction(settings, sb, flags, name)
|
visitFunction(settings, sb, flags, name)
|
||||||
|
|
||||||
override fun visitEnd() {
|
override fun visitEnd() {
|
||||||
sb.appendln("}")
|
sb.appendLine("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun print(klass: KotlinClassMetadata.SyntheticClass): String {
|
override fun print(klass: KotlinClassMetadata.SyntheticClass): String {
|
||||||
@@ -863,7 +863,7 @@ class MultiFileClassPartPrinter(
|
|||||||
settings: KotlinpSettings
|
settings: KotlinpSettings
|
||||||
) : PackagePrinter(settings), AbstractPrinter<KotlinClassMetadata.MultiFileClassPart> {
|
) : PackagePrinter(settings), AbstractPrinter<KotlinClassMetadata.MultiFileClassPart> {
|
||||||
override fun print(klass: KotlinClassMetadata.MultiFileClassPart): String {
|
override fun print(klass: KotlinClassMetadata.MultiFileClassPart): String {
|
||||||
sb.appendln(" // facade: ${klass.facadeClassName}")
|
sb.appendLine(" // facade: ${klass.facadeClassName}")
|
||||||
klass.accept(this)
|
klass.accept(this)
|
||||||
return sb.toString()
|
return sb.toString()
|
||||||
}
|
}
|
||||||
@@ -872,11 +872,11 @@ class MultiFileClassPartPrinter(
|
|||||||
class MultiFileClassFacadePrinter : AbstractPrinter<KotlinClassMetadata.MultiFileClassFacade> {
|
class MultiFileClassFacadePrinter : AbstractPrinter<KotlinClassMetadata.MultiFileClassFacade> {
|
||||||
override fun print(klass: KotlinClassMetadata.MultiFileClassFacade): String =
|
override fun print(klass: KotlinClassMetadata.MultiFileClassFacade): String =
|
||||||
buildString {
|
buildString {
|
||||||
appendln("multi-file class {")
|
appendLine("multi-file class {")
|
||||||
for (part in klass.partClassNames) {
|
for (part in klass.partClassNames) {
|
||||||
appendln(" // $part")
|
appendLine(" // $part")
|
||||||
}
|
}
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -884,19 +884,19 @@ class ModuleFilePrinter(private val settings: KotlinpSettings) : KmModuleVisitor
|
|||||||
private val optionalAnnotations = mutableListOf<ClassPrinter>()
|
private val optionalAnnotations = mutableListOf<ClassPrinter>()
|
||||||
|
|
||||||
private val sb = StringBuilder().apply {
|
private val sb = StringBuilder().apply {
|
||||||
appendln("module {")
|
appendLine("module {")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitPackageParts(fqName: String, fileFacades: List<String>, multiFileClassParts: Map<String, String>) {
|
override fun visitPackageParts(fqName: String, fileFacades: List<String>, multiFileClassParts: Map<String, String>) {
|
||||||
val presentableFqName = if (fqName.isEmpty()) "<root>" else fqName
|
val presentableFqName = if (fqName.isEmpty()) "<root>" else fqName
|
||||||
sb.appendln(" package $presentableFqName {")
|
sb.appendLine(" package $presentableFqName {")
|
||||||
for (fileFacade in fileFacades) {
|
for (fileFacade in fileFacades) {
|
||||||
sb.appendln(" $fileFacade")
|
sb.appendLine(" $fileFacade")
|
||||||
}
|
}
|
||||||
for ((multiFileClassPart, facade) in multiFileClassParts) {
|
for ((multiFileClassPart, facade) in multiFileClassParts) {
|
||||||
sb.appendln(" $multiFileClassPart ($facade)")
|
sb.appendLine(" $multiFileClassPart ($facade)")
|
||||||
}
|
}
|
||||||
sb.appendln(" }")
|
sb.appendLine(" }")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitAnnotation(annotation: KmAnnotation) {
|
override fun visitAnnotation(annotation: KmAnnotation) {
|
||||||
@@ -908,14 +908,14 @@ class ModuleFilePrinter(private val settings: KotlinpSettings) : KmModuleVisitor
|
|||||||
|
|
||||||
override fun visitEnd() {
|
override fun visitEnd() {
|
||||||
if (optionalAnnotations.isNotEmpty()) {
|
if (optionalAnnotations.isNotEmpty()) {
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
sb.appendln(" // Optional annotations")
|
sb.appendLine(" // Optional annotations")
|
||||||
sb.appendln()
|
sb.appendLine()
|
||||||
for (element in optionalAnnotations) {
|
for (element in optionalAnnotations) {
|
||||||
sb.appendln(" " + element.result.toString().replace("\n", "\n ").trimEnd())
|
sb.appendLine(" " + element.result.toString().replace("\n", "\n ").trimEnd())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.appendln("}")
|
sb.appendLine("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun print(metadata: KotlinModuleMetadata): String {
|
fun print(metadata: KotlinModuleMetadata): String {
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ private fun compile(file: File, disposable: Disposable, tmpdir: File, forEachOut
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun StringBuilder.appendFileName(file: File) {
|
private fun StringBuilder.appendFileName(file: File) {
|
||||||
appendln("// ${file.invariantSeparatorsPath}")
|
appendLine("// ${file.invariantSeparatorsPath}")
|
||||||
appendln("// ------------------------------------------")
|
appendLine("// ------------------------------------------")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reads the class file and writes it back with *Writer visitors.
|
// Reads the class file and writes it back with *Writer visitors.
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ internal class JKCommentPrinter(val printer: JKPrinter) {
|
|||||||
for (comment in this@createText) {
|
for (comment in this@createText) {
|
||||||
if (comment.shouldBeDropped()) continue
|
if (comment.shouldBeDropped()) continue
|
||||||
val text = comment.createText() ?: continue
|
val text = comment.createText() ?: continue
|
||||||
if (needNewLine && comment.indent?.let { StringUtil.containsLineBreak(it) } != true) appendln()
|
if (needNewLine && comment.indent?.let { StringUtil.containsLineBreak(it) } != true) appendLine()
|
||||||
append(comment.indent ?: ' ')
|
append(comment.indent ?: ' ')
|
||||||
append(text)
|
append(text)
|
||||||
needNewLine = text.startsWith("//") || '\n' in text
|
needNewLine = text.startsWith("//") || '\n' in text
|
||||||
|
|||||||
@@ -169,29 +169,29 @@ fun KaptOptions.collectJavaSourceFiles(sourcesToReprocess: SourcesToReprocess =
|
|||||||
|
|
||||||
fun KaptOptions.logString(additionalInfo: String = "") = buildString {
|
fun KaptOptions.logString(additionalInfo: String = "") = buildString {
|
||||||
val additionalInfoRendered = if (additionalInfo.isEmpty()) "" else " ($additionalInfo)"
|
val additionalInfoRendered = if (additionalInfo.isEmpty()) "" else " ($additionalInfo)"
|
||||||
appendln("Kapt3 is enabled$additionalInfoRendered.")
|
appendLine("Kapt3 is enabled$additionalInfoRendered.")
|
||||||
|
|
||||||
appendln("Annotation processing mode: ${mode.stringValue}")
|
appendLine("Annotation processing mode: ${mode.stringValue}")
|
||||||
appendln("Memory leak detection mode: ${detectMemoryLeaks.stringValue}")
|
appendLine("Memory leak detection mode: ${detectMemoryLeaks.stringValue}")
|
||||||
KaptFlag.values().forEach { appendln(it.description + ": " + this@logString[it]) }
|
KaptFlag.values().forEach { appendLine(it.description + ": " + this@logString[it]) }
|
||||||
|
|
||||||
appendln("Project base dir: $projectBaseDir")
|
appendLine("Project base dir: $projectBaseDir")
|
||||||
appendln("Compile classpath: " + compileClasspath.joinToString())
|
appendLine("Compile classpath: " + compileClasspath.joinToString())
|
||||||
appendln("Java source roots: " + javaSourceRoots.joinToString())
|
appendLine("Java source roots: " + javaSourceRoots.joinToString())
|
||||||
|
|
||||||
appendln("Sources output directory: $sourcesOutputDir")
|
appendLine("Sources output directory: $sourcesOutputDir")
|
||||||
appendln("Class files output directory: $classesOutputDir")
|
appendLine("Class files output directory: $classesOutputDir")
|
||||||
appendln("Stubs output directory: $stubsOutputDir")
|
appendLine("Stubs output directory: $stubsOutputDir")
|
||||||
appendln("Incremental data output directory: $incrementalDataOutputDir")
|
appendLine("Incremental data output directory: $incrementalDataOutputDir")
|
||||||
|
|
||||||
appendln("Annotation processing classpath: " + processingClasspath.joinToString())
|
appendLine("Annotation processing classpath: " + processingClasspath.joinToString())
|
||||||
appendln("Annotation processors: " + processors.joinToString())
|
appendLine("Annotation processors: " + processors.joinToString())
|
||||||
|
|
||||||
appendln("AP options: $processingOptions")
|
appendLine("AP options: $processingOptions")
|
||||||
appendln("Javac options: $javacOptions")
|
appendLine("Javac options: $javacOptions")
|
||||||
|
|
||||||
appendln("[incremental apt] Changed files: $changedFiles")
|
appendLine("[incremental apt] Changed files: $changedFiles")
|
||||||
appendln("[incremental apt] Compiled sources directories: ${compiledSources.joinToString()}")
|
appendLine("[incremental apt] Compiled sources directories: ${compiledSources.joinToString()}")
|
||||||
appendln("[incremental apt] Cache directory for incremental compilation: $incrementalCache")
|
appendLine("[incremental apt] Cache directory for incremental compilation: $incrementalCache")
|
||||||
appendln("[incremental apt] Changed classpath names: ${classpathChanges.joinToString()}")
|
appendLine("[incremental apt] Changed classpath names: ${classpathChanges.joinToString()}")
|
||||||
}
|
}
|
||||||
+3
-3
@@ -96,8 +96,8 @@ abstract class AbstractKaptToolIntegrationTest : TestCaseWithTmpdir() {
|
|||||||
if (!process.waitFor(2, TimeUnit.MINUTES)) err("Process is still alive")
|
if (!process.waitFor(2, TimeUnit.MINUTES)) err("Process is still alive")
|
||||||
if (process.exitValue() != 0) {
|
if (process.exitValue() != 0) {
|
||||||
throw GotResult(buildString {
|
throw GotResult(buildString {
|
||||||
append("Return code: ").appendln(process.exitValue()).appendln()
|
append("Return code: ").appendLine(process.exitValue()).appendLine()
|
||||||
appendln(outputFile.readText())
|
appendLine(outputFile.readText())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,6 +117,6 @@ private val Section.args get() = readArgumentsFromArgFile(preprocessPathSeparato
|
|||||||
private fun preprocessPathSeparators(text: String): String = buildString {
|
private fun preprocessPathSeparators(text: String): String = buildString {
|
||||||
for (line in text.lineSequence()) {
|
for (line in text.lineSequence()) {
|
||||||
val transformed = if (line.startsWith("-cp ")) line.replace(':', File.pathSeparatorChar) else line
|
val transformed = if (line.startsWith("-cp ")) line.replace(':', File.pathSeparatorChar) else line
|
||||||
appendln(transformed)
|
appendLine(transformed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ class Section(val name: String, val content: String) {
|
|||||||
saveCurrent()
|
saveCurrent()
|
||||||
currentName = line.drop(2)
|
currentName = line.drop(2)
|
||||||
} else {
|
} else {
|
||||||
currentContent.appendln(line)
|
currentContent.appendLine(line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@ class Section(val name: String, val content: String) {
|
|||||||
|
|
||||||
fun List<Section>.render(): String = buildString {
|
fun List<Section>.render(): String = buildString {
|
||||||
for (section in this@render) {
|
for (section in this@render) {
|
||||||
append(SECTION_INDICATOR).appendln(section.name)
|
append(SECTION_INDICATOR).appendLine(section.name)
|
||||||
appendln(section.content).appendln()
|
appendLine(section.content).appendLine()
|
||||||
}
|
}
|
||||||
}.trim()
|
}.trim()
|
||||||
|
|
||||||
|
|||||||
@@ -240,8 +240,8 @@ abstract class AbstractKapt3Extension(
|
|||||||
|
|
||||||
for (leak in leaks) {
|
for (leak in leaks) {
|
||||||
logger.warn(buildString {
|
logger.warn(buildString {
|
||||||
appendln("Memory leak detected!")
|
appendLine("Memory leak detected!")
|
||||||
appendln("Location: '${leak.className}', static field '${leak.fieldName}'")
|
appendLine("Location: '${leak.className}', static field '${leak.fieldName}'")
|
||||||
append(leak.description)
|
append(leak.description)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -42,9 +42,9 @@ class KotlinUSwitchExpression(
|
|||||||
|
|
||||||
override fun asRenderString() = buildString {
|
override fun asRenderString() = buildString {
|
||||||
val expr = expression?.let { "(" + it.asRenderString() + ") " } ?: ""
|
val expr = expression?.let { "(" + it.asRenderString() + ") " } ?: ""
|
||||||
appendln("switch $expr {")
|
appendLine("switch $expr {")
|
||||||
appendln(body.asRenderString())
|
appendLine(body.asRenderString())
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
override val switchIdentifier: UIdentifier
|
override val switchIdentifier: UIdentifier
|
||||||
@@ -62,9 +62,9 @@ class KotlinUSwitchEntry(
|
|||||||
override val body: UExpressionList by lz {
|
override val body: UExpressionList by lz {
|
||||||
object : KotlinUExpressionList(sourcePsi, KotlinSpecialExpressionKinds.WHEN_ENTRY, this@KotlinUSwitchEntry) {
|
object : KotlinUExpressionList(sourcePsi, KotlinSpecialExpressionKinds.WHEN_ENTRY, this@KotlinUSwitchEntry) {
|
||||||
override fun asRenderString() = buildString {
|
override fun asRenderString() = buildString {
|
||||||
appendln("{")
|
appendLine("{")
|
||||||
expressions.forEach { appendln(it.asRenderString().withMargin) }
|
expressions.forEach { appendLine(it.asRenderString().withMargin) }
|
||||||
appendln("}")
|
appendLine("}")
|
||||||
}
|
}
|
||||||
}.apply KotlinUExpressionList@{
|
}.apply KotlinUExpressionList@{
|
||||||
val exprPsi = this@KotlinUSwitchEntry.sourcePsi.expression
|
val exprPsi = this@KotlinUSwitchEntry.sourcePsi.expression
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class AlternativesRenderLogTest : AbstractKotlinUastTest() {
|
|||||||
builder.append(" ".repeat(level))
|
builder.append(" ".repeat(level))
|
||||||
builder.append("[${uElement.size}]:")
|
builder.append("[${uElement.size}]:")
|
||||||
builder.append(uElement.joinToString(", ", "[", "]") { it.asLogString() })
|
builder.append(uElement.joinToString(", ", "[", "]") { it.asLogString() })
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
}
|
}
|
||||||
if (uElement.any()) level++
|
if (uElement.any()) level++
|
||||||
element.acceptChildren(this)
|
element.acceptChildren(this)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class MultiplesRequiredTypesTest : AbstractKotlinUastTest() {
|
|||||||
if (uElement != null) {
|
if (uElement != null) {
|
||||||
builder.append(" ".repeat(level))
|
builder.append(" ".repeat(level))
|
||||||
builder.append(uElement.asLogString())
|
builder.append(uElement.asLogString())
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
}
|
}
|
||||||
if (uElement != null) level++
|
if (uElement != null) level++
|
||||||
element.acceptChildren(this)
|
element.acceptChildren(this)
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ abstract class IndentedPrintingVisitor(val shouldIndent: (PsiElement) -> Boolean
|
|||||||
if (charSequence != null) {
|
if (charSequence != null) {
|
||||||
builder.append(" ".repeat(level))
|
builder.append(" ".repeat(level))
|
||||||
builder.append(charSequence)
|
builder.append(charSequence)
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
val shouldIndent = shouldIndent(element)
|
val shouldIndent = shouldIndent(element)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ interface TypesTestBase {
|
|||||||
val value = node.getExpressionType()
|
val value = node.getExpressionType()
|
||||||
value?.let { builder.append(" : ").append(it) }
|
value?.let { builder.append(" : ").append(it) }
|
||||||
}
|
}
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
level++
|
level++
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ interface ValuesTestBase {
|
|||||||
val value = evaluationContext.valueOf(node)
|
val value = evaluationContext.valueOf(node)
|
||||||
builder.append(" = ").append(value)
|
builder.append(" = ").append(value)
|
||||||
}
|
}
|
||||||
builder.appendln()
|
builder.appendLine()
|
||||||
level++
|
level++
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user