Implemented class and method annotations

git-svn-id: https://smali.googlecode.com/svn/trunk@166 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com
2009-06-18 06:52:02 +00:00
parent 1080561460
commit fa07a1972e
9 changed files with 223 additions and 17 deletions

View File

@ -119,6 +119,14 @@ public class AnnotationDirectoryItem extends OffsettedItem<AnnotationDirectoryIt
return "annotation_directory_item @0x" + Integer.toHexString(getOffset());
}
public AnnotationSetItem getClassAnnotations() {
return classAnnotationsReferenceField.getReference();
}
public List<MethodAnnotation> getMethodAnnotations() {
return methodAnnotationList;
}
public static class FieldAnnotation extends CompositeField<FieldAnnotation>
implements Comparable<FieldAnnotation> {
private final IndexedItemReference<FieldIdItem> fieldReferenceField;
@ -170,6 +178,14 @@ public class AnnotationDirectoryItem extends OffsettedItem<AnnotationDirectoryIt
public int compareTo(MethodAnnotation o) {
return ((Integer)method.getReference().getIndex()).compareTo(o.method.getReference().getIndex());
}
public MethodIdItem getMethod() {
return method.getReference();
}
public AnnotationSetItem getAnnotationSet() {
return annotationSet.getReference();
}
}
public static class ParameterAnnotation extends CompositeField<ParameterAnnotation>

View File

@ -60,4 +60,12 @@ public class AnnotationItem extends OffsettedItem<AnnotationItem> {
public String getConciseIdentity() {
return "annotation_item @0x" + Integer.toHexString(getOffset());
}
public byte getVisibility() {
return (byte)visibilityField.getCachedValue();
}
public AnnotationEncodedValueSubField getEncodedAnnotation() {
return annotationField;
}
}

View File

@ -74,4 +74,13 @@ public class AnnotationSetItem extends OffsettedItem<AnnotationSetItem> {
public String getConciseIdentity() {
return "annotation_set_item @0x" + Integer.toHexString(getOffset());
}
public List<AnnotationItem> getAnnotationItems() {
List<AnnotationItem> annotationItems = new ArrayList<AnnotationItem>();
for (OffsettedItemReference<AnnotationItem> annotationItemReference: annotationReferences) {
annotationItems.add(annotationItemReference.getReference());
}
return annotationItems;
}
}

View File

@ -129,6 +129,10 @@ public class ClassDefItem extends IndexedItem<ClassDefItem> {
return classDataReferenceField.getReference();
}
public AnnotationDirectoryItem getAnnotationDirectory() {
return classAnnotationsReferenceField.getReference();
}
public String getConciseIdentity() {
return "class_def_item: " + getClassName();
}