ART: Reload class on miranda method in verifier
When checking the receiver of a call and we have a miranda method,
reload the class from the method index instead of using the declared
class - which is the interface class, not the abstract class.
Bug: 21646347
Change-Id: I5bceab75c3b76233cb42ea5cf0214d32c8149994
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 9faaa4a..4d88227 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -3318,7 +3318,10 @@
}
if (method_type != METHOD_INTERFACE && !actual_arg_type.IsZero()) {
const RegType* res_method_class;
- if (res_method != nullptr) {
+ // Miranda methods have the declaring interface as their declaring class, not the abstract
+ // class. It would be wrong to use this for the type check (interface type checks are
+ // postponed to runtime).
+ if (res_method != nullptr && !res_method->IsMiranda()) {
mirror::Class* klass = res_method->GetDeclaringClass();
std::string temp;
res_method_class = ®_types_.FromClass(klass->GetDescriptor(&temp), klass,