mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2024-11-10 01:02:22 +01:00
feat: add immutableMethod
added docs
This commit is contained in:
parent
8b70bb4290
commit
eed1cfda7b
1 changed files with 18 additions and 1 deletions
|
@ -2,22 +2,39 @@ package app.revanced.patcher.signature
|
|||
|
||||
import app.revanced.patcher.proxy.ClassProxy
|
||||
import app.revanced.patcher.signature.resolver.SignatureResolver
|
||||
import org.jf.dexlib2.iface.Method
|
||||
|
||||
/**
|
||||
* Represents the result of a [SignatureResolver].
|
||||
* @param definingClassProxy The [ClassProxy] that the matching method was found in.
|
||||
* @param resolvedMethodName The name of the actual matching method.
|
||||
* @param scanData OpCodes pattern scan result.
|
||||
* @param scanData Opcodes pattern scan result.
|
||||
*/
|
||||
data class SignatureResolverResult(
|
||||
val definingClassProxy: ClassProxy,
|
||||
val scanData: PatternScanResult,
|
||||
private val resolvedMethodName: String,
|
||||
) {
|
||||
/**
|
||||
* Returns the **mutable** method by the [resolvedMethodName] from the [definingClassProxy].
|
||||
*
|
||||
* Please note, this method creates a [ClassProxy].
|
||||
* Use [immutableMethod] where possible.
|
||||
*/
|
||||
val method get() = definingClassProxy.resolve().methods.first {
|
||||
it.name == resolvedMethodName
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the **immutable** method by the [resolvedMethodName] from the [definingClassProxy].
|
||||
*
|
||||
* If you need to modify the method, use [method] instead.
|
||||
*/
|
||||
val immutableMethod: Method
|
||||
get() = definingClassProxy.immutableClass.methods.first {
|
||||
it.name == resolvedMethodName
|
||||
}
|
||||
|
||||
@Suppress("Unused") // TODO(Sculas): remove this when we have coverage for this method.
|
||||
fun findParentMethod(signature: MethodSignature): SignatureResolverResult? {
|
||||
return SignatureResolver.resolveFromProxy(definingClassProxy, signature)
|
||||
|
|
Loading…
Reference in a new issue