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

unsafeWeakRef

fun <T> T.unsafeWeakRef(): UnsafeWeakRef<T>

Provides a weak reference to this. The getValue for delegation throws an IllegalStateException if the referent is released by GC. Therefore it returns notnull value only

UNSTABLE API: It is strongly suggested not to use this api