Make api reference level cache concurrent

This is a prerequisite for using the map when looking up types when desugaring.

Bug: 188388130
Change-Id: I8748542e025683b056ad997c1031ec6e6d8812ef
diff --git a/src/main/java/com/android/tools/r8/androidapi/AndroidApiReferenceLevelCache.java b/src/main/java/com/android/tools/r8/androidapi/AndroidApiReferenceLevelCache.java
index 10cc51f..f2502e2 100644
--- a/src/main/java/com/android/tools/r8/androidapi/AndroidApiReferenceLevelCache.java
+++ b/src/main/java/com/android/tools/r8/androidapi/AndroidApiReferenceLevelCache.java
@@ -15,24 +15,24 @@
 import com.android.tools.r8.utils.AndroidApiLevel;
 import com.android.tools.r8.utils.Box;
 import com.android.tools.r8.utils.TraversalContinuation;
-import java.util.IdentityHashMap;
-import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 public class AndroidApiReferenceLevelCache {
 
   private static final int BUILD_CACHE_TRESHOLD = 20;
 
-  private final Map<DexType, AndroidApiClass> apiTypeLookup;
-  private final Map<DexReference, AndroidApiLevel> apiMemberLookup = new IdentityHashMap<>();
+  private final ConcurrentHashMap<DexType, AndroidApiClass> apiTypeLookup;
+  private final ConcurrentHashMap<DexReference, AndroidApiLevel> apiMemberLookup =
+      new ConcurrentHashMap<>();
   private final DesugaredLibraryConfiguration desugaredLibraryConfiguration;
   private final AppView<?> appView;
 
   private AndroidApiReferenceLevelCache(AppView<?> appView) {
-    this(appView, new IdentityHashMap<>());
+    this(appView, new ConcurrentHashMap<>());
   }
 
   private AndroidApiReferenceLevelCache(
-      AppView<?> appView, Map<DexType, AndroidApiClass> apiTypeLookup) {
+      AppView<?> appView, ConcurrentHashMap<DexType, AndroidApiClass> apiTypeLookup) {
     this.appView = appView;
     this.apiTypeLookup = apiTypeLookup;
     desugaredLibraryConfiguration = appView.options().desugaredLibraryConfiguration;
@@ -51,7 +51,7 @@
     }
     // The apiTypeLookup is build lazily except for the mocked api types that we define in tests
     // externally.
-    Map<DexType, AndroidApiClass> apiTypeLookup = new IdentityHashMap<>();
+    ConcurrentHashMap<DexType, AndroidApiClass> apiTypeLookup = new ConcurrentHashMap<>();
     appView
         .options()
         .apiModelingOptions()