diff --git a/deob/src/main/java/dev/openrs2/deob/transform/ExceptionTracingTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/ExceptionTracingTransformer.kt index a03a15d7..d1dd15d6 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/ExceptionTracingTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/ExceptionTracingTransformer.kt @@ -9,6 +9,24 @@ import dev.openrs2.asm.transform.Transformer import org.objectweb.asm.tree.ClassNode import org.objectweb.asm.tree.MethodNode +/** + * A [Transformer] responsible for removing two kinds of redundant exception + * handler. + * + * - [ZKM](http://www.zelix.com/klassmaster/)'s + * [exception obfuscation](https://www.zelix.com/klassmaster/featuresExceptionObfuscation.html), + * which inserts exception handlers that catch [RuntimeException]s and + * immediately re-throw them. The exception handlers are inserted in + * locations where there is no Java source code equivalent, confusing + * decompilers. + * + * - Jagex inserts a try/catch block around every method that catches + * [RuntimeException]s, wraps them with a custom [RuntimeException] + * implementation and re-throws them. The wrapped exception's message + * contains the values of the method's arguments. While this is for debugging + * and not obfuscation, it is clearly automatically-generated and thus we + * remove these exception handlers too. + */ class ExceptionTracingTransformer : Transformer() { private var tracingTryCatches = 0