Fix "Should be replaced with Kotlin function" warnings

This commit is contained in:
Dmitry Gridin
2019-04-16 12:12:06 +07:00
parent d738a12b86
commit 3bed360c98
77 changed files with 161 additions and 99 deletions
@@ -51,7 +51,7 @@ actual fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: S
*/
@InlineOnly
actual inline fun todo(@Suppress("UNUSED_PARAMETER") block: () -> Unit) {
System.out.println("TODO at " + currentStackTrace()[0])
println("TODO at " + currentStackTrace()[0])
}
/**
@@ -306,7 +306,7 @@ abstract class BaseGradleIT {
} catch (t: Throwable) {
// to prevent duplication of output
if (!options.forceOutputToStdout) {
System.out.println(result.output)
println(result.output)
}
throw t
}
@@ -37,7 +37,7 @@ fun runProcess(
val sb = StringBuilder()
process.inputStream!!.bufferedReader().forEachLine {
if (options?.forceOutputToStdout ?: false) {
System.out.println(it)
println(it)
}
sb.appendln(it)
}
@@ -1,7 +1,7 @@
package projB
fun main(vararg args: String) {
System.out.println(projA.getInfo())
println(projA.getInfo())
}
@@ -76,7 +76,7 @@ internal class GradleKotlinCompilerWork @Inject constructor(
companion object {
init {
if (System.getProperty("org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.trace.loading") == "true") {
System.out.println("Loaded GradleKotlinCompilerWork")
println("Loaded GradleKotlinCompilerWork")
}
}
}
@@ -93,7 +93,7 @@ internal fun runToolInSeparateProcess(
}
} else {
process.inputStream!!.bufferedReader().forEachLine {
System.out.println(it)
println(it)
}
}
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.gradle.report.configureBuildReporter
import org.jetbrains.kotlin.gradle.utils.relativeToRoot
import org.jetbrains.kotlin.utils.addToStdlib.sumByLong
import java.lang.management.ManagementFactory
import kotlin.math.max
internal class KotlinGradleBuildServices private constructor(
private val gradle: Gradle
@@ -132,7 +133,7 @@ internal class KotlinGradleBuildServices private constructor(
}
private fun getGcCount(): Long =
ManagementFactory.getGarbageCollectorMXBeans().sumByLong { Math.max(0, it.collectionCount) }
ManagementFactory.getGarbageCollectorMXBeans().sumByLong { max(0, it.collectionCount) }
private var loadedInProjectPath: String? = null
@@ -6,6 +6,7 @@ import com.google.gson.stream.JsonWriter
import com.google.gson.stream.MalformedJsonException
import org.slf4j.LoggerFactory
import java.io.*
import kotlin.math.min
open class RewriteSourceMapFilterReader(
val input: Reader
@@ -175,7 +176,7 @@ open class RewriteSourceMapFilterReader(
}
}
val toRead = Math.min(todo, bufferAvailable)
val toRead = min(todo, bufferAvailable)
buffer.getChars(bufferReadPos, bufferReadPos + toRead, dest, destOffset)
bufferReadPos += toRead
destOffset += toRead
@@ -201,7 +202,7 @@ open class RewriteSourceMapFilterReader(
}
}
val toRead = Math.min(todo, bufferAvailable)
val toRead = min(todo, bufferAvailable)
bufferReadPos += toRead
todo -= toRead
}
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.kotlinp
import java.io.File
import java.io.IOException
import kotlin.system.exitProcess
object Main {
private fun run(args: Array<String>) {
@@ -60,7 +61,7 @@ object Main {
run(args)
} catch (e: KotlinpException) {
System.err.println("error: " + e.message)
System.exit(1)
exitProcess(1)
}
}
@@ -75,7 +76,7 @@ where possible options include:
-help (-h) Print a synopsis of options
"""
)
System.exit(0)
exitProcess(0)
}
private fun printVersionAndExit() {
@@ -83,6 +84,6 @@ where possible options include:
val version = "@snapshot@"
println("Kotlin version " + version + " (JRE " + System.getProperty("java.runtime.version") + ")")
System.exit(0)
exitProcess(0)
}
}