Merge "Fix crash in DexCallSite.collectIndexedItems()"
diff --git a/src/main/java/com/android/tools/r8/graph/DexCallSite.java b/src/main/java/com/android/tools/r8/graph/DexCallSite.java
index e690317..11bca5a 100644
--- a/src/main/java/com/android/tools/r8/graph/DexCallSite.java
+++ b/src/main/java/com/android/tools/r8/graph/DexCallSite.java
@@ -118,10 +118,14 @@
public void collectIndexedItems(IndexedItemCollection indexedItems,
DexMethod method, int instructionOffset) {
assert method != null;
+ // Since collectIndexedItems() is called in transactions that may be rolled back, we may end up
+ // setting this.method and this.instructionOffset more than once. If we do set them more than
+ // once, then we must have the same values for method and instructionOffset every time.
+ assert this.method == null || this.method == method;
+ assert this.instructionOffset == 0 || this.instructionOffset == instructionOffset;
+ this.method = method;
+ this.instructionOffset = instructionOffset;
if (indexedItems.addCallSite(this)) {
- assert this.method == null;
- this.method = method;
- this.instructionOffset = instructionOffset;
methodName.collectIndexedItems(indexedItems, method, instructionOffset);
methodProto.collectIndexedItems(indexedItems, method, instructionOffset);
bootstrapMethod.collectIndexedItems(indexedItems, method, instructionOffset);