Update toEmptyThrowingMethod() utilities to mark receiver as obsolete
Change-Id: I87495bab8632fcca1d151d1d38404543b2e04d4c
diff --git a/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java b/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
index fd9e337..ae412b5 100644
--- a/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
+++ b/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
@@ -777,11 +777,6 @@
}
public DexEncodedMethod toEmptyThrowingMethod(InternalOptions options) {
- // Note that we are not marking this instance obsolete, since this util is only used by
- // TreePruner while keeping non-live yet targeted, empty method. Such method can be retrieved
- // again only during the 2nd round of tree sharking, and seeing an obsolete empty body v.s.
- // seeing this empty throwing code do not matter.
- // If things are changed, the cure point is obsolete instances inside RootSet.
return options.isGeneratingClassFiles()
? toEmptyThrowingMethodCf()
: toEmptyThrowingMethodDex(true);
@@ -795,7 +790,9 @@
if (setIsLibraryOverride && isNonPrivateVirtualMethod()) {
builder.setIsLibraryMethodOverride(isLibraryMethodOverride());
}
- return builder.build();
+ DexEncodedMethod result = builder.build();
+ setObsolete();
+ return result;
}
public CfCode buildEmptyThrowingCfCode() {
@@ -817,9 +814,9 @@
if (isNonPrivateVirtualMethod()) {
builder.setIsLibraryMethodOverride(isLibraryMethodOverride());
}
- // Note that we are not marking this instance obsolete:
- // refer to Dex-backend version of this method above.
- return builder.build();
+ DexEncodedMethod result = builder.build();
+ setObsolete();
+ return result;
}
public DexEncodedMethod toMethodThatLogsError(AppView<?> appView) {