Don't pass non-class types to isSubtype
Change-Id: I4ffaa77c5edb87d8283abc3b80e9538e501a6051
diff --git a/src/main/java/com/android/tools/r8/graph/AppInfoWithClassHierarchy.java b/src/main/java/com/android/tools/r8/graph/AppInfoWithClassHierarchy.java
index 87a2343..de380e8 100644
--- a/src/main/java/com/android/tools/r8/graph/AppInfoWithClassHierarchy.java
+++ b/src/main/java/com/android/tools/r8/graph/AppInfoWithClassHierarchy.java
@@ -36,12 +36,16 @@
public boolean isSubtype(DexType subtype, DexType supertype) {
assert subtype != null;
assert supertype != null;
+ assert subtype.isClassType();
+ assert supertype.isClassType();
return subtype == supertype || isStrictSubtypeOf(subtype, supertype);
}
public boolean isStrictSubtypeOf(DexType subtype, DexType supertype) {
assert subtype != null;
assert supertype != null;
+ assert subtype.isClassType();
+ assert supertype.isClassType();
if (subtype == supertype) {
return false;
}
diff --git a/src/main/java/com/android/tools/r8/shaking/MainDexListBuilder.java b/src/main/java/com/android/tools/r8/shaking/MainDexListBuilder.java
index 15be9af..bfefefa 100644
--- a/src/main/java/com/android/tools/r8/shaking/MainDexListBuilder.java
+++ b/src/main/java/com/android/tools/r8/shaking/MainDexListBuilder.java
@@ -101,12 +101,14 @@
DexProto proto = method.method.proto;
if (proto.parameters.isEmpty()) {
DexType valueType = proto.returnType.toBaseType(appInfo.dexItemFactory());
- if (isEnum(valueType)) {
- value = true;
- break;
- } else if (isAnnotation(valueType) && isAnnotationWithEnum(valueType)) {
- value = true;
- break;
+ if (valueType.isClassType()) {
+ if (isEnum(valueType)) {
+ value = true;
+ break;
+ } else if (isAnnotation(valueType) && isAnnotationWithEnum(valueType)) {
+ value = true;
+ break;
+ }
}
}
}