hiddenapi: Error message when superclass not found
Print an error message when building class hierarchy and unable to
find a superclass. This typically means that the provided classpath
is inconsistent (superclass missing), or the order of classes is
incorrect (superclass after child class).
Bug: 131289033
Test: compiles
Change-Id: Ia82755cc90008e974ce22dd2ccced81257ca90f9
diff --git a/tools/hiddenapi/hiddenapi.cc b/tools/hiddenapi/hiddenapi.cc
index 937abd1..646e483 100644
--- a/tools/hiddenapi/hiddenapi.cc
+++ b/tools/hiddenapi/hiddenapi.cc
@@ -526,7 +526,11 @@
}
HierarchyClass* superclass = FindClass(dex_klass.GetSuperclassDescriptor());
- CHECK(superclass != nullptr);
+ CHECK(superclass != nullptr)
+ << "Superclass " << dex_klass.GetSuperclassDescriptor()
+ << " of class " << dex_klass.GetDescriptor() << " from dex file \""
+ << dex_klass.GetDexFile().GetLocation() << "\" was not found. "
+ << "Either the superclass is missing or it appears later in the classpath spec.";
klass.AddExtends(*superclass);
for (const std::string_view& iface_desc : dex_klass.GetInterfaceDescriptors()) {