From 4f48a59ee31c850a72d56fba9b437ec494cfac8e Mon Sep 17 00:00:00 2001 From: Graham Date: Fri, 10 Apr 2020 22:54:39 +0100 Subject: [PATCH] Compile regex in verifyMapping() once Signed-off-by: Graham --- deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 d7ebd71ae9..33932a7fd0 100644 --- a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt +++ b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt @@ -49,6 +49,7 @@ class TypedRemapper private constructor( "cache" ) + private val LIBRARY_PREFIX_REGEX = Regex("^(?:loader|unpackclass)_") private const val MAX_OBFUSCATED_NAME_LEN = 2 fun create(classPath: ClassPath): TypedRemapper { @@ -79,7 +80,7 @@ class TypedRemapper private constructor( } 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) { logger.warn { "Remapping probably unobfuscated name $originalName to $mappedName" } }