Convert typed Object & Array types to Object types

Commit name is a bit superfluous, but it means that types such as "Ljava/lang/String;" get converted to "Ljava/lang/Object;". This is so we don't need to know the mappings, which are random in YT's code.

This is done in MethodResolver's "convertObject" and "convertObjects" for arrays.

Also changed ExtraTypes.ArrayAny to Object instead of String, that was a mistake. (which caused the test to pass at first)
This commit is contained in:
Lucaskyy
2022-03-19 22:34:41 +01:00
parent f9327a2043
commit e5f9a42ee6
5 changed files with 49 additions and 16 deletions

View File

@@ -4,6 +4,7 @@ import net.revanced.patcher.patch.Patch
import net.revanced.patcher.patch.PatchResultSuccess
import net.revanced.patcher.signature.Signature
import net.revanced.patcher.util.ExtraTypes
import net.revanced.patcher.writer.ASMWriter.testingWow
import org.junit.jupiter.api.Test
import org.objectweb.asm.Opcodes.*
import org.objectweb.asm.Type
@@ -11,12 +12,10 @@ import org.objectweb.asm.Type
internal class PatcherTest {
private val testSigs: Array<Signature> = arrayOf(
Signature(
"testMethod",
"mainMethod",
Type.VOID_TYPE,
ACC_PUBLIC or ACC_STATIC,
arrayOf(
ExtraTypes.ArrayAny,
),
arrayOf(ExtraTypes.ArrayAny),
arrayOf(
GETSTATIC,
LDC,
@@ -32,7 +31,8 @@ internal class PatcherTest {
patcher.addPatches(
Patch ("TestPatch") {
patcher.cache.methods["testMethod"]
val main = patcher.cache.methods["mainMethod"]
//main.method.instructions!!.testingWow()
PatchResultSuccess()
}
)