core: fix android specific class handler

This commit is contained in:
Skylot
2013-11-27 22:14:34 +04:00
parent fde431d131
commit c416f77e99
2 changed files with 9 additions and 16 deletions
@@ -144,15 +144,18 @@ public class InsnGen {
return arg(arg) + "." + name;
}
private String sfield(FieldInfo field) {
protected String sfield(FieldInfo field) {
String thisClass = mth.getParentClass().getFullName();
if (thisClass.startsWith(field.getDeclClass().getFullName())) {
ClassInfo declClass = field.getDeclClass();
if (thisClass.startsWith(declClass.getFullName())) {
return field.getName();
} else if (field.getDeclClass().getFullName().startsWith(mth.getParentClass().getPackage() + ".R")) {
return field.getDeclClass().getNameWithoutPackage() + '.' + field.getName();
} else {
return useClass(field.getDeclClass()) + '.' + field.getName();
}
// Android specific resources class handler
ClassInfo parentClass = declClass.getParentClass();
if (parentClass != null && parentClass.getShortName().equals("R")) {
return useClass(parentClass) + "." + declClass.getShortName() + "." + field.getName();
}
return useClass(declClass) + '.' + field.getName();
}
private void fieldPut(IndexInsnNode insn) {
@@ -308,14 +308,4 @@ public class RegionGen extends InsnGen {
makeRegionIndent(code, region);
}
}
// FIXME: !!code from InsnGen.sfield
private String sfield(FieldInfo field) {
String thisClass = mth.getParentClass().getFullName();
if (thisClass.startsWith(field.getDeclClass().getFullName())) {
return field.getName();
} else {
return useClass(field.getDeclClass()) + '.' + field.getName();
}
}
}