Remove field definitions cache

Bug: 151804585, 157616970
Change-Id: I7d0b55262a6fadf665b618c426239bea607ac07c
diff --git a/src/main/java/com/android/tools/r8/graph/AppInfo.java b/src/main/java/com/android/tools/r8/graph/AppInfo.java
index 120a01f..3706dec 100644
--- a/src/main/java/com/android/tools/r8/graph/AppInfo.java
+++ b/src/main/java/com/android/tools/r8/graph/AppInfo.java
@@ -21,9 +21,6 @@
   private final DexApplication app;
   private final DexItemFactory dexItemFactory;
 
-  // TODO(b/151804585): Remove this cache.
-  private final ConcurrentHashMap<DexType, Map<DexField, DexEncodedField>> fieldDefinitionsCache;
-
   // For some optimizations, e.g. optimizing synthetic classes, we may need to resolve the current
   // class being optimized.
   private final ConcurrentHashMap<DexType, DexProgramClass> synthesizedClasses;
@@ -33,31 +30,28 @@
   private final BooleanBox obsolete;
 
   public AppInfo(DexApplication application) {
-    this(application, new ConcurrentHashMap<>(), new ConcurrentHashMap<>(), new BooleanBox());
+    this(application, new ConcurrentHashMap<>(), new BooleanBox());
   }
 
   // For desugaring.
   protected AppInfo(AppInfo appInfo) {
-    this(appInfo.app, appInfo.fieldDefinitionsCache, appInfo.synthesizedClasses, appInfo.obsolete);
+    this(appInfo.app, appInfo.synthesizedClasses, appInfo.obsolete);
   }
 
   // For AppInfoWithLiveness.
   protected AppInfo(AppInfoWithClassHierarchy previous) {
     this(
         ((AppInfo) previous).app,
-        new ConcurrentHashMap<>(((AppInfo) previous).fieldDefinitionsCache),
         new ConcurrentHashMap<>(((AppInfo) previous).synthesizedClasses),
         new BooleanBox());
   }
 
   private AppInfo(
       DexApplication application,
-      ConcurrentHashMap<DexType, Map<DexField, DexEncodedField>> fieldDefinitionsCache,
       ConcurrentHashMap<DexType, DexProgramClass> synthesizedClasses,
       BooleanBox obsolete) {
     this.app = application;
     this.dexItemFactory = application.dexItemFactory;
-    this.fieldDefinitionsCache = fieldDefinitionsCache;
     this.synthesizedClasses = synthesizedClasses;
     this.obsolete = obsolete;
   }
@@ -102,7 +96,6 @@
     assert checkIfObsolete();
     assert clazz.type.isD8R8SynthesizedClassType();
     DexProgramClass previous = synthesizedClasses.put(clazz.type, clazz);
-    invalidateFieldCacheFor(clazz.type);
     assert previous == null || previous == clazz;
   }
 
@@ -183,14 +176,6 @@
     return clazz.getMethodCollection().getMethod(method);
   }
 
-  private Map<DexField, DexEncodedField> getFieldDefinitions(DexType type) {
-    return fieldDefinitionsCache.computeIfAbsent(type, this::computeFieldDefinitions);
-  }
-
-  public void invalidateFieldCacheFor(DexType type) {
-    fieldDefinitionsCache.remove(type);
-  }
-
   /**
    * Lookup static method on the method holder, or answers null.
    *