mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 02:20:14 +08:00
Fix LateinitMutableProperty
: ensure visibility
This commit is contained in:
parent
c19265b954
commit
482b62c0c3
@ -36,9 +36,12 @@ private class LateinitMutableProperty<T>(
|
|||||||
val initializer = initializer
|
val initializer = initializer
|
||||||
if (initializer != null && this.value.value === UNINITIALIZED) {
|
if (initializer != null && this.value.value === UNINITIALIZED) {
|
||||||
val value = initializer()
|
val value = initializer()
|
||||||
this.value.compareAndSet(UNINITIALIZED, value) // setValue prevails
|
|
||||||
this.initializer = null
|
this.initializer = null
|
||||||
value
|
this.value.compareAndSet(UNINITIALIZED, value) // setValue prevails
|
||||||
|
this.value.value.let {
|
||||||
|
assert(it !== UNINITIALIZED)
|
||||||
|
return it as T
|
||||||
|
}
|
||||||
} else this.value.value as T
|
} else this.value.value as T
|
||||||
}
|
}
|
||||||
else -> v as T
|
else -> v as T
|
||||||
|
Loading…
Reference in New Issue
Block a user