From 085a3a479d7bd411dcb0492b283daca538c824a1 Mon Sep 17 00:00:00 2001 From: d4rkk3y <43563783+d4rkk3y@users.noreply.github.com> Date: Wed, 14 Sep 2022 23:34:58 +0700 Subject: [PATCH] fix: compare any methods parameters (#101) --- .../app/revanced/patcher/extensions/Extensions.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt index 8818556..9f1b8e2 100644 --- a/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt +++ b/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt @@ -16,7 +16,6 @@ import org.jf.dexlib2.iface.instruction.Instruction import org.jf.dexlib2.iface.reference.MethodReference import org.jf.dexlib2.immutable.ImmutableMethod import org.jf.dexlib2.immutable.ImmutableMethodImplementation -import org.jf.dexlib2.util.MethodUtil import java.io.OutputStream infix fun AccessFlags.or(other: AccessFlags) = this.value or other.value @@ -47,16 +46,14 @@ fun MutableMethodImplementation.removeInstructions(index: Int, count: Int) { } /** - * Compare a method to another, considering constructors and parameters. + * Compare a method to another, considering name and parameters. * @param otherMethod The method to compare against. * @return True if the methods match given the conditions. */ fun Method.softCompareTo(otherMethod: MethodReference): Boolean { - if (MethodUtil.isConstructor(this) && !parametersEqual( - this.parameterTypes, otherMethod.parameterTypes - ) - ) return false - return this.name == otherMethod.name + return this.name == otherMethod.name && parametersEqual( + this.parameterTypes, otherMethod.parameterTypes + ) } /**