Compile regex in verifyMapping() once

Signed-off-by: Graham <gpe@openrs2.dev>
bzip2
Graham 5 years ago
parent 586ffabc57
commit 4f48a59ee3
  1. 3
      deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt

@ -49,6 +49,7 @@ class TypedRemapper private constructor(
"cache" "cache"
) )
private val LIBRARY_PREFIX_REGEX = Regex("^(?:loader|unpackclass)_")
private const val MAX_OBFUSCATED_NAME_LEN = 2 private const val MAX_OBFUSCATED_NAME_LEN = 2
fun create(classPath: ClassPath): TypedRemapper { fun create(classPath: ClassPath): TypedRemapper {
@ -79,7 +80,7 @@ class TypedRemapper private constructor(
} }
private fun verifyMapping(name: String, mappedName: String) { private fun verifyMapping(name: String, mappedName: String) {
val originalName = name.replace("^(?:loader|unpackclass)_".toRegex(), "") val originalName = name.replace(LIBRARY_PREFIX_REGEX, "")
if (originalName.length > MAX_OBFUSCATED_NAME_LEN && originalName != mappedName) { if (originalName.length > MAX_OBFUSCATED_NAME_LEN && originalName != mappedName) {
logger.warn { "Remapping probably unobfuscated name $originalName to $mappedName" } logger.warn { "Remapping probably unobfuscated name $originalName to $mappedName" }
} }

Loading…
Cancel
Save