Merge "Revert "Mark empty LocalVariableList as sorted""
am: e2eee30d45
Change-Id: I0122c66ccf6131da3fb3d62a42bdf7ef7a4cc417
diff --git a/dx/src/com/android/dx/util/FixedSizeList.java b/dx/src/com/android/dx/util/FixedSizeList.java
index ad81363..40fc90a 100644
--- a/dx/src/com/android/dx/util/FixedSizeList.java
+++ b/dx/src/com/android/dx/util/FixedSizeList.java
@@ -36,7 +36,6 @@
*/
public FixedSizeList(int size) {
super(size != 0);
- sorted = size == 0;
try {
arr = new Object[size];
@@ -279,13 +278,11 @@
@SuppressWarnings("unchecked")
protected <T> void sort(Comparator<T> comparator) {
- if (!sorted) {
- throwIfImmutable();
+ throwIfImmutable();
- Arrays.<T>sort((T[]) arr, comparator);
- setImmutable();
- sorted = true;
- }
+ Arrays.<T>sort((T[]) arr, comparator);
+ setImmutable();
+ sorted = true;
}
public boolean isSorted() {