diff --git a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt index 9ee06a347e..90ce6c5fb1 100644 --- a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt +++ b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt @@ -204,25 +204,21 @@ class TypedRemapper private constructor( return true } - fun isMethodImmutable(classPath: ClassPath, partition: DisjointSet.Partition): Boolean { + fun isMethodRenamable(classPath: ClassPath, partition: DisjointSet.Partition): Boolean { for (method in partition) { val clazz = classPath[method.owner]!! - if (method.name in EXCLUDED_METHODS) { - return true - } - - if (clazz.dependency) { - return true + if (method.name in EXCLUDED_METHODS || clazz.dependency) { + return false } val access = clazz.getAccess(MemberDesc(method)) - if (access != null && (access and Opcodes.ACC_NATIVE) != 0) { - return true + if (access != null && access and Opcodes.ACC_NATIVE != 0) { + return false } } - return false + return true } private fun createMethodMapping( @@ -233,7 +229,7 @@ class TypedRemapper private constructor( var id = 0 for (partition in disjointSet) { - if (isMethodImmutable(classPath, partition)) { + if (!isMethodRenamable(classPath, partition)) { continue } diff --git a/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt index aadde4708b..cb32a1d847 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt @@ -69,7 +69,7 @@ class UnusedArgTransformer : Transformer() { } is MethodInsnNode -> { val invokePartition = inheritedMethodSets[MemberRef(insn)] - if (invokePartition == null || TypedRemapper.isMethodImmutable(classPath, invokePartition)) { + if (invokePartition == null || !TypedRemapper.isMethodRenamable(classPath, invokePartition)) { continue@frame } @@ -113,7 +113,7 @@ class UnusedArgTransformer : Transformer() { } val partition = inheritedMethodSets[MemberRef(insn)] - if (partition == null || TypedRemapper.isMethodImmutable(classPath, partition)) { + if (partition == null || !TypedRemapper.isMethodRenamable(classPath, partition)) { continue } @@ -146,7 +146,7 @@ class UnusedArgTransformer : Transformer() { ): Boolean { // delete unused int args from the method itself val partition = inheritedMethodSets[MemberRef(clazz, method)]!! - if (TypedRemapper.isMethodImmutable(classPath, partition)) { + if (!TypedRemapper.isMethodRenamable(classPath, partition)) { return false }