Don't rename classes containing native methods

Signed-off-by: Major <major@emulate.rs>
master
Major 5 years ago
parent f04f4f9685
commit 9a1599880b
  1. 16
      deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt

@ -109,7 +109,7 @@ class TypedRemapper private constructor(
clazz: ClassMetadata clazz: ClassMetadata
): String { ): String {
val name = clazz.name val name = clazz.name
if (mapping.containsKey(name) || name in EXCLUDED_CLASSES || clazz.dependency) { if (mapping.containsKey(name) || !isClassRenamable(clazz)) {
return mapping.getOrDefault(name, name) return mapping.getOrDefault(name, name)
} }
@ -190,6 +190,20 @@ class TypedRemapper private constructor(
return mapping return mapping
} }
private fun isClassRenamable(clazz: ClassMetadata): Boolean {
if (clazz.name in EXCLUDED_CLASSES || clazz.dependency) {
return false
}
for (method in clazz.methods) {
if (clazz.getAccess(method)!! and Opcodes.ACC_NATIVE != 0) {
return false
}
}
return true
}
fun isMethodImmutable(classPath: ClassPath, partition: DisjointSet.Partition<MemberRef>): Boolean { fun isMethodImmutable(classPath: ClassPath, partition: DisjointSet.Partition<MemberRef>): Boolean {
for (method in partition) { for (method in partition) {
val clazz = classPath[method.owner]!! val clazz = classPath[method.owner]!!

Loading…
Cancel
Save