From 34ef4f9a5ed101695ff44f9da064ef959dc04aa8 Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 29 Feb 2020 14:14:25 +0000 Subject: [PATCH] Rename ClassForNameRemapper to ClassForNameUtils A future commit will add functionality beyond remapping. --- .../ClassForNameRemapper.kt => ClassForNameUtils.kt} | 10 ++++------ asm/src/main/java/dev/openrs2/asm/classpath/Library.kt | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) rename asm/src/main/java/dev/openrs2/asm/{remap/ClassForNameRemapper.kt => ClassForNameUtils.kt} (78%) diff --git a/asm/src/main/java/dev/openrs2/asm/remap/ClassForNameRemapper.kt b/asm/src/main/java/dev/openrs2/asm/ClassForNameUtils.kt similarity index 78% rename from asm/src/main/java/dev/openrs2/asm/remap/ClassForNameRemapper.kt rename to asm/src/main/java/dev/openrs2/asm/ClassForNameUtils.kt index 64e7507d..c1d44322 100644 --- a/asm/src/main/java/dev/openrs2/asm/remap/ClassForNameRemapper.kt +++ b/asm/src/main/java/dev/openrs2/asm/ClassForNameUtils.kt @@ -1,15 +1,12 @@ -package dev.openrs2.asm.remap +package dev.openrs2.asm -import dev.openrs2.asm.InsnMatcher -import dev.openrs2.asm.toBinaryClassName -import dev.openrs2.asm.toInternalClassName import org.objectweb.asm.commons.Remapper import org.objectweb.asm.tree.AbstractInsnNode import org.objectweb.asm.tree.LdcInsnNode import org.objectweb.asm.tree.MethodInsnNode import org.objectweb.asm.tree.MethodNode -object ClassForNameRemapper { +object ClassForNameUtils { private val INVOKE_MATCHER = InsnMatcher.compile("LDC INVOKESTATIC") private fun isClassForName(match: List): Boolean { @@ -25,7 +22,8 @@ object ClassForNameRemapper { } fun remap(remapper: Remapper, method: MethodNode) { - for (match in INVOKE_MATCHER.match(method).filter(ClassForNameRemapper::isClassForName)) { + for (match in INVOKE_MATCHER.match(method).filter( + ClassForNameUtils::isClassForName)) { val ldc = match[0] as LdcInsnNode val name = remapper.map((ldc.cst as String).toInternalClassName()) if (name != null) { diff --git a/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt b/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt index 6405fbe3..316b1fdb 100644 --- a/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt +++ b/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt @@ -2,7 +2,7 @@ package dev.openrs2.asm.classpath import com.github.michaelbull.logging.InlineLogger import dev.openrs2.asm.hasCode -import dev.openrs2.asm.remap.ClassForNameRemapper +import dev.openrs2.asm.ClassForNameUtils import dev.openrs2.common.crypto.Pkcs12KeyStore import dev.openrs2.common.io.DeterministicJarOutputStream import dev.openrs2.common.io.SkipOutputStream @@ -64,7 +64,7 @@ class Library constructor() : Iterable { for (clazz in classes.values) { for (method in clazz.methods) { if (method.hasCode()) { - ClassForNameRemapper.remap(remapper, method) + ClassForNameUtils.remap(remapper, method) } }