Rename ClassForNameRemapper to ClassForNameUtils

A future commit will add functionality beyond remapping.
master
Graham 5 years ago
parent cad451d3e1
commit 34ef4f9a5e
  1. 10
      asm/src/main/java/dev/openrs2/asm/ClassForNameUtils.kt
  2. 4
      asm/src/main/java/dev/openrs2/asm/classpath/Library.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<AbstractInsnNode>): 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) {

@ -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<ClassNode> {
for (clazz in classes.values) {
for (method in clazz.methods) {
if (method.hasCode()) {
ClassForNameRemapper.remap(remapper, method)
ClassForNameUtils.remap(remapper, method)
}
}

Loading…
Cancel
Save