Fix warnings in build-common/daemon code

This commit is contained in:
Alexander Udalov
2020-08-14 12:23:12 +02:00
parent 1d15a5547d
commit 425b192a5f
29 changed files with 102 additions and 91 deletions
@@ -105,6 +105,7 @@ interface CompileService : Remote {
// TODO: consider adding async version of shutdown and release
@Suppress("DEPRECATION")
@Deprecated("The usages should be replaced with `compile` method", ReplaceWith("compile"))
@Throws(RemoteException::class)
fun remoteCompile(
@@ -118,6 +119,7 @@ interface CompileService : Remote {
operationsTracer: RemoteOperationsTracer?
): CallResult<Int>
@Suppress("DEPRECATION")
@Deprecated("The usages should be replaced with `compile` method", ReplaceWith("compile"))
@Throws(RemoteException::class)
fun remoteIncrementalCompile(
@@ -149,6 +151,7 @@ interface CompileService : Remote {
@Throws(RemoteException::class)
fun clearJarCache()
@Suppress("DEPRECATION")
@Deprecated("The usages should be replaced with other `leaseReplSession` method", ReplaceWith("leaseReplSession"))
@Throws(RemoteException::class)
fun leaseReplSession(
@@ -23,6 +23,7 @@ class CompileServiceClientRMIWrapper(
private fun reportNotImplemented(): Nothing = throw IllegalStateException("Unexpected call to deprecated method")
// deprecated methods :
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
override fun remoteCompile(
sessionId: Int,
targetPlatform: CompileService.TargetPlatform,
@@ -36,6 +37,7 @@ class CompileServiceClientRMIWrapper(
reportNotImplemented()
}
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
override fun remoteIncrementalCompile(
sessionId: Int,
targetPlatform: CompileService.TargetPlatform,
@@ -49,6 +51,7 @@ class CompileServiceClientRMIWrapper(
reportNotImplemented()
}
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
override fun leaseReplSession(
aliveFlagPath: String?,
targetPlatform: CompileService.TargetPlatform,
@@ -66,10 +69,12 @@ class CompileServiceClientRMIWrapper(
reportNotImplemented()
}
@Suppress("OverridingDeprecatedMember")
override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine): CompileService.CallResult<ReplCheckResult> {
reportNotImplemented()
}
@Suppress("OverridingDeprecatedMember")
override fun remoteReplLineCompile(
sessionId: Int,
codeLine: ReplCodeLine,
@@ -78,6 +83,7 @@ class CompileServiceClientRMIWrapper(
reportNotImplemented()
}
@Suppress("OverridingDeprecatedMember")
override fun remoteReplLineEval(
sessionId: Int,
codeLine: ReplCodeLine,
@@ -329,7 +329,7 @@ fun configureDaemonJVMOptions(vararg additionalParams: String,
inheritAdditionalProperties: Boolean
): DaemonJVMOptions =
configureDaemonJVMOptions(DaemonJVMOptions(),
additionalParams = *additionalParams,
additionalParams = additionalParams,
inheritMemoryLimits = inheritMemoryLimits,
inheritOtherJvmOptions = inheritOtherJvmOptions,
inheritAdditionalProperties = inheritAdditionalProperties)
@@ -16,4 +16,5 @@
package org.jetbrains.kotlin.daemon.common
interface JpsCompilerServicesFacade : CompilerServicesFacadeBase, CompilerCallbackServicesFacade
@Suppress("DEPRECATION")
interface JpsCompilerServicesFacade : CompilerServicesFacadeBase, CompilerCallbackServicesFacade
@@ -14,6 +14,8 @@
* limitations under the License.
*/
@file:Suppress("NOTHING_TO_INLINE")
package org.jetbrains.kotlin.daemon.common
import java.lang.management.ManagementFactory
@@ -101,7 +103,7 @@ inline fun endMeasureWallTime(perfCounters: PerfCounters, startState: List<Long>
}
inline fun beginMeasureWallAndThreadTimes(perfCounters: PerfCounters, threadMXBean: ThreadMXBean): List<Long> {
inline fun beginMeasureWallAndThreadTimes(threadMXBean: ThreadMXBean): List<Long> {
val startTime = System.nanoTime()
val startThreadTime = threadMXBean.threadCpuTime()
val startThreadUserTime = threadMXBean.threadUserTime()
@@ -117,12 +119,7 @@ inline fun endMeasureWallAndThreadTimes(perfCounters: PerfCounters, threadMXBean
threadUser = threadMXBean.threadUserTime() - startThreadUserTime)
}
inline fun beginMeasureWallAndThreadTimes(perfCounters: PerfCounters) =
beginMeasureWallAndThreadTimes(perfCounters, ManagementFactory.getThreadMXBean())
inline fun endMeasureWallAndThreadTimes(perfCounters: PerfCounters, startState: List<Long>) =
endMeasureWallAndThreadTimes(perfCounters, ManagementFactory.getThreadMXBean(), startState)
inline fun beginMeasureWallAndThreadTimesAndMemory(perfCounters: PerfCounters, withGC: Boolean = false, threadMXBean: ThreadMXBean): List<Long> {
inline fun beginMeasureWallAndThreadTimesAndMemory(withGC: Boolean = false, threadMXBean: ThreadMXBean): List<Long> {
val startMem = usedMemory(withGC)
val startTime = System.nanoTime()
val startThreadTime = threadMXBean.threadCpuTime()
@@ -141,13 +138,6 @@ inline fun endMeasureWallAndThreadTimesAndMemory(perfCounters: PerfCounters, wit
memory = usedMemory(withGC) - startMem)
}
inline fun<R> beginMeasureWallAndThreadTimesAndMemory(perfCounters: PerfCounters, withGC: Boolean) =
beginMeasureWallAndThreadTimesAndMemory(perfCounters, withGC, ManagementFactory.getThreadMXBean())
inline fun<R> endMeasureWallAndThreadTimesAndMemory(perfCounters: PerfCounters, withGC: Boolean, startState: List<Long>) =
endMeasureWallAndThreadTimesAndMemory(perfCounters, withGC, ManagementFactory.getThreadMXBean(), startState)
class DummyProfiler : Profiler {
override fun getCounters(): Map<Any?, PerfCounters> = mapOf(null to SimplePerfCounters())
override fun getTotalCounters(): PerfCounters = SimplePerfCounters()
@@ -174,7 +164,7 @@ class WallTotalProfiler : TotalProfiler() {
class WallAndThreadTotalProfiler : TotalProfiler() {
@Suppress("OVERRIDE_BY_INLINE")
override inline fun beginMeasure(obj: Any?) = beginMeasureWallAndThreadTimes(total, threadMXBean)
override inline fun beginMeasure(obj: Any?) = beginMeasureWallAndThreadTimes(threadMXBean)
@Suppress("OVERRIDE_BY_INLINE")
override inline fun endMeasure(obj: Any?, startState: List<Long>) = endMeasureWallAndThreadTimes(total, threadMXBean, startState)
}
@@ -183,7 +173,7 @@ class WallAndThreadTotalProfiler : TotalProfiler() {
class WallAndThreadAndMemoryTotalProfiler(val withGC: Boolean) : TotalProfiler() {
@Suppress("OVERRIDE_BY_INLINE")
override inline fun beginMeasure(obj: Any?) =
beginMeasureWallAndThreadTimesAndMemory(total, withGC, threadMXBean)
beginMeasureWallAndThreadTimesAndMemory(withGC, threadMXBean)
@Suppress("OVERRIDE_BY_INLINE")
override inline fun endMeasure(obj: Any?, startState: List<Long>) =
endMeasureWallAndThreadTimesAndMemory(total, withGC, threadMXBean, startState)
@@ -198,7 +188,7 @@ class WallAndThreadByClassProfiler() : TotalProfiler() {
@Suppress("OVERRIDE_BY_INLINE")
override inline fun beginMeasure(obj: Any?) =
beginMeasureWallAndThreadTimes(counters.getOrPut(obj?.javaClass?.name, { SimplePerfCountersWithTotal(total) }), threadMXBean)
beginMeasureWallAndThreadTimes(threadMXBean)
@Suppress("OVERRIDE_BY_INLINE")
override inline fun endMeasure(obj: Any?, startState: List<Long>) =
endMeasureWallAndThreadTimes(counters.getOrPut(obj?.javaClass?.name, { SimplePerfCountersWithTotal(total) }), threadMXBean, startState)