- Fixed an issue when trying to set a null AnnotationDirectoryItem to a ClassDefItem

- Fixed an issue when interning a CodeItem with no debug info
- Fixed an issue where the MapItem wasn't getting added to the dex file  correctly when creating a dex file from scratch

git-svn-id: https://smali.googlecode.com/svn/trunk@213 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-06-23 02:37:34 +00:00
parent 81014659d9
commit fdef6422d2
3 changed files with 13 additions and 9 deletions

View File

@ -209,8 +209,10 @@ public class ClassDefItem extends IndexedItem<ClassDefItem> {
public void setAnnotations(AnnotationDirectoryItem annotations) {
this.classAnnotationsReferenceField.setReference(annotations);
if (annotations != null) {
annotations.setParent(this);
}
}
public void setClassDataItem(ClassDataItem classDataItem) {
this.classDataReferenceField.setReference(classDataItem);
@ -261,12 +263,14 @@ public class ClassDefItem extends IndexedItem<ClassDefItem> {
public int placeSection(int offset) {
currentOffset = offset;
if (section.dexFile.getSortAllItems()) {
//presort the list, to guarantee a unique ordering
Collections.sort(section.items, new Comparator<ClassDefItem>() {
public int compare(ClassDefItem classDefItem, ClassDefItem classDefItem1) {
return classDefItem.getClassType().compareTo(classDefItem1.getClassType());
}
});
}
for (ClassDefItem classDefItem: section.items) {
classDefItem.offset = -1;

View File

@ -152,7 +152,7 @@ public class CodeItem extends OffsettedItem<CodeItem> {
triesListField.copyTo(dexFile, copy.triesListField);
DebugInfoItem copyDebugInfo = copy.getDebugInfo();
if (copy != null) {
if (copyDebugInfo != null) {
copyDebugInfo.setParent(copy);
}
}

View File

@ -588,7 +588,7 @@ public class DexFile
return new MapItem(dexFile, index);
}
public MapItem intern(DexFile dexFile, MapItem item) {
public MapItem intern(MapItem item) {
this.items.add(item);
return item;
}