Simplify InvokeSpecialTransformer

We only need to check for the ACC_FINAL flag once at the start of
transformCode(), given the insn.owner == clazz.name condition. This
change also removes the redundant getNode() call - we already have a
reference to the ClassNode.

Signed-off-by: Graham <gpe@openrs2.dev>
pull/102/head
Graham 4 years ago
parent 7d985217ab
commit f14fb762df
  1. 9
      deob/src/main/java/dev/openrs2/deob/transform/InvokeSpecialTransformer.kt

@ -22,6 +22,10 @@ class InvokeSpecialTransformer : Transformer() {
}
override fun transformCode(classPath: ClassPath, library: Library, clazz: ClassNode, method: MethodNode): Boolean {
if ((clazz.access and Opcodes.ACC_FINAL) == 0) {
return false
}
for (insn in method.instructions) {
if (insn !is MethodInsnNode || insn.opcode != Opcodes.INVOKESPECIAL) {
continue
@ -31,11 +35,6 @@ class InvokeSpecialTransformer : Transformer() {
continue
}
val owner = classPath.getNode(insn.owner)!!
if ((owner.access and Opcodes.ACC_FINAL) == 0) {
continue
}
insn.opcode = Opcodes.INVOKEVIRTUAL
invokeSpecialsReplaced++
}

Loading…
Cancel
Save