Missed contract in CloseableReferenceCounter.autoClosed

This commit is contained in:
Andrew Golovashevich 2025-08-13 15:54:03 +03:00
parent c1592736da
commit 1a26d61cd2

View File

@ -1,5 +1,7 @@
package ru.landrafhomyak.utility.reference_counter
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
import kotlin.jvm.JvmName
import kotlin.jvm.JvmStatic
@ -13,9 +15,13 @@ public class CloseableReferenceCounter : MayBeClosedReferenceCounter {
}
public companion object {
@Suppress("LEAKED_IN_PLACE_LAMBDA", "WRONG_INVOCATION_KIND")
@JvmStatic
@JvmName("autoClosed")
public fun <R> autoClosed(errMessageClosed: String, errExistRefs: String, scope: (MayBeClosedReferenceCounter) -> R): R {
contract {
callsInPlace(scope, InvocationKind.EXACTLY_ONCE)
}
_Platform.jvm_assertNotNull(errMessageClosed, "param: errMessageClosed")
_Platform.jvm_assertNotNull(errExistRefs, "param: errExistRefs")
_Platform.jvm_assertNotNull(scope, "param: scope")