Commit 22e9ac22 authored by Skylot's avatar Skylot

core: fix field search with obfuscated names

parent 8a6cdec7
......@@ -25,10 +25,6 @@ public class FieldInfo {
dex.getType(field.getTypeIndex()));
}
public static String getNameById(DexNode dex, int ind) {
return dex.getString(dex.getFieldId(ind).getNameIndex());
}
public String getName() {
return name;
}
......@@ -50,16 +46,9 @@ public class FieldInfo {
return false;
}
FieldInfo fieldInfo = (FieldInfo) o;
if (!name.equals(fieldInfo.name)) {
return false;
}
if (!type.equals(fieldInfo.type)) {
return false;
}
if (!declClass.equals(fieldInfo.declClass)) {
return false;
}
return true;
return name.equals(fieldInfo.name)
&& type.equals(fieldInfo.type)
&& declClass.equals(fieldInfo.declClass);
}
@Override
......
......@@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.jetbrains.annotations.TestOnly;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -317,19 +318,19 @@ public class ClassNode extends LineAttrNode implements ILoadable {
}
public FieldNode searchFieldById(int id) {
String name = FieldInfo.getNameById(dex, id);
return searchField(FieldInfo.fromDex(dex, id));
}
public FieldNode searchField(FieldInfo field) {
for (FieldNode f : fields) {
if (f.getName().equals(name)) {
if (f.getFieldInfo().equals(field)) {
return f;
}
}
return null;
}
public FieldNode searchField(FieldInfo field) {
return searchFieldByName(field.getName());
}
@TestOnly
public FieldNode searchFieldByName(String name) {
for (FieldNode f : fields) {
if (f.getName().equals(name)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment