Port "Avoid method overriding if its super method is inaccessible" to art.
This is an art equivalent of https://android-review.googlesource.com/#/c/32480/3.
Change-Id: Ifc2cd21e7e92f596bced3eabae4d16f16f4095ef
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 990fb62..2b20aff 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -2850,7 +2850,8 @@
for (; j < actual_count; ++j) {
Method* super_method = vtable->Get(j);
super_mh.ChangeMethod(super_method);
- if (local_mh.HasSameNameAndSignature(&super_mh)) {
+ if (local_mh.HasSameNameAndSignature(&super_mh) &&
+ klass->CanAccessMember(super_method->GetDeclaringClass(), super_method->GetAccessFlags())) {
// Verify
if (super_method->IsFinal()) {
MethodHelper mh(local_method);