Remove invalid/add missing Export annotations

This commit is contained in:
Lucas
2019-06-27 00:20:27 +02:00
parent 0c89cab9cb
commit 971549db3a
227 changed files with 215 additions and 1557 deletions

View File

@@ -154,7 +154,7 @@ public class Deob
public static boolean isObfuscated(String name)
{
return name.length() <= OBFUSCATED_NAME_MAX_LEN || name.startsWith("method") || name.startsWith("vmethod") || name.startsWith("field") || name.startsWith("class");
return name.length() <= OBFUSCATED_NAME_MAX_LEN || name.startsWith("method") || name.startsWith("vmethod") || name.startsWith("field") || name.startsWith("class") || name.startsWith("__");
}
private static void runMath(ClassGroup group)

View File

@@ -0,0 +1,75 @@
package net.runelite.deob.updater;
import java.io.File;
import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations;
import net.runelite.deob.Deob;
import net.runelite.deob.DeobAnnotations;
import net.runelite.deob.DeobTestProperties;
import net.runelite.deob.util.JarUtil;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AnnotationCleaner
{
private final Logger log = LoggerFactory.getLogger(AnnotationCleaner.class);
@Rule
public DeobTestProperties properties = new DeobTestProperties();
@Test
public void checkMappings() throws Exception
{
File client = new File(properties.getRsClient());
ClassGroup group = JarUtil.loadJar(client);
for (ClassFile c : group.getClasses())
{
if (c.getName().contains("runelite"))
{
continue;
}
log.debug("Checking {}", c.toString());
for (Field f : c.getFields())
{
Annotations an = f.getAnnotations();
String fieldName = f.getName();
String exportedName = DeobAnnotations.getExportedName(an);
if (exportedName == null)
{
assertTrue("Field " + fieldName + " isn't obfuscated but doesn't have @Export.", Deob.isObfuscated(fieldName) || fieldName.contains("$"));
continue;
}
assertEquals("Field " + fieldName + " has " + exportedName + " in @Export", fieldName, exportedName);
}
for (Method m : c.getMethods())
{
Annotations an = m.getAnnotations();
String fieldName = m.getName();
String exportedName = DeobAnnotations.getExportedName(an);
if (exportedName == null)
{
assertTrue("Method " + fieldName + " isn't obfuscated but doesn't have @Export.", Deob.isObfuscated(fieldName) || fieldName.endsWith("init>") || fieldName.equals("values") || fieldName.equals("valueOf") || fieldName.startsWith("compareTo") || fieldName.equals("equals") || fieldName.equals("hashCode") || fieldName.equals("compare"));
continue;
}
assertEquals("Method " + fieldName + " has " + exportedName + " in @Export", fieldName, exportedName);
}
}
}
}

View File

@@ -1,3 +1,3 @@
rs.client=${net.runelite.rs:rs-client:jar}
rs.version=180
rs.version=${rs.version}
vanilla.client=${net.runelite.rs:vanilla:jar}