Fix KT-26455 and KT-26443. (#1970)

This commit is contained in:
Nikolay Igotti
2018-08-30 17:09:06 +03:00
committed by GitHub
parent 71405c34fa
commit fb1be9b969
2 changed files with 9 additions and 2 deletions
@@ -18,4 +18,5 @@ public annotation class Volatile
public annotation class Synchronized
@kotlin.internal.InlineOnly
public actual inline fun <R> synchronized(@Suppress("UNUSED_PARAMETER") lock: Any, block: () -> R): R = block()
public actual inline fun <R> synchronized(@Suppress("UNUSED_PARAMETER") lock: Any, block: () -> R): R =
throw UnsupportedOperationException("synchronized() is unsupported")
@@ -68,7 +68,13 @@ internal fun ThrowFreezingException(toFreeze: Any, blocker: Any): Nothing =
throw FreezingException(toFreeze, blocker)
@ExportForCppRuntime
internal fun ThrowInvalidMutabilityException(where: Any): Nothing = throw InvalidMutabilityException(where)
internal fun ThrowInvalidMutabilityException(where: Any): Nothing {
val kClass = where::class
val className = kClass.qualifiedName ?: kClass.simpleName ?: "<object>"
val unsignedHashCode = where.hashCode().toLong() and 0xffffffffL
val hashCodeStr = unsignedHashCode.toString(16)
throw InvalidMutabilityException("$className@$hashCodeStr")
}
@SymbolName("Kotlin_AtomicReference_checkIfFrozen")
external internal fun checkIfFrozen(ref: Any?)