Add missing sharing of synthetic classes in D8/CF.

Bug: 158159959
Change-Id: I53e4610e79a1c9b5f1265214eeb7f7f2374790a0
diff --git a/src/main/java/com/android/tools/r8/D8.java b/src/main/java/com/android/tools/r8/D8.java
index 413ac45..ab0d4dd 100644
--- a/src/main/java/com/android/tools/r8/D8.java
+++ b/src/main/java/com/android/tools/r8/D8.java
@@ -254,6 +254,12 @@
 
       InspectorImpl.runInspections(options.outputInspections, appView.appInfo().classes());
       if (options.isGeneratingClassFiles()) {
+        // TODO(b/158159959): Move this out so it is shared for both CF and DEX pipelines.
+        SyntheticFinalization.Result result =
+            appView.getSyntheticItems().computeFinalSynthetics(appView);
+        if (result != null) {
+          appView.setAppInfo(new AppInfo(result.commit, appView.appInfo().getMainDexClasses()));
+        }
         new CfApplicationWriter(
                 appView,
                 marker,
@@ -289,6 +295,7 @@
           namingLens = NamingLens.getIdentityLens();
         }
 
+        // TODO(b/158159959): Move this out so it is shared for both CF and DEX pipelines.
         SyntheticFinalization.Result result =
             appView.getSyntheticItems().computeFinalSynthetics(appView);
         if (result != null) {