Add isFieldRenamable method

Signed-off-by: Graham <gpe@openrs2.dev>
bzip2
Graham 5 years ago
parent 5c1768e824
commit b0dddff729
  1. 30
      deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt

@ -139,23 +139,7 @@ class TypedRemapper private constructor(
val prefixes = mutableMapOf<String, Int>() val prefixes = mutableMapOf<String, Int>()
for (partition in disjointSet) { for (partition in disjointSet) {
var skip = false if (!isFieldRenamable(classPath, partition)) {
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) {
continue continue
} }
@ -190,6 +174,18 @@ class TypedRemapper private constructor(
return mapping return mapping
} }
private fun isFieldRenamable(classPath: ClassPath, partition: DisjointSet.Partition<MemberRef>): 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 { private fun isClassRenamable(clazz: ClassMetadata): Boolean {
if (clazz.name in EXCLUDED_CLASSES || clazz.dependency) { if (clazz.name in EXCLUDED_CLASSES || clazz.dependency) {
return false return false

Loading…
Cancel
Save