From 46ab5111e6db91a65c0e70622abd3303597e7618 Mon Sep 17 00:00:00 2001 From: Graham Date: Fri, 30 Aug 2019 19:21:50 +0100 Subject: [PATCH] Add isMethodImmutable method to TypedRemapper I'm going to use this in a new Transformer. --- .../dev/openrs2/deob/remap/TypedRemapper.java | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.java b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.java index 47246a0868..bf70058e4a 100644 --- a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.java +++ b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.java @@ -176,33 +176,32 @@ public final class TypedRemapper extends Remapper { return mapping; } - private static Map createMethodMapping(ClassPath classPath, DisjointSet disjointSet) { - var mapping = new HashMap(); - var id = 0; + public static boolean isMethodImmutable(ClassPath classPath, DisjointSet.Partition partition) { + for (var method : partition) { + var clazz = classPath.get(method.getOwner()); - for (var partition : disjointSet) { - boolean skip = false; + if (EXCLUDED_METHODS.contains(method.getName())) { + return true; + } - for (var method : partition) { - var clazz = classPath.get(method.getOwner()); + if (clazz.isDependency()) { + return true; + } - if (EXCLUDED_METHODS.contains(method.getName())) { - skip = true; - break; - } + if (clazz.isNative(new MemberDesc(method.getName(), method.getDesc()))) { + return true; + } + } - if (clazz.isDependency()) { - skip = true; - break; - } + return false; + } - if (clazz.isNative(new MemberDesc(method.getName(), method.getDesc()))) { - skip = true; - break; - } - } + private static Map createMethodMapping(ClassPath classPath, DisjointSet disjointSet) { + var mapping = new HashMap(); + var id = 0; - if (skip) { + for (var partition : disjointSet) { + if (isMethodImmutable(classPath, partition)) { continue; }