Merge "Also mark interfaces without subtypes as interface."
diff --git a/src/main/java/com/android/tools/r8/graph/AppInfoWithSubtyping.java b/src/main/java/com/android/tools/r8/graph/AppInfoWithSubtyping.java
index bf4dd3f..ad0f549 100644
--- a/src/main/java/com/android/tools/r8/graph/AppInfoWithSubtyping.java
+++ b/src/main/java/com/android/tools/r8/graph/AppInfoWithSubtyping.java
@@ -84,6 +84,9 @@
populateSuperType(map, inter, baseClass, definitions);
inter.addInterfaceSubtype(holder);
}
+ if (holderClass.isInterface()) {
+ holder.tagAsInteface();
+ }
} else {
if (!baseClass.isLibraryClass()) {
missingClasses.add(holder);
diff --git a/src/main/java/com/android/tools/r8/graph/DexType.java b/src/main/java/com/android/tools/r8/graph/DexType.java
index 478af70..d4deb54 100644
--- a/src/main/java/com/android/tools/r8/graph/DexType.java
+++ b/src/main/java/com/android/tools/r8/graph/DexType.java
@@ -71,23 +71,27 @@
}
}
- public void addDirectSubtype(DexType type) {
+ void addDirectSubtype(DexType type) {
assert hierarchyLevel != UNKNOWN_LEVEL;
ensureDirectSubTypeSet();
directSubtypes.add(type);
type.setLevel(hierarchyLevel + 1);
}
- public void tagAsSubtypeRoot() {
+ void tagAsSubtypeRoot() {
setLevel(ROOT_LEVEL);
}
+ void tagAsInteface() {
+ setLevel(INTERFACE_LEVEL);
+ }
+
public boolean isInterface() {
assert isClassType() && hierarchyLevel != UNKNOWN_LEVEL;
return hierarchyLevel == INTERFACE_LEVEL;
}
- public void addInterfaceSubtype(DexType type) {
+ void addInterfaceSubtype(DexType type) {
// Interfaces all inherit from java.lang.Object. However, we assign a special level to
// identify them later on.
setLevel(INTERFACE_LEVEL);