Allow disabling of horizontal class merging
Currently horizontal class merging can exacerbate issues stemming from
existing dex verification errors (if a small class fails dex
verification, if it is merged into a big class, then the big class will
also fail dex verification).
Add an option to globally disable horizontal class merging until it no
longer exacerbates dex verification errors.
Bug: 138781768
Change-Id: Iec3305a202ea903e374daa3362c5bd5b9dfd03f7
diff --git a/src/main/java/com/android/tools/r8/utils/InternalOptions.java b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
index cecd8b8..83a2245 100644
--- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
@@ -1154,7 +1154,10 @@
public static class HorizontalClassMergerOptions {
- public boolean enable = true;
+ // TODO(b/138781768): Set enable to true when this bug is resolved.
+ public boolean enable =
+ !Version.isDevelopmentVersion()
+ || System.getProperty("com.android.tools.r8.disableHorizontalClassMerging") == null;
public boolean enableConstructorMerging = true;
public boolean enableJavaLambdaMerging = true;