Don't double desugar default interface methods.
Bug: 199043500
Bug: 198776409
Change-Id: Ica088cd28b164dcc0d8614822990602c860585d0
diff --git a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
index a12eff1..8e8533f 100644
--- a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
+++ b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
@@ -3482,7 +3482,10 @@
private boolean addToPendingDesugaring(ProgramMethod method) {
if (options.isInterfaceMethodDesugaringEnabled()) {
if (mustMoveToInterfaceCompanionMethod(method)) {
- pendingMethodMove.add(method);
+ // TODO(b/199043500): Once "live moved methods" are tracked this can avoid the code check.
+ if (!InvalidCode.isInvalidCode(method.getDefinition().getCode())) {
+ pendingMethodMove.add(method);
+ }
return true;
}
ProgramMethod nonMovedMethod = pendingMethodMoveInverse.get(method);
@@ -3552,6 +3555,7 @@
.ensureMethodOfProgramCompanionClassStub(method, eventConsumer);
interfaceProcessor.finalizeMoveToCompanionMethod(method, companion);
pendingMethodMoveInverse.remove(companion);
+ // TODO(b/199043500): Once "live moved methods" are tracked this can be removed.
if (!isMethodLive(companion)) {
additions.addLiveMethod(companion);
}