Merge "Assert code item is DexCode."
diff --git a/src/main/java/com/android/tools/r8/naming/IdentifierMinifier.java b/src/main/java/com/android/tools/r8/naming/IdentifierMinifier.java
index 374f496..fe0ff72 100644
--- a/src/main/java/com/android/tools/r8/naming/IdentifierMinifier.java
+++ b/src/main/java/com/android/tools/r8/naming/IdentifierMinifier.java
@@ -58,9 +58,10 @@
return;
}
Code code = encodedMethod.getCode();
- if (code == null || !code.isDexCode()) {
+ if (code == null) {
return;
}
+ assert code.isDexCode();
DexCode dexCode = code.asDexCode();
for (Instruction instr : dexCode.instructions) {
if (instr instanceof ConstString) {
diff --git a/src/main/java/com/android/tools/r8/naming/SourceFileRewriter.java b/src/main/java/com/android/tools/r8/naming/SourceFileRewriter.java
index 38f8cb3..c10d0d7 100644
--- a/src/main/java/com/android/tools/r8/naming/SourceFileRewriter.java
+++ b/src/main/java/com/android/tools/r8/naming/SourceFileRewriter.java
@@ -47,15 +47,15 @@
return;
}
Code code = encodedMethod.getCode();
- // Other kinds of {@link Code} do not have debug_info_item.
- if (code == null || !code.isDexCode()) {
+ if (code == null) {
return;
}
- if (code.asDexCode().getDebugInfo() == null) {
+ assert code.isDexCode();
+ DexDebugInfo dexDebugInfo = code.asDexCode().getDebugInfo();
+ if (dexDebugInfo == null) {
return;
}
// Thanks to a single global source file, we can safely remove DBG_SET_FILE entirely.
- DexDebugInfo dexDebugInfo = code.asDexCode().getDebugInfo();
dexDebugInfo.events =
Arrays.stream(dexDebugInfo.events)
.filter(dexDebugEvent -> !(dexDebugEvent instanceof SetFile))