private boolean isSameAnnotationSet( Dex oldDex, Dex newDex, int oldAnnotationSetOffset, int newAnnotationSetOffset ) { if (oldAnnotationSetOffset == 0 && newAnnotationSetOffset == 0) { return true; } if (oldAnnotationSetOffset == 0 || newAnnotationSetOffset == 0) { return false; } AnnotationSet oldClassAnnotationSet = oldDex.openSection(oldAnnotationSetOffset).readAnnotationSet(); AnnotationSet newClassAnnotationSet = newDex.openSection(newAnnotationSetOffset).readAnnotationSet(); int oldAnnotationOffsetCount = oldClassAnnotationSet.annotationOffsets.length; int newAnnotationOffsetCount = newClassAnnotationSet.annotationOffsets.length; if (oldAnnotationOffsetCount != newAnnotationOffsetCount) { return false; } for (int i = 0; i < oldAnnotationOffsetCount; ++i) { if (!isSameAnnotation( oldDex, newDex, oldClassAnnotationSet.annotationOffsets[i], newClassAnnotationSet.annotationOffsets[i] )) { return false; } } return true; }
private boolean isSameAnnotationSet( Dex oldDex, Dex newDex, int oldAnnotationSetOffset, int newAnnotationSetOffset ) { if (oldAnnotationSetOffset == 0 && newAnnotationSetOffset == 0) { return true; } if (oldAnnotationSetOffset == 0 || newAnnotationSetOffset == 0) { return false; } AnnotationSet oldClassAnnotationSet = oldDex.openSection(oldAnnotationSetOffset).readAnnotationSet(); AnnotationSet newClassAnnotationSet = newDex.openSection(newAnnotationSetOffset).readAnnotationSet(); int oldAnnotationOffsetCount = oldClassAnnotationSet.annotationOffsets.length; int newAnnotationOffsetCount = newClassAnnotationSet.annotationOffsets.length; if (oldAnnotationOffsetCount != newAnnotationOffsetCount) { return false; } for (int i = 0; i < oldAnnotationOffsetCount; ++i) { if (!isSameAnnotation( oldDex, newDex, oldClassAnnotationSet.annotationOffsets[i], newClassAnnotationSet.annotationOffsets[i] )) { return false; } } return true; }