import org.jf.dexlib2.dexbacked.raw.RawDexFile; //导入依赖的package包/类
public DexAnnotator(@Nonnull RawDexFile dexFile, int width) {
super(width);
this.dexFile = dexFile;
for (MapItem mapItem : dexFile.getMapItems()) {
switch (mapItem.getType()) {
case ItemType.HEADER_ITEM:
annotators.put(mapItem.getType(), HeaderItem.makeAnnotator(this, mapItem));
break;
case ItemType.STRING_ID_ITEM:
annotators.put(mapItem.getType(), StringIdItem.makeAnnotator(this, mapItem));
break;
case ItemType.TYPE_ID_ITEM:
annotators.put(mapItem.getType(), TypeIdItem.makeAnnotator(this, mapItem));
break;
case ItemType.PROTO_ID_ITEM:
annotators.put(mapItem.getType(), ProtoIdItem.makeAnnotator(this, mapItem));
break;
case ItemType.FIELD_ID_ITEM:
annotators.put(mapItem.getType(), FieldIdItem.makeAnnotator(this, mapItem));
break;
case ItemType.METHOD_ID_ITEM:
annotators.put(mapItem.getType(), MethodIdItem.makeAnnotator(this, mapItem));
break;
case ItemType.CLASS_DEF_ITEM:
annotators.put(mapItem.getType(), ClassDefItem.makeAnnotator(this, mapItem));
break;
case ItemType.MAP_LIST:
annotators.put(mapItem.getType(), MapItem.makeAnnotator(this, mapItem));
break;
case ItemType.TYPE_LIST:
annotators.put(mapItem.getType(), TypeListItem.makeAnnotator(this, mapItem));
break;
case ItemType.ANNOTATION_SET_REF_LIST:
annotators.put(mapItem.getType(), AnnotationSetRefList.makeAnnotator(this, mapItem));
break;
case ItemType.ANNOTATION_SET_ITEM:
annotators.put(mapItem.getType(), AnnotationSetItem.makeAnnotator(this, mapItem));
break;
case ItemType.CLASS_DATA_ITEM:
annotators.put(mapItem.getType(), ClassDataItem.makeAnnotator(this, mapItem));
break;
case ItemType.CODE_ITEM:
annotators.put(mapItem.getType(), CodeItem.makeAnnotator(this, mapItem));
break;
case ItemType.STRING_DATA_ITEM:
annotators.put(mapItem.getType(), StringDataItem.makeAnnotator(this, mapItem));
break;
case ItemType.DEBUG_INFO_ITEM:
annotators.put(mapItem.getType(), DebugInfoItem.makeAnnotator(this, mapItem));
break;
case ItemType.ANNOTATION_ITEM:
annotators.put(mapItem.getType(), AnnotationItem.makeAnnotator(this, mapItem));
break;
case ItemType.ENCODED_ARRAY_ITEM:
annotators.put(mapItem.getType(), EncodedArrayItem.makeAnnotator(this, mapItem));
break;
case ItemType.ANNOTATION_DIRECTORY_ITEM:
annotators.put(mapItem.getType(), AnnotationDirectoryItem.makeAnnotator(this, mapItem));
break;
default:
throw new RuntimeException(String.format("Unrecognized item type: 0x%x", mapItem.getType()));
}
}
}
请发表评论