Check for unknown superclass earlier when checking invoke-super.
super.GetClass is invalid if the super class is unresolved. This fixes
the build error in dalvik-dev building VoiceSearchTests.
Change-Id: I101d6b67b9349c223881080ba0bde07d4e1b2b37
diff --git a/src/verifier/method_verifier.cc b/src/verifier/method_verifier.cc
index 60b17d6..18078d2 100644
--- a/src/verifier/method_verifier.cc
+++ b/src/verifier/method_verifier.cc
@@ -2585,20 +2585,20 @@
if (is_super) {
DCHECK(method_type == METHOD_VIRTUAL);
const RegType& super = GetDeclaringClass().GetSuperClass(®_types_);
+ if (super.IsConflict()) { // unknown super class
+ Fail(VERIFY_ERROR_NO_METHOD) << "unknown super class in invoke-super from "
+ << PrettyMethod(method_idx_, *dex_file_)
+ << " to super " << PrettyMethod(res_method);
+ return NULL;
+ }
Class* super_klass = super.GetClass();
if (res_method->GetMethodIndex() >= super_klass->GetVTable()->GetLength()) {
- if (super.IsConflict()) { // Only Object has no super class
- Fail(VERIFY_ERROR_NO_METHOD) << "invalid invoke-super from "
- << PrettyMethod(method_idx_, *dex_file_)
- << " to super " << PrettyMethod(res_method);
- } else {
- MethodHelper mh(res_method);
- Fail(VERIFY_ERROR_NO_METHOD) << "invalid invoke-super from "
- << PrettyMethod(method_idx_, *dex_file_)
- << " to super " << super
- << "." << mh.GetName()
- << mh.GetSignature();
- }
+ MethodHelper mh(res_method);
+ Fail(VERIFY_ERROR_NO_METHOD) << "invalid invoke-super from "
+ << PrettyMethod(method_idx_, *dex_file_)
+ << " to super " << super
+ << "." << mh.GetName()
+ << mh.GetSignature();
return NULL;
}
}