I guess when I rebuilt the test jar the order of the classes changed, 1->100 not 1->2, which made the class inheritance order inconsistent

This commit is contained in:
Adam
2016-01-17 11:32:14 -05:00
parent 67d8bfed47
commit a82a9ba4b9
2 changed files with 80 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package net.runelite.deob;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.runelite.deob.attributes.Code;
@@ -47,9 +48,32 @@ public class ClassGroup
public void initialize()
{
sort();
buildClassGraph();
lookup();
}
private int classNum(ClassFile cf)
{
if (cf.getName().startsWith("class"))
return Integer.parseInt(cf.getName().substring(5));
return -1;
}
// order of classes affects class graph (eg order of children classes) which affects comparing two classgroups
private void sort()
{
// only sort renamed jars
for (ClassFile c : classes)
if (c.getName().startsWith("class") == false && !c.getName().equals("client"))
return;
Collections.sort(classes, (c1, c2) -> {
int n1 = classNum(c1), n2 = classNum(c2);
return Integer.compare(n1, n2);
});
}
public void buildClassGraph()
{