mirror of
https://github.com/revanced/smali.git
synced 2025-05-29 12:20:11 +02:00
Sort the annotations in an AnnotationSetItem based on the TypeIdItem index
git-svn-id: https://smali.googlecode.com/svn/trunk@714 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
f2370e3a2e
commit
cda416b795
@ -31,6 +31,8 @@ package org.jf.dexlib;
|
|||||||
import org.jf.dexlib.Util.AnnotatedOutput;
|
import org.jf.dexlib.Util.AnnotatedOutput;
|
||||||
import org.jf.dexlib.Util.Input;
|
import org.jf.dexlib.Util.Input;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class AnnotationSetItem extends Item<AnnotationSetItem> {
|
public class AnnotationSetItem extends Item<AnnotationSetItem> {
|
||||||
@ -87,6 +89,20 @@ public class AnnotationSetItem extends Item<AnnotationSetItem> {
|
|||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
protected void writeItem(AnnotatedOutput out) {
|
protected void writeItem(AnnotatedOutput out) {
|
||||||
|
Arrays.sort(annotations, new Comparator<AnnotationItem>() {
|
||||||
|
public int compare(AnnotationItem annotationItem, AnnotationItem annotationItem2) {
|
||||||
|
int annotationItemIndex = annotationItem.getEncodedAnnotation().annotationType.getIndex();
|
||||||
|
int annotationItemIndex2 = annotationItem2.getEncodedAnnotation().annotationType.getIndex();
|
||||||
|
if (annotationItemIndex < annotationItemIndex2) {
|
||||||
|
return -1;
|
||||||
|
} else if (annotationItemIndex == annotationItemIndex2) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
if (out.annotates()) {
|
if (out.annotates()) {
|
||||||
out.annotate(4, "size: 0x" + Integer.toHexString(annotations.length) + " (" + annotations.length + ")");
|
out.annotate(4, "size: 0x" + Integer.toHexString(annotations.length) + " (" + annotations.length + ")");
|
||||||
for (AnnotationItem annotationItem: annotations) {
|
for (AnnotationItem annotationItem: annotations) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user