Remove ismappable which has never worked

This commit is contained in:
Adam
2016-03-26 17:22:00 -04:00
parent 41a1ffbae2
commit d7abcdf569
2 changed files with 1 additions and 56 deletions

View File

@@ -25,49 +25,7 @@ import net.runelite.asm.execution.Variables;
import net.runelite.asm.signature.Signature;
public class MappingExecutorUtil
{
// won't work with static funcs etc. this is all wrong. XXX
public static boolean isMappable(Method m1, Method m2)
{
assert (m1.getCode() == null) == (m2.getCode() == null);
if (m1.getCode() == null || m2.getCode() == null)
return false;
List<Instruction> l1 = m1.getCode().getInstructions().getInstructions().stream().filter(i -> i instanceof MappableInstruction).collect(Collectors.toList());
List<Instruction> l2 = m2.getCode().getInstructions().getInstructions().stream().filter(i -> i instanceof MappableInstruction).collect(Collectors.toList());
if (l1.size() != l2.size())
return false;
Map<Class, Integer> map1 = new HashMap<>(),
map2 = new HashMap<>();
for (int i = 0; i < l1.size(); ++i)
{
Instruction i1 = l1.get(i);
Integer c = map1.get(i1.getClass());
if (c == null)
map1.put(i1.getClass(), 1);
else
map1.put(i1.getClass(), c + 1);
}
for (int i = 0; i < l2.size(); ++i)
{
Instruction i2 = l2.get(i);
Integer c = map2.get(i2.getClass());
if (c == null)
map2.put(i2.getClass(), 1);
else
map2.put(i2.getClass(), c + 1);
}
return map1.equals(map2);
}
{
public static ParallelExecutorMapping map(Method m1, Method m2)
{
ClassGroup group1 = m1.getMethods().getClassFile().getGroup();

View File

@@ -5,23 +5,10 @@ import java.io.IOException;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Method;
import net.runelite.deob.util.JarUtil;
import org.junit.Assert;
import org.junit.Test;
public class MapTest
{
@Test
public void testMappable() throws IOException
{
ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar"));
ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar"));
Assert.assertTrue(MappingExecutorUtil.isMappable(
group1.findClass("class99").findMethod("method2220"),
group2.findClass("class99").findMethod("method2149")
));
}
@Test
public void test() throws IOException
{