Fix for method reference sizes

The protos can be shared across methods so we should not be counting
them as part of private method size.
This commit is contained in:
Wojtek Kaliciński 2017-09-13 11:45:38 +01:00 committed by Ben Gruver
parent 67e7b39dfc
commit f16b420b70

View File

@ -102,15 +102,11 @@ public class DexBackedMethodReference extends BaseMethodReference {
/**
* Calculate and return the private size of a method reference.
*
* Calculated as: class_idx + proto_idx + name_idx + prototype size
* Calculated as: class_idx + proto_idx + name_idx
*
* @return size in bytes
*/
public int getSize() {
int size = MethodIdItem.ITEM_SIZE; //ushort + ushort + uint for indices
DexBackedMethodProtoReference protoRef = new DexBackedMethodProtoReference(dexFile,
dexFile.readUshort(methodIdItemOffset + MethodIdItem.PROTO_OFFSET));
size += protoRef.getSize();
return size;
return MethodIdItem.ITEM_SIZE; //ushort + ushort + uint for indices
}
}