mirror of
https://github.com/revanced/smali.git
synced 2025-05-21 16:37:04 +02:00
Sorting items in encoded_array to match the order of fields.
This commit is contained in:
parent
7b89cbdf6b
commit
7f10374f40
@ -113,6 +113,13 @@ public class EncodedArrayPool {
|
|||||||
public static class Key implements Comparable<Key> {
|
public static class Key implements Comparable<Key> {
|
||||||
private final Set<? extends Field> fields;
|
private final Set<? extends Field> fields;
|
||||||
private final int size;
|
private final int size;
|
||||||
|
|
||||||
|
private static class FieldComparator implements Comparator<Field> {
|
||||||
|
@Override
|
||||||
|
public int compare(Field o1, Field o2) {
|
||||||
|
return o1.compareTo(o2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static final Function<Field, EncodedValue> GET_INITIAL_VALUE =
|
private static final Function<Field, EncodedValue> GET_INITIAL_VALUE =
|
||||||
new Function<Field, EncodedValue>() {
|
new Function<Field, EncodedValue>() {
|
||||||
@ -133,9 +140,9 @@ public class EncodedArrayPool {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Key of(@Nonnull ClassDef classDef) {
|
public static Key of(@Nonnull ClassDef classDef) {
|
||||||
Set<? extends Field> fields = classDef.getFields();
|
Set<? extends Field> fields = FluentIterable.from(classDef.getFields()).toImmutableSortedSet(new FieldComparator());
|
||||||
|
|
||||||
Iterable<? extends Field> staticFields = FluentIterable.from(classDef.getFields()).filter(IS_STATIC_FIELD);
|
Iterable<? extends Field> staticFields = FluentIterable.from(fields).filter(IS_STATIC_FIELD);
|
||||||
int lastIndex = CollectionUtils.lastIndexOf(staticFields, HAS_INITIALIZER);
|
int lastIndex = CollectionUtils.lastIndexOf(staticFields, HAS_INITIALIZER);
|
||||||
|
|
||||||
if (lastIndex > -1) {
|
if (lastIndex > -1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user