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 66e9136..33af67f 100644
--- a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
+++ b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
@@ -3480,7 +3480,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);
@@ -3550,6 +3553,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);
}