Gracefully handle duplicate methods and fields in baksmali

baksmali will emit duplicate methods and fields as commented blocks, when it
is safe to do so.
This commit is contained in:
Ben Gruver
2012-05-14 22:03:11 -07:00
parent 9c7c421f51
commit 3f70d08442
4 changed files with 123 additions and 21 deletions

View File

@ -201,6 +201,25 @@ public class FieldIdItem extends Item<FieldIdItem> implements Convertible<FieldI
return cachedFieldString;
}
String cachedShortFieldString = null;
/**
* @return a "short" string containing just the field name and type, formatted like fieldName:fieldType
*/
public String getShortFieldString() {
if (cachedShortFieldString == null) {
String fieldName = this.fieldName.getStringValue();
String fieldType = this.fieldType.getTypeDescriptor();
StringBuffer sb = new StringBuffer(fieldName.length() + fieldType.length() + 1);
sb.append(fieldName);
sb.append(":");
sb.append(fieldType);
cachedShortFieldString = sb.toString();
}
return cachedShortFieldString;
}
/**
* calculate and cache the hashcode
*/