Fixed an issue where the parent references were not being populated when interning an item

git-svn-id: https://smali.googlecode.com/svn/trunk@215 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com
2009-06-23 06:15:43 +00:00
parent 24b394bc43
commit 44682fe235
3 changed files with 28 additions and 3 deletions

View File

@ -109,9 +109,11 @@ public class AnnotationDirectoryItem extends OffsettedItem<AnnotationDirectoryIt
public int place(int index, int offset)
{
Collections.sort(fieldAnnotationList);
Collections.sort(methodAnnotationList);
Collections.sort(parameterAnnotationList);
if (!dexFile.getInplace()) {
Collections.sort(fieldAnnotationList);
Collections.sort(methodAnnotationList);
Collections.sort(parameterAnnotationList);
}
return super.place(index, offset);
}

View File

@ -342,6 +342,15 @@ public class ClassDataItem extends OffsettedItem<ClassDataItem> {
}
}
public void copyTo(DexFile dexFile, EncodedMethod copy) {
super.copyTo(dexFile, copy);
CodeItem codeItem = copy.codeItemReferenceField.getReference();
if (codeItem != null) {
codeItem.setParent(copy.methodReferenceField.getReference());
}
}
public int getAccessFlags() {
return accessFlagsField.getCachedValue();
}

View File

@ -171,6 +171,20 @@ public class ClassDefItem extends IndexedItem<ClassDefItem> {
return ((Integer)this.offset).compareTo(o.offset);
}
public void copyTo(DexFile dexFile, ClassDefItem copy) {
super.copyTo(dexFile, copy);
AnnotationDirectoryItem annotationDirectoryItem = copy.classAnnotationsReferenceField.getReference();
if (annotationDirectoryItem != null) {
annotationDirectoryItem.setParent(copy);
}
ClassDataItem classDataItem = copy.classDataReferenceField.getReference();
if (classDataItem != null) {
classDataItem.setParent(copy);
}
}
public void addField(ClassDataItem.EncodedField encodedField, EncodedValue initialValue) {
//fields are added in ClassDefItem instead of ClassDataItem because we need to grab
//the static initializers for StaticFieldInitialValues