Java Code Examples for com.android.dex.ClassDef#getAnnotationsOffset()
The following examples show how to use
com.android.dex.ClassDef#getAnnotationsOffset() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DexMerger.java From Box with Apache License 2.0 | 6 votes |
/** * Reads a class_def_item beginning at {@code in} and writes the index and * data. */ private void transformClassDef(Dex in, ClassDef classDef, IndexMap indexMap) { idsDefsOut.assertFourByteAligned(); idsDefsOut.writeInt(classDef.getTypeIndex()); idsDefsOut.writeInt(classDef.getAccessFlags()); idsDefsOut.writeInt(classDef.getSupertypeIndex()); idsDefsOut.writeInt(classDef.getInterfacesOffset()); int sourceFileIndex = indexMap.adjustString(classDef.getSourceFileIndex()); idsDefsOut.writeInt(sourceFileIndex); int annotationsOff = classDef.getAnnotationsOffset(); idsDefsOut.writeInt(indexMap.adjustAnnotationDirectory(annotationsOff)); int classDataOff = classDef.getClassDataOffset(); if (classDataOff == 0) { idsDefsOut.writeInt(0); } else { idsDefsOut.writeInt(classDataOut.getPosition()); ClassData classData = in.readClassData(classDef); transformClassData(in, classData, indexMap); } int staticValuesOff = classDef.getStaticValuesOffset(); idsDefsOut.writeInt(indexMap.adjustEncodedArray(staticValuesOff)); }
Example 2
Source File: DexMerger.java From Box with Apache License 2.0 | 6 votes |
/** * Reads a class_def_item beginning at {@code in} and writes the index and * data. */ private void transformClassDef(Dex in, ClassDef classDef, IndexMap indexMap) { idsDefsOut.assertFourByteAligned(); idsDefsOut.writeInt(classDef.getTypeIndex()); idsDefsOut.writeInt(classDef.getAccessFlags()); idsDefsOut.writeInt(classDef.getSupertypeIndex()); idsDefsOut.writeInt(classDef.getInterfacesOffset()); int sourceFileIndex = indexMap.adjustString(classDef.getSourceFileIndex()); idsDefsOut.writeInt(sourceFileIndex); int annotationsOff = classDef.getAnnotationsOffset(); idsDefsOut.writeInt(indexMap.adjustAnnotationDirectory(annotationsOff)); int classDataOff = classDef.getClassDataOffset(); if (classDataOff == 0) { idsDefsOut.writeInt(0); } else { idsDefsOut.writeInt(classDataOut.getPosition()); ClassData classData = in.readClassData(classDef); transformClassData(in, classData, indexMap); } int staticValuesOff = classDef.getStaticValuesOffset(); idsDefsOut.writeInt(indexMap.adjustEncodedArray(staticValuesOff)); }
Example 3
Source File: DexMerger.java From buck with Apache License 2.0 | 6 votes |
/** * Reads a class_def_item beginning at {@code in} and writes the index and * data. */ private void transformClassDef(Dex in, ClassDef classDef, IndexMap indexMap) { idsDefsOut.assertFourByteAligned(); idsDefsOut.writeInt(classDef.getTypeIndex()); idsDefsOut.writeInt(classDef.getAccessFlags()); idsDefsOut.writeInt(classDef.getSupertypeIndex()); idsDefsOut.writeInt(classDef.getInterfacesOffset()); int sourceFileIndex = indexMap.adjustString(classDef.getSourceFileIndex()); idsDefsOut.writeInt(sourceFileIndex); int annotationsOff = classDef.getAnnotationsOffset(); idsDefsOut.writeInt(indexMap.adjustAnnotationDirectory(annotationsOff)); int classDataOff = classDef.getClassDataOffset(); if (classDataOff == 0) { idsDefsOut.writeInt(0); } else { idsDefsOut.writeInt(classDataOut.getPosition()); ClassData classData = in.readClassData(classDef); transformClassData(in, classData, indexMap); } int staticValuesOff = classDef.getStaticValuesOffset(); idsDefsOut.writeInt(indexMap.adjustStaticValues(staticValuesOff)); }
Example 4
Source File: ClassNode.java From Box with Apache License 2.0 | 5 votes |
private void loadAnnotations(ClassDef cls) { int offset = cls.getAnnotationsOffset(); if (offset != 0) { try { new AnnotationsParser(this).parse(offset); } catch (Exception e) { LOG.error("Error parsing annotations in {}", this, e); } } }
Example 5
Source File: IndexMap.java From Box with Apache License 2.0 | 5 votes |
public ClassDef adjust(ClassDef classDef) { return new ClassDef(target, classDef.getOffset(), adjustType(classDef.getTypeIndex()), classDef.getAccessFlags(), adjustType(classDef.getSupertypeIndex()), adjustTypeListOffset(classDef.getInterfacesOffset()), classDef.getSourceFileIndex(), classDef.getAnnotationsOffset(), classDef.getClassDataOffset(), classDef.getStaticValuesOffset()); }
Example 6
Source File: ClassNode.java From Box with Apache License 2.0 | 5 votes |
private void loadAnnotations(ClassDef cls) { int offset = cls.getAnnotationsOffset(); if (offset != 0) { try { new AnnotationsParser(this).parse(offset); } catch (Exception e) { LOG.error("Error parsing annotations in {}", this, e); } } }
Example 7
Source File: IndexMap.java From Box with Apache License 2.0 | 5 votes |
public ClassDef adjust(ClassDef classDef) { return new ClassDef(target, classDef.getOffset(), adjustType(classDef.getTypeIndex()), classDef.getAccessFlags(), adjustType(classDef.getSupertypeIndex()), adjustTypeListOffset(classDef.getInterfacesOffset()), classDef.getSourceFileIndex(), classDef.getAnnotationsOffset(), classDef.getClassDataOffset(), classDef.getStaticValuesOffset()); }
Example 8
Source File: IndexMap.java From buck with Apache License 2.0 | 5 votes |
public ClassDef adjust(ClassDef classDef) { return new ClassDef(target, classDef.getOffset(), adjustType(classDef.getTypeIndex()), classDef.getAccessFlags(), adjustType(classDef.getSupertypeIndex()), adjustTypeListOffset(classDef.getInterfacesOffset()), classDef.getSourceFileIndex(), classDef.getAnnotationsOffset(), classDef.getClassDataOffset(), classDef.getStaticValuesOffset()); }