From 49beec9fc6eee6ccf52a6185761a200a6ed2b16e Mon Sep 17 00:00:00 2001 From: Lucaskyy Date: Wed, 23 Mar 2022 20:00:35 +0100 Subject: [PATCH] refactor: Optimize Signature class (#11) BREAKING CHANGE: Array was changed to IntArray. This breaks existing patches. --- src/main/kotlin/app/revanced/patcher/resolver/MethodResolver.kt | 2 +- src/main/kotlin/app/revanced/patcher/signature/Signature.kt | 2 +- src/test/kotlin/app/revanced/patcher/PatcherTest.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/resolver/MethodResolver.kt b/src/main/kotlin/app/revanced/patcher/resolver/MethodResolver.kt index 31f21b5..c27a3fd 100644 --- a/src/main/kotlin/app/revanced/patcher/resolver/MethodResolver.kt +++ b/src/main/kotlin/app/revanced/patcher/resolver/MethodResolver.kt @@ -131,7 +131,7 @@ private operator fun ClassNode.component2(): List { return this.methods } -private fun InsnList.scanFor(pattern: Array): ScanResult { +private fun InsnList.scanFor(pattern: IntArray): ScanResult { for (i in 0 until this.size()) { var occurrence = 0 while (i + occurrence < this.size()) { diff --git a/src/main/kotlin/app/revanced/patcher/signature/Signature.kt b/src/main/kotlin/app/revanced/patcher/signature/Signature.kt index 885f771..19f303d 100644 --- a/src/main/kotlin/app/revanced/patcher/signature/Signature.kt +++ b/src/main/kotlin/app/revanced/patcher/signature/Signature.kt @@ -23,5 +23,5 @@ data class Signature( val returns: Type?, val accessors: Int?, val parameters: Array?, - val opcodes: Array? + val opcodes: IntArray? ) \ No newline at end of file diff --git a/src/test/kotlin/app/revanced/patcher/PatcherTest.kt b/src/test/kotlin/app/revanced/patcher/PatcherTest.kt index db8b2ae..0c146bd 100644 --- a/src/test/kotlin/app/revanced/patcher/PatcherTest.kt +++ b/src/test/kotlin/app/revanced/patcher/PatcherTest.kt @@ -38,7 +38,7 @@ internal class PatcherTest { Type.VOID_TYPE, ACC_PUBLIC or ACC_STATIC, arrayOf(ExtraTypes.ArrayAny), - arrayOf( + intArrayOf( LDC, INVOKEVIRTUAL )