INNER CODE UNIT · Kotlin
IScopedHookCallback
NexAlloy/NexAlloy · app/src/main/java/io/github/nexalloy/Helper.kt:21
typealias IScopedHookCallback = ScopedHookParam.(MethodHookParam) -> Unit
typealias IHookCallback = (MethodHookParam) -> Unit
fun <T> Array<T>.atLast(index: Int) = this[this.size - index]
private val proxyRef = WeakHashMap<Any, Any>()
/*
* Bind a proxy to the implement's lifecycle via WeakHashMap.
*
*
* Do not hold a strong reference to `impl` inside the proxy!
* It will create a strong-reference loop and cause memory leaks.
*
* See Implementation note https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/WeakHashMap.html
* */
internal fun <TImpl> TImpl.bindProxy(proxy: Any) {
synchronized(proxyRef) {