From d20e3997b49561879772216f52c3f6ad892d7f76 Mon Sep 17 00:00:00 2001 From: Graham Date: Fri, 30 Aug 2019 19:57:26 +0100 Subject: [PATCH] Split transformMethod into {pre,post}TransformMethod --- .../java/dev/openrs2/asm/transform/Transformer.java | 10 ++++++++-- .../deob/transform/OriginalNameTransformer.java | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/asm/src/main/java/dev/openrs2/asm/transform/Transformer.java b/asm/src/main/java/dev/openrs2/asm/transform/Transformer.java index 4c7b5d5a..03ca6d46 100644 --- a/asm/src/main/java/dev/openrs2/asm/transform/Transformer.java +++ b/asm/src/main/java/dev/openrs2/asm/transform/Transformer.java @@ -26,11 +26,13 @@ public abstract class Transformer { } for (var method : clazz.methods) { - changed |= transformMethod(classPath, library, clazz, method); + changed |= preTransformMethod(classPath, library, clazz, method); if ((method.access & (Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT)) == 0) { changed |= transformCode(classPath, library, clazz, method); } + + changed |= postTransformMethod(classPath, library, clazz, method); } } } @@ -56,7 +58,7 @@ public abstract class Transformer { return false; } - protected boolean transformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) throws AnalyzerException { + protected boolean preTransformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) throws AnalyzerException { return false; } @@ -64,6 +66,10 @@ public abstract class Transformer { return false; } + protected boolean postTransformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) throws AnalyzerException { + return false; + } + protected void postPass(ClassPath classPath) throws AnalyzerException { /* empty */ } diff --git a/deob/src/main/java/dev/openrs2/deob/transform/OriginalNameTransformer.java b/deob/src/main/java/dev/openrs2/deob/transform/OriginalNameTransformer.java index fc26512b..53dac0b0 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/OriginalNameTransformer.java +++ b/deob/src/main/java/dev/openrs2/deob/transform/OriginalNameTransformer.java @@ -61,7 +61,7 @@ public final class OriginalNameTransformer extends Transformer { @SuppressWarnings("unchecked") @Override - public boolean transformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) { + public boolean preTransformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) { if (method.name.equals("") || method.name.equals("")) { return false; }