Commit 97358651 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Revert the fix for incorrect package-private overriding.

This fixes FIFA 2012, the download portion of which relies on the
old bug, without breaking instrumentation tests. The problem is that
dexopt tries to quicken method calls, and gets confused by this case
where the apparent static method resolution differs from the actual
one at runtime, depending on the targetSdkVersion of the specific app.
dexopt can't make an ahead-of-time decision in a world where the rules
might change at runtime.

Bug: 7301030
Bug: 7343420
Change-Id: Iaa15611f099546b7e54279cfd6abc9b4cdcb9812
parent ed94ff79
......@@ -2914,25 +2914,29 @@ static bool createVtable(ClassObject* clazz)
Method* superMeth = clazz->vtable[si];
if (dvmCompareMethodNamesAndProtos(localMeth, superMeth) == 0) {
if (dvmCheckMethodAccess(clazz, superMeth)) {
/* verify */
if (dvmIsFinalMethod(superMeth)) {
ALOGW("Method %s.%s overrides final %s.%s",
localMeth->clazz->descriptor, localMeth->name,
superMeth->clazz->descriptor, superMeth->name);
goto bail;
}
clazz->vtable[si] = localMeth;
localMeth->methodIndex = (u2) si;
//ALOGV("+++ override %s.%s (slot %d)",
// clazz->descriptor, localMeth->name, si);
break;
} else {
ALOGW("in older versions of dalvik, method %s.%s would have incorrectly "
"overridden package-private method with same name in %s",
// We should have an access check here, but some apps rely on us not
// checking access: http://b/7301030
bool isAccessible = dvmCheckMethodAccess(clazz, superMeth);
if (dvmIsFinalMethod(superMeth)) {
ALOGE("Method %s.%s overrides final %s.%s",
localMeth->clazz->descriptor, localMeth->name,
superMeth->clazz->descriptor, superMeth->name);
goto bail;
}
// Warn if we just spotted code relying on this bug...
if (!isAccessible) {
ALOGW("method %s.%s incorrectly overrides "
"package-private method with same name in %s",
localMeth->clazz->descriptor, localMeth->name,
superMeth->clazz->descriptor);
}
clazz->vtable[si] = localMeth;
localMeth->methodIndex = (u2) si;
//ALOGV("+++ override %s.%s (slot %d)",
// clazz->descriptor, localMeth->name, si);
break;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment