Fix for KT-6895: Compile error on Android (EXCEPTION FROM SIMULATION) when declaring locals in an inline function
#KT-6895 Fixed
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock
|
||||
import kotlin.concurrent.write
|
||||
|
||||
class UpdateableThing {
|
||||
private val lock = ReentrantReadWriteLock()
|
||||
private var updateCount = 0
|
||||
|
||||
fun performUpdates<T>(block: () -> T): T {
|
||||
lock.write {
|
||||
++updateCount
|
||||
val result = block()
|
||||
--updateCount
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
return UpdateableThing().performUpdates { "OK" }
|
||||
}
|
||||
Reference in New Issue
Block a user