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
@ -114,6 +114,13 @@ public class EncodedArrayPool {
|
||||
private final Set<? extends Field> fields;
|
||||
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 =
|
||||
new Function<Field, EncodedValue>() {
|
||||
@Override
|
||||
@ -133,9 +140,9 @@ public class EncodedArrayPool {
|
||||
|
||||
@Nullable
|
||||
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);
|
||||
|
||||
if (lastIndex > -1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user