Fixing collection of class descriptors in VirtualFile to properly work with transactions implemented in IndexedItemTransaction class.
BUG=
Change-Id: I4b973203d87ade2b6b6d519ae75fb8ff270cad2d
diff --git a/src/main/java/com/android/tools/r8/dex/VirtualFile.java b/src/main/java/com/android/tools/r8/dex/VirtualFile.java
index ad5420d..07fce3a 100644
--- a/src/main/java/com/android/tools/r8/dex/VirtualFile.java
+++ b/src/main/java/com/android/tools/r8/dex/VirtualFile.java
@@ -63,7 +63,6 @@
private static final int MAX_PREFILL_ENTRIES = MAX_ENTRIES - 5000;
private final int id;
- private final Set<String> classDescriptors = new HashSet<>();
private final VirtualFileIndexedItemCollection indexedItems;
private final IndexedItemTransaction transaction;
@@ -74,6 +73,11 @@
}
public Set<String> getClassDescriptors() {
+ Set<String> classDescriptors = new HashSet<>();
+ for (DexProgramClass clazz : indexedItems.classes) {
+ boolean added = classDescriptors.add(clazz.type.descriptor.toString());
+ assert added;
+ }
return classDescriptors;
}
@@ -289,7 +293,6 @@
private void addClass(DexProgramClass clazz) {
transaction.addClassAndDependencies(clazz);
- classDescriptors.add(clazz.type.descriptor.toString());
}
private static boolean isFull(int numberOfMethods, int numberOfFields, int maximum) {