use of net.runelite.asm.Field in project runelite by runelite.
the class ParallelExecutorMapping method sanityCheck.
private void sanityCheck(Object one, Object two) {
if (one instanceof Field && two instanceof Field) {
Field f1 = (Field) one;
Field f2 = (Field) two;
assert f1.isStatic() == f2.isStatic() : "field map with static mismatch!";
}
}
use of net.runelite.asm.Field in project runelite by runelite.
the class ParallelExecutorMapping method mapClass.
private void mapClass(StaticInitializerIndexer staticIndexer1, StaticInitializerIndexer staticIndexer2, Object one, Object two) {
ClassFile cf1, cf2;
if (one instanceof Field || two instanceof Field) {
assert one instanceof Field;
assert two instanceof Field;
Field f1 = (Field) one;
Field f2 = (Field) two;
assert f1.isStatic() == f2.isStatic();
if (staticIndexer1.isStatic(f1) && staticIndexer2.isStatic(f2)) {
logger.debug("Mapping class of {} -> {} due to static initializer", f1, f2);
} else if (f1.isStatic() || f2.isStatic()) {
return;
}
cf1 = f1.getClassFile();
cf2 = f2.getClassFile();
} else if (one instanceof Method || two instanceof Method) {
assert one instanceof Method;
assert two instanceof Method;
Method m1 = (Method) one;
Method m2 = (Method) two;
assert m1.isStatic() == m1.isStatic();
if (m1.isStatic() || m2.isStatic()) {
return;
}
cf1 = m1.getClassFile();
cf2 = m2.getClassFile();
} else {
assert false;
return;
}
belongs(cf1, group);
belongs(cf2, group2);
Mapping m = getMapping(cf1, cf2);
m.inc();
}
use of net.runelite.asm.Field in project runelite by runelite.
the class AnnotationCopier method copy.
public void copy() {
for (ClassFile cf1 : group1.getClasses()) {
ClassFile cf2 = group2.findClass(cf1.getName());
assert cf2 != null;
copy(cf1.getAnnotations(), cf2.getAnnotations());
for (Field f : cf1.getFields()) {
Field f2 = cf2.findField(f.getName(), f.getType());
assert f2 != null || f.getAnnotations() == null;
if (f2 == null)
continue;
copy(f.getAnnotations(), f2.getAnnotations());
}
for (Method m : cf1.getMethods()) {
Method m2 = cf2.findMethod(m.getName(), m.getDescriptor());
assert m2 != null || m.getAnnotations() == null;
if (m2 == null)
continue;
copy(m.getAnnotations(), m2.getAnnotations());
}
}
}
use of net.runelite.asm.Field in project runelite by runelite.
the class RenameUniqueTest method checkRenamed.
private void checkRenamed() {
for (ClassFile cf : group.getClasses()) {
Assert.assertTrue(cf.getName().startsWith("class") || cf.getName().equals("client"));
for (Field f : cf.getFields()) {
// synthetic fields arent obfuscated
if (f.isSynthetic())
continue;
Assert.assertTrue(f.getName().startsWith("field"));
}
for (Method m : cf.getMethods()) {
Assert.assertTrue(m.getName().length() > 2);
checkCode(m.getCode());
}
}
}
use of net.runelite.asm.Field in project runelite by runelite.
the class AnnotationMapper method run.
private int run(ClassFile from, ClassFile to) {
int count = 0;
if (hasCopyableAnnotation(from.getAnnotations())) {
if (to != null) {
count += copyAnnotations(from.getAnnotations(), to.getAnnotations());
} else {
logger.warn("Class {} has copyable annotations but there is no mapped class", from);
}
}
for (Field f : from.getFields()) {
if (!hasCopyableAnnotation(f.getAnnotations()))
continue;
Field other = (Field) mapping.get(f);
if (other == null) {
logger.warn("Unable to map annotated field {} named {}", f, DeobAnnotations.getExportedName(f.getAnnotations()));
continue;
}
count += copyAnnotations(f.getAnnotations(), other.getAnnotations());
}
for (Method m : from.getMethods()) {
if (!hasCopyableAnnotation(m.getAnnotations()))
continue;
Method other = (Method) mapping.get(m);
if (other == null) {
logger.warn("Unable to map annotated method {} named {}", m, DeobAnnotations.getExportedName(m.getAnnotations()));
continue;
}
count += copyAnnotations(m.getAnnotations(), other.getAnnotations());
}
return count;
}
Aggregations