mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2026-01-24 11:41:02 +00:00
refactor: lazy initialize implementation field for mutable methods
This commit is contained in:
@@ -13,7 +13,7 @@ class MutableMethod(method: Method) : Method, BaseMethodReference() {
|
|||||||
private var returnType = method.returnType
|
private var returnType = method.returnType
|
||||||
|
|
||||||
// Create own mutable MethodImplementation (due to not being able to change members like register count)
|
// Create own mutable MethodImplementation (due to not being able to change members like register count)
|
||||||
private var implementation = method.implementation?.let { MutableMethodImplementation(it) }
|
private val _implementation by lazy { method.implementation?.let { MutableMethodImplementation(it) } }
|
||||||
private val _annotations by lazy { method.annotations.map { annotation -> annotation.toMutable() }.toMutableSet() }
|
private val _annotations by lazy { method.annotations.map { annotation -> annotation.toMutable() }.toMutableSet() }
|
||||||
private val _parameters by lazy { method.parameters.map { parameter -> parameter.toMutable() }.toMutableList() }
|
private val _parameters by lazy { method.parameters.map { parameter -> parameter.toMutable() }.toMutableList() }
|
||||||
private val _parameterTypes by lazy { method.parameterTypes.toMutableList() }
|
private val _parameterTypes by lazy { method.parameterTypes.toMutableList() }
|
||||||
@@ -47,7 +47,7 @@ class MutableMethod(method: Method) : Method, BaseMethodReference() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getImplementation(): MutableMethodImplementation? {
|
override fun getImplementation(): MutableMethodImplementation? {
|
||||||
return implementation
|
return _implementation
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
Reference in New Issue
Block a user