Simplify queueEntryPoints() with isMethodRenamable()

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent 5355abf4a1
commit a5285306c1
  1. 26
      deob/src/main/java/dev/openrs2/deob/transform/ConstantArgTransformer.kt

@ -70,17 +70,23 @@ class ConstantArgTransformer : Transformer() {
private fun queueEntryPoints(classPath: ClassPath) { private fun queueEntryPoints(classPath: ClassPath) {
for (partition in inheritedMethodSets) { for (partition in inheritedMethodSets) {
/* /*
* The EXCLUDED_METHODS set roughly matches up with the methods we * The set of non-renamable methods roughly matches up with the
* want to consider as entry points. It isn't perfect - it counts * methods we want to consider as entry points. It includes methods
* every <init> method as an entry point, but strictly speaking we * which we override, which may be called by the standard library),
* only need to count <init> methods invoked with reflection as * the main() method (called by the JVM), providesignlink() (called
* entry points (like VisibilityTransformer). However, it makes no * with reflection) and <clinit> (called by the JVM).
* difference in this case, as the deobfuscator does not add dummy *
* constant arguments to constructors. * It isn't perfect - it counts every <init> method as an entry
* point, but strictly speaking we only need to count <init>
* methods invoked with reflection as entry points (like
* VisibilityTransformer). However, it makes no difference in this
* case, as the deobfuscator does not add dummy constant arguments
* to constructors.
*
* It also counts native methods as an entry point. This isn't
* problematic as they don't have an InsnList, so we skip them.
*/ */
val excluded = partition.first().name in TypedRemapper.EXCLUDED_METHODS if (!TypedRemapper.isMethodRenamable(classPath, partition)) {
val overridesDependency = partition.any { classPath[it.owner]!!.dependency }
if (excluded || overridesDependency) {
pendingMethods.addAll(partition) pendingMethods.addAll(partition)
} }
} }

Loading…
Cancel
Save