From: Nicolas Geoffray Date: Fri, 2 Oct 2015 16:14:53 +0000 (+0100) Subject: Change IllegalAccess/IncompatibleClassChange order. X-Git-Tag: android-x86-7.1-r1~889^2~231^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=470d54fcd6be1aba56a4dc21f8b437168b779867;p=android-x86%2Fart.git Change IllegalAccess/IncompatibleClassChange order. This is to have the same order as ClassLinker::ResolveMethod. In a JIT environment, hitting the dex cache would not make it to the expected IllegalAccessError and we would throw the wrong exception. Change-Id: Ifc70f1a93260a24e952fa7a659be1be5bdc666de --- diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h index 8ae0b0796..f66628d7c 100644 --- a/runtime/entrypoints/entrypoint_utils-inl.h +++ b/runtime/entrypoints/entrypoint_utils-inl.h @@ -411,12 +411,6 @@ inline ArtMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object** this_ ThrowNullPointerExceptionForMethodAccess(method_idx, type); return nullptr; // Failure. } else if (access_check) { - // Incompatible class change should have been handled in resolve method. - if (UNLIKELY(resolved_method->CheckIncompatibleClassChange(type))) { - ThrowIncompatibleClassChangeError(type, resolved_method->GetInvokeType(), resolved_method, - referrer); - return nullptr; // Failure. - } mirror::Class* methods_class = resolved_method->GetDeclaringClass(); mirror::Class* referring_class = referrer->GetDeclaringClass(); bool can_access_resolved_method = @@ -426,6 +420,12 @@ inline ArtMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object** this_ DCHECK(self->IsExceptionPending()); // Throw exception and unwind. return nullptr; // Failure. } + // Incompatible class change should have been handled in resolve method. + if (UNLIKELY(resolved_method->CheckIncompatibleClassChange(type))) { + ThrowIncompatibleClassChangeError(type, resolved_method->GetInvokeType(), resolved_method, + referrer); + return nullptr; // Failure. + } } switch (type) { case kStatic: