OSDN Git Service

ART: Fix IncompatibleClassChange check for ArtMethod
authorAndreas Gampe <agampe@google.com>
Tue, 26 Aug 2014 03:46:31 +0000 (20:46 -0700)
committerAndreas Gampe <agampe@google.com>
Tue, 26 Aug 2014 17:05:52 +0000 (10:05 -0700)
In case of kSuper we should complain sometimes.

Bug: 17265201

(cherry picked from commit 249907fe09afd9243c9675a67b157b98378fa3cf)

Change-Id: Ifad903a750495963c7128296713fbd7c4add71cd

runtime/mirror/art_method-inl.h

index 06700e6..58321c7 100644 (file)
@@ -163,7 +163,9 @@ inline bool ArtMethod::CheckIncompatibleClassChange(InvokeType type) {
       return IsDirect() || (methods_class->IsInterface() && !IsMiranda());
     }
     case kSuper:
-      return false;  // TODO: appropriate checks for call to super class.
+      // Constructors and static methods are called with invoke-direct.
+      // Interface methods cannot be invoked with invoke-super.
+      return IsConstructor() || IsStatic() || GetDeclaringClass()->IsInterface();
     case kInterface: {
       Class* methods_class = GetDeclaringClass();
       return IsDirect() || !(methods_class->IsInterface() || methods_class->IsObjectClass());