Skip to content

Commit

Permalink
fix!: check for two methods parameters orders (#183)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This requires changes to `MethodFingerprint`
  • Loading branch information
LisoUseInAIKyrios authored and oSumAtrIX committed Jun 7, 2023
1 parent 8f1c835 commit b6d6a75
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,15 @@ private fun replaceOffset(
*/
internal fun Method.cloneMutable(registerCount: Int = 0) = clone(registerCount).toMutable()

// FIXME: also check the order of parameters as different order equals different method overload
internal fun parametersEqual(
parameters1: Iterable<CharSequence>, parameters2: Iterable<CharSequence>
): Boolean {
return parameters1.count() == parameters2.count() && parameters1.all { parameter ->
parameters2.any {
it.startsWith(
parameter
)
}
if (parameters1.count() != parameters2.count()) return false
val iterator1 = parameters1.iterator()
parameters2.forEach {
if (!it.startsWith(iterator1.next())) return false
}
return true
}

internal val nullOutputStream = object : OutputStream() {
Expand Down

0 comments on commit b6d6a75

Please sign in to comment.