From b0dddff7290805b1ec8b591e1ef362d004a8f483 Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 7 Mar 2020 17:23:27 +0000 Subject: [PATCH] Add isFieldRenamable method Signed-off-by: Graham --- .../dev/openrs2/deob/remap/TypedRemapper.kt | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) 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 90ce6c5fb1..c54356740c 100644 --- a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt +++ b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt @@ -139,23 +139,7 @@ class TypedRemapper private constructor( val prefixes = mutableMapOf() for (partition in disjointSet) { - var skip = false - - for ((owner, name) in partition) { - val clazz = classPath[owner]!! - - if (name in EXCLUDED_FIELDS) { - skip = true - break - } - - if (clazz.dependency) { - skip = true - break - } - } - - if (skip) { + if (!isFieldRenamable(classPath, partition)) { continue } @@ -190,6 +174,18 @@ class TypedRemapper private constructor( return mapping } + private fun isFieldRenamable(classPath: ClassPath, partition: DisjointSet.Partition): Boolean { + for (field in partition) { + val clazz = classPath[field.owner]!! + + if (field.name in EXCLUDED_FIELDS || clazz.dependency) { + return false + } + } + + return true + } + private fun isClassRenamable(clazz: ClassMetadata): Boolean { if (clazz.name in EXCLUDED_CLASSES || clazz.dependency) { return false