diff --git a/dexlib2/src/main/java/org/jf/dexlib2/writer/EncodedArrayPool.java b/dexlib2/src/main/java/org/jf/dexlib2/writer/EncodedArrayPool.java index ae6d4ebb..badbd081 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/writer/EncodedArrayPool.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/writer/EncodedArrayPool.java @@ -140,12 +140,13 @@ public class EncodedArrayPool { @Nullable public static Key of(@Nonnull ClassDef classDef) { - Set staticFields = FluentIterable.from(classDef.getFields()).filter(IS_STATIC_FIELD).toSet(); - Iterable staticFieldsSorted = FluentIterable.from(staticFields).toSortedSet(new FieldComparator()); + Set staticFieldsSorted = FluentIterable.from(classDef.getFields()) + .filter(IS_STATIC_FIELD) + .toSortedSet(new FieldComparator()); int lastIndex = CollectionUtils.lastIndexOf(staticFieldsSorted, HAS_INITIALIZER); if (lastIndex > -1) { - return new Key(staticFields, lastIndex+1); + return new Key(staticFieldsSorted, lastIndex+1); } return null; }