Clear the type cache before creating a D8 AppInfo.

Bug: b/259933493

Change-Id: If27f645bb5598756b8236bf8d3d4f27722ba6386
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/code/SyntheticInitializerConverter.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/code/SyntheticInitializerConverter.java
index 0d3c55a..a3e5972 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/code/SyntheticInitializerConverter.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/code/SyntheticInitializerConverter.java
@@ -91,6 +91,10 @@
     // application writer. We therefore simulate that we are in D8, to allow building IR for each of
     // the class initializers without applying the unapplied code rewritings, to avoid that we apply
     // the lens more than once to the same piece of code.
+
+    // Since we are now running in D8 mode clear type elements cache.
+    appView.dexItemFactory().clearTypeElementsCache();
+
     AppView<AppInfo> appViewForConversion =
         AppView.createForD8(
             AppInfo.createInitialAppInfo(