Added asserts to check if items are being placed in the original locations, when writing a dex file "in place"

git-svn-id: https://smali.googlecode.com/svn/trunk@377 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com
2009-08-10 06:57:05 +00:00
parent 3c23129eec
commit 9f6bc080a4
2 changed files with 2 additions and 0 deletions

View File

@ -79,6 +79,7 @@ public abstract class Item<T extends Item> implements Comparable<T> {
*/
protected int placeAt(int offset, int index) {
assert offset % getItemType().ItemAlignment == 0:"The offset is not aligned";
assert !dexFile.getInplace() || (offset == this.offset && this.index == index);
this.offset = offset;
this.index = index;

View File

@ -85,6 +85,7 @@ public abstract class Section<T extends Item> {
protected int placeAt(int offset) {
if (items.size() > 0) {
offset = AlignmentUtils.alignOffset(offset, ItemType.ItemAlignment);
assert !DexFile.getInplace() || offset == this.offset;
this.offset = offset;
for (int i=0; i < items.size(); i++) {