Move original-name lens lookup to assert
Bug: b/261971803
Change-Id: Ia4eb194d5ec65c9b688e9c3c2a25bce06e3ae311
diff --git a/src/main/java/com/android/tools/r8/utils/positions/MappedPositionToClassNameMapperBuilder.java b/src/main/java/com/android/tools/r8/utils/positions/MappedPositionToClassNameMapperBuilder.java
index 11b43da..7de494f 100644
--- a/src/main/java/com/android/tools/r8/utils/positions/MappedPositionToClassNameMapperBuilder.java
+++ b/src/main/java/com/android/tools/r8/utils/positions/MappedPositionToClassNameMapperBuilder.java
@@ -227,11 +227,6 @@
appView.getNamingLens().lookupMethod(method.getReference(), appView.dexItemFactory());
MethodSignature residualSignature = MethodSignature.fromDexMethod(residualMethod);
- // TODO(b/261971803): This original method via lens is just to assert compatibility with the
- // previous implementation. Remove this as part of cleaning-up / reducing lens usage.
- DexMethod lensOriginalMethod =
- appView.graphLens().getOriginalMethodSignatureForMapping(method.getReference());
-
DexMethod originalMethod;
boolean canStripOuterFrame;
boolean residualIsD8R8Synthesized;
@@ -258,10 +253,7 @@
: definition.getReference();
}
}
- assert residualIsD8R8Synthesized
- || originalMethod.isIdenticalTo(lensOriginalMethod)
- // TODO(b/326562454): In some case the lens is mapping two methods to a common original.
- || originalMethod.getHolderType().isIdenticalTo(lensOriginalMethod.getHolderType());
+ assert verifyMethodMapping(method, originalMethod, residualIsD8R8Synthesized);
OneShotCollectionConsumer<MappingInformation> methodSpecificMappingInformation =
OneShotCollectionConsumer.wrap(new ArrayList<>());
@@ -461,6 +453,19 @@
return this;
}
+ private boolean verifyMethodMapping(
+ ProgramMethod method, DexMethod originalMethod, boolean residualIsD8R8Synthesized) {
+ // TODO(b/261971803): This original method via lens is just to assert compatibility with the
+ // previous implementation. Remove this as part of cleaning-up / reducing lens usage.
+ DexMethod lensOriginalMethod =
+ appView.graphLens().getOriginalMethodSignatureForMapping(method.getReference());
+ assert residualIsD8R8Synthesized
+ || originalMethod.isIdenticalTo(lensOriginalMethod)
+ // TODO(b/326562454): In some case the lens is mapping two methods to a common original.
+ || originalMethod.getHolderType().isIdenticalTo(lensOriginalMethod.getHolderType());
+ return true;
+ }
+
private boolean markAsCompilerSynthetic(ProgramMethod method) {
return method.getDefinition().isD8R8Synthesized();
}