mirai-core / net.mamoe.mirai.utils / UnsafeWeakRef

UnsafeWeakRef

class UnsafeWeakRef<T>

WeakRef that getValue for delegation throws an IllegalStateException if the referent is released by GC. Therefore it returns notnull value only

Constructors

<init>

WeakRef that getValue for delegation throws an IllegalStateException if the referent is released by GC. Therefore it returns notnull value only

UnsafeWeakRef(weakRef: WeakRef<T>)

Functions

clear

fun clear(): Unit

get

fun get(): T

Extension Functions

getValue

Provides delegate value.

operator fun <T> UnsafeWeakRef<T>.getValue(thisRef: Any?, property: KProperty<*>): T