From 28fc6a2dddc214a30a7cd1a6b475b141f605849a Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 22 May 2023 20:31:01 +0200 Subject: [PATCH 1/3] refactor: apply Kotlin idioms --- .../method/impl/MethodFingerprint.kt | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt index 72a8086..a3baa0f 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt @@ -15,6 +15,9 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.reference.StringReference 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. * @param returnType The return type of the method. @@ -34,7 +37,7 @@ abstract class MethodFingerprint( internal val customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null ) : Fingerprint { /** - * The result of the [MethodFingerprint] the [Method]. + * The result of the [MethodFingerprint]. */ var result: MethodFingerprintResult? = null @@ -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]. * @@ -233,6 +233,26 @@ data class MethodFingerprintResult( val scanResult: MethodFingerprintScanResult, 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]. @@ -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) - } - } } \ No newline at end of file From 526a3d7c359e2d95d26756da0f88d5ce975f5d9b Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Wed, 24 May 2023 01:47:46 +0200 Subject: [PATCH 2/3] refactor!: rename parameter BREAKING CHANGE: This changes named parameters. --- .../patcher/fingerprint/method/impl/MethodFingerprint.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt index a3baa0f..f297f95 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt @@ -21,7 +21,7 @@ private typealias StringsScanResult = MethodFingerprintResult.MethodFingerprintS /** * Represents the [MethodFingerprint] for a 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 opcodes The list of opcodes of the method. * @param strings A list of strings which a method contains. @@ -30,7 +30,7 @@ private typealias StringsScanResult = MethodFingerprintResult.MethodFingerprintS */ abstract class MethodFingerprint( internal val returnType: String? = null, - internal val access: Int? = null, + internal val accessFlags: Int? = null, internal val parameters: Iterable? = null, internal val opcodes: Iterable? = null, internal val strings: Iterable? = null, @@ -86,7 +86,7 @@ abstract class MethodFingerprint( if (methodFingerprint.returnType != null && !method.returnType.startsWith(methodFingerprint.returnType)) return false - if (methodFingerprint.access != null && methodFingerprint.access != method.accessFlags) + if (methodFingerprint.accessFlags != null && methodFingerprint.accessFlags != method.accessFlags) return false From 3e6804f06c10c40362a798ee31d2c589678eb509 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 23 May 2023 23:50:12 +0000 Subject: [PATCH 3/3] chore(release): 9.0.0-dev.1 [skip ci] # [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. --- CHANGELOG.md | 10 ++++++++++ gradle.properties | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69b9517..61b04d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/gradle.properties b/gradle.properties index ba277d9..1059ba3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ kotlin.code.style = official -version = 8.0.0 +version = 9.0.0-dev.1