From e319493e81c784b4b9b1257d1b1b8fef949b54ca Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 22 Dec 2019 22:16:51 +0000 Subject: [PATCH] Convert PrefixRemapper to Kotlin --- .../openrs2/deob/remap/PrefixRemapper.java | 26 ------------------- .../dev/openrs2/deob/remap/PrefixRemapper.kt | 22 ++++++++++++++++ 2 files changed, 22 insertions(+), 26 deletions(-) delete mode 100644 deob/src/main/java/dev/openrs2/deob/remap/PrefixRemapper.java create mode 100644 deob/src/main/java/dev/openrs2/deob/remap/PrefixRemapper.kt diff --git a/deob/src/main/java/dev/openrs2/deob/remap/PrefixRemapper.java b/deob/src/main/java/dev/openrs2/deob/remap/PrefixRemapper.java deleted file mode 100644 index 40bde661..00000000 --- a/deob/src/main/java/dev/openrs2/deob/remap/PrefixRemapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package dev.openrs2.deob.remap; - -import java.util.HashMap; - -import dev.openrs2.asm.classpath.Library; -import org.objectweb.asm.commons.Remapper; -import org.objectweb.asm.commons.SimpleRemapper; - -public final class PrefixRemapper { - public static Remapper create(Library library, String prefix) { - var mapping = new HashMap(); - for (var clazz : library) { - if (TypedRemapper.EXCLUDED_CLASSES.contains(clazz.name)) { - mapping.put(clazz.name, clazz.name); - } else { - mapping.put(clazz.name, prefix + clazz.name); - } - } - - return new SimpleRemapper(mapping); - } - - private PrefixRemapper() { - /* empty */ - } -} diff --git a/deob/src/main/java/dev/openrs2/deob/remap/PrefixRemapper.kt b/deob/src/main/java/dev/openrs2/deob/remap/PrefixRemapper.kt new file mode 100644 index 00000000..a6d8978e --- /dev/null +++ b/deob/src/main/java/dev/openrs2/deob/remap/PrefixRemapper.kt @@ -0,0 +1,22 @@ +package dev.openrs2.deob.remap + +import dev.openrs2.asm.classpath.Library +import org.objectweb.asm.commons.Remapper +import org.objectweb.asm.commons.SimpleRemapper + +object PrefixRemapper { + @JvmStatic + fun create(library: Library, prefix: String): Remapper { + val mapping = mutableMapOf() + + for (clazz in library) { + if (TypedRemapper.EXCLUDED_CLASSES.contains(clazz.name)) { + mapping[clazz.name] = clazz.name + } else { + mapping[clazz.name] = prefix + clazz.name + } + } + + return SimpleRemapper(mapping) + } +}