Fix warnings in compiler code and tests

This commit is contained in:
Alexander Udalov
2020-11-06 20:27:48 +01:00
committed by Alexander Udalov
parent ebfbc2f601
commit d9efc2d922
9 changed files with 30 additions and 23 deletions
@@ -118,7 +118,9 @@ abstract class AbstractLocalVariableTest : AbstractDebugTest() {
}
}
@Suppress("UNCHECKED_CAST")
val compressedLog = compressRunsWithoutLinenumber(loggedItems as List<LVTStep>, LVTStep::location)
val actualLocalVariables = compressedLog.joinToString("\n") {
"// ${it.location.formatAsExpectation()}: ${it.visibleVars.joinToString(", ")}".trim()
}
@@ -56,6 +56,7 @@ abstract class AbstractSteppingTest : AbstractDebugTest() {
val lines = wholeFile.readLines()
val forceStepInto = lines.any { it.startsWith(FORCE_STEP_INTO_MARKER) }
@Suppress("UNCHECKED_CAST")
val actualLineNumbers = compressRunsWithoutLinenumber(loggedItems as List<LocatableEvent>, LocatableEvent::location)
.filter {
val location = it.location()
@@ -98,4 +99,3 @@ abstract class AbstractSteppingTest : AbstractDebugTest() {
assertEqualsToFile(wholeFile, actual.joinToString("\n"))
}
}
@@ -3,13 +3,13 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE")
package org.jetbrains.kotlin.fir
import org.jetbrains.kotlin.daemon.common.threadCpuTime
import org.jetbrains.kotlin.daemon.common.threadUserTime
import sun.management.ManagementFactoryHelper
data class GCInfo(val name: String, val gcTime: Long, val collections: Long) {
operator fun minus(other: GCInfo): GCInfo {
return this.copy(
@@ -36,6 +36,7 @@ data class VMCounters(val userTime: Long, val cpuTime: Long, val gcInfo: Map<Str
private fun <K, V> merge(first: Map<K, V>, second: Map<K, V>, valueOp: (V, V) -> V): Map<K, V> {
val result = first.toMutableMap()
for ((k, v) in second) {
@Suppress("NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER") // KT-43225
result.merge(k, v, valueOp)
}
return result
@@ -55,4 +56,4 @@ fun vmStateSnapshot(): VMCounters {
threadMXBean.threadUserTime(), threadMXBean.threadCpuTime(),
ManagementFactoryHelper.getGarbageCollectorMXBeans().associate { it.name to GCInfo(it.name, it.collectionTime, it.collectionCount) }
)
}
}