Attempt to fix NPE in InterfaceMethodRewriter#duplicateEmulatedInterfaces
Test: Regress37740372
Change-Id: Icc8bb28ce414eca005298044644c6b9b6b2fc304
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/InterfaceMethodRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/InterfaceMethodRewriter.java
index ae14474..eb855d1 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/InterfaceMethodRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/InterfaceMethodRewriter.java
@@ -966,6 +966,9 @@
// All classes implementing an emulated interface now implements the interface and the
// emulated one, as well as hidden overrides, for correct emulated dispatch.
for (DexClass clazz : appView.appInfo().classes()) {
+ if (clazz.type == appView.dexItemFactory().objectType) {
+ continue;
+ }
List<DexType> extraInterfaces = new ArrayList<>();
for (DexType type : clazz.interfaces.values) {
if (emulatedInterfaces.containsKey(type)) {
@@ -973,6 +976,7 @@
}
}
if (!appView.options().isDesugaredLibraryCompilation()) {
+ assert clazz.superType != null;
DexClass superClazz = appView.definitionFor(clazz.superType);
if (superClazz != null && superClazz.isLibraryClass()) {
List<DexType> itfs = emulatedInterfacesOf(superClazz);