Don't assume non-conflicting synthetics.
Repeated compilation of code can cause input synthetics to already
have names that would be used for outputs. The presence of these are
handled and the compiler should not assume they don't exist by
asserts.
Fixes: b/236673399
Change-Id: I4aff4a35c41a9f47f910001bf840d456dad777a4
diff --git a/src/main/java/com/android/tools/r8/synthesis/SyntheticFinalization.java b/src/main/java/com/android/tools/r8/synthesis/SyntheticFinalization.java
index eb764c0..822fa38 100644
--- a/src/main/java/com/android/tools/r8/synthesis/SyntheticFinalization.java
+++ b/src/main/java/com/android/tools/r8/synthesis/SyntheticFinalization.java
@@ -744,8 +744,6 @@
}
DexClass clazz = appView.appInfo().definitionForWithoutExistenceAssert(externalType);
if (clazz != null && isNotSyntheticType(clazz.type)) {
- assert options.testing.allowConflictingSyntheticTypes
- : "Unexpected creation of an existing external synthetic type: " + clazz;
externalType = null;
}
} while (externalType == null);
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 2612127..1fecada 100644
--- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
@@ -1931,8 +1931,6 @@
// minified field names instead of original field names.
public boolean enableRecordModeling = true;
- public boolean allowConflictingSyntheticTypes = false;
-
// Flag to allow processing of resources in D8. A data resource consumer still needs to be
// specified.
public boolean enableD8ResourcesPassThrough = false;
diff --git a/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaNamingConflictTest.java b/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaNamingConflictTest.java
index 1a6e364..e862e2e 100644
--- a/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaNamingConflictTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaNamingConflictTest.java
@@ -58,7 +58,6 @@
.addProgramClassFileData(getConflictingNameClass())
.addProgramClassFileData(getTransformedMainClass())
.setMinApi(parameters.getApiLevel())
- .addOptionsModification(o -> o.testing.allowConflictingSyntheticTypes = true)
.run(parameters.getRuntime(), TestClass.class)
.assertSuccessWithOutput(EXPECTED);
}
@@ -70,7 +69,6 @@
.addProgramClassFileData(getConflictingNameClass())
.addProgramClassFileData(getTransformedMainClass())
.setMinApi(parameters.getApiLevel())
- .addOptionsModification(o -> o.testing.allowConflictingSyntheticTypes = true)
.addKeepMainRule(TestClass.class)
// Ensure that R8 cannot remove or rename the conflicting name.
.addKeepClassAndMembersRules(CONFLICTING_NAME.getTypeName())
diff --git a/src/test/java/com/android/tools/r8/smali/OutlineTest.java b/src/test/java/com/android/tools/r8/smali/OutlineTest.java
index 10d96c1..56435ed 100644
--- a/src/test/java/com/android/tools/r8/smali/OutlineTest.java
+++ b/src/test/java/com/android/tools/r8/smali/OutlineTest.java
@@ -950,10 +950,7 @@
for (int i = 1; i < count; i++) {
// Build a new application with the Outliner class.
originalApplication = processedApplication;
- processedApplication =
- processApplication(
- originalApplication,
- options.andThen(o -> o.testing.allowConflictingSyntheticTypes = true));
+ processedApplication = processApplication(originalApplication, options);
assertEquals((i + 1) * 3, getNumberOfProgramClasses(processedApplication));
}