chore: merge branch dev to main (#177)

This commit is contained in:
oSumAtrIX 2023-05-24 01:56:40 +02:00 committed by GitHub
commit a188c16a99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 29 deletions

View file

@ -1,3 +1,13 @@
# [9.0.0-dev.1](https://github.com/revanced/revanced-patcher/compare/v8.0.0...v9.0.0-dev.1) (2023-05-23)
* refactor!: rename parameter ([526a3d7](https://github.com/revanced/revanced-patcher/commit/526a3d7c359e2d95d26756da0f88d5ce975f5d9b))
### BREAKING CHANGES
* This changes named parameters.
# [8.0.0](https://github.com/revanced/revanced-patcher/compare/v7.1.1...v8.0.0) (2023-05-13) # [8.0.0](https://github.com/revanced/revanced-patcher/compare/v7.1.1...v8.0.0) (2023-05-13)

View file

@ -1,2 +1,2 @@
kotlin.code.style = official kotlin.code.style = official
version = 8.0.0 version = 9.0.0-dev.1

View file

@ -15,10 +15,13 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.StringReference import org.jf.dexlib2.iface.reference.StringReference
import org.jf.dexlib2.util.MethodUtil import org.jf.dexlib2.util.MethodUtil
private typealias StringMatch = MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult.StringMatch
private typealias StringsScanResult = MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult
/** /**
* Represents the [MethodFingerprint] for a method. * Represents the [MethodFingerprint] for a method.
* @param returnType The return type of the method. * @param returnType The return type of the method.
* @param access The access flags of the method. * @param accessFlags The access flags of the method.
* @param parameters The parameters of the method. * @param parameters The parameters of the method.
* @param opcodes The list of opcodes of the method. * @param opcodes The list of opcodes of the method.
* @param strings A list of strings which a method contains. * @param strings A list of strings which a method contains.
@ -27,14 +30,14 @@ import org.jf.dexlib2.util.MethodUtil
*/ */
abstract class MethodFingerprint( abstract class MethodFingerprint(
internal val returnType: String? = null, internal val returnType: String? = null,
internal val access: Int? = null, internal val accessFlags: Int? = null,
internal val parameters: Iterable<String>? = null, internal val parameters: Iterable<String>? = null,
internal val opcodes: Iterable<Opcode?>? = null, internal val opcodes: Iterable<Opcode?>? = null,
internal val strings: Iterable<String>? = null, internal val strings: Iterable<String>? = null,
internal val customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null internal val customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null
) : Fingerprint { ) : Fingerprint {
/** /**
* The result of the [MethodFingerprint] the [Method]. * The result of the [MethodFingerprint].
*/ */
var result: MethodFingerprintResult? = null var result: MethodFingerprintResult? = null
@ -83,7 +86,7 @@ abstract class MethodFingerprint(
if (methodFingerprint.returnType != null && !method.returnType.startsWith(methodFingerprint.returnType)) if (methodFingerprint.returnType != null && !method.returnType.startsWith(methodFingerprint.returnType))
return false return false
if (methodFingerprint.access != null && methodFingerprint.access != method.accessFlags) if (methodFingerprint.accessFlags != null && methodFingerprint.accessFlags != method.accessFlags)
return false return false
@ -216,9 +219,6 @@ abstract class MethodFingerprint(
} }
} }
private typealias StringMatch = MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult.StringMatch
private typealias StringsScanResult = MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult
/** /**
* Represents the result of a [MethodFingerprintResult]. * Represents the result of a [MethodFingerprintResult].
* *
@ -233,6 +233,26 @@ data class MethodFingerprintResult(
val scanResult: MethodFingerprintScanResult, val scanResult: MethodFingerprintScanResult,
internal val context: BytecodeContext internal val context: BytecodeContext
) { ) {
/**
* Returns a mutable clone of [classDef]
*
* Please note, this method allocates a [ClassProxy].
* Use [classDef] where possible.
*/
@Suppress("MemberVisibilityCanBePrivate")
val mutableClass by lazy { context.proxy(classDef).mutableClass }
/**
* Returns a mutable clone of [method]
*
* Please note, this method allocates a [ClassProxy].
* Use [method] where possible.
*/
val mutableMethod by lazy {
mutableClass.methods.first {
MethodUtil.methodSignaturesMatch(it, this.method)
}
}
/** /**
* The result of scanning on the [MethodFingerprint]. * The result of scanning on the [MethodFingerprint].
@ -282,25 +302,4 @@ data class MethodFingerprintResult(
) )
} }
} }
/**
* Returns a mutable clone of [classDef]
*
* Please note, this method allocates a [ClassProxy].
* Use [classDef] where possible.
*/
@Suppress("MemberVisibilityCanBePrivate")
val mutableClass by lazy { context.proxy(classDef).mutableClass }
/**
* Returns a mutable clone of [method]
*
* Please note, this method allocates a [ClassProxy].
* Use [method] where possible.
*/
val mutableMethod by lazy {
mutableClass.methods.first {
MethodUtil.methodSignaturesMatch(it, this.method)
}
}
} }