Revert "Use IsAssignableFrom instead of IsSubclass for robustness."
Not correct for Quick.
Bug:21870666
This reverts commit af268bbc4fbd0b9847acf1f7b79c038806118467.
Change-Id: Id44849cc877a42495619fd71bfd2db75159b6868
diff --git a/compiler/driver/compiler_driver-inl.h b/compiler/driver/compiler_driver-inl.h
index 09ccd28..e0c56fc 100644
--- a/compiler/driver/compiler_driver-inl.h
+++ b/compiler/driver/compiler_driver-inl.h
@@ -250,7 +250,7 @@
inline bool CompilerDriver::CanReferrerAssumeClassIsInitialized(mirror::Class* referrer_class,
mirror::Class* klass) {
- return (referrer_class != nullptr && klass->IsAssignableFrom(referrer_class)) ||
+ return (referrer_class != nullptr && referrer_class->IsSubClass(klass)) ||
CanAssumeClassIsInitialized(klass);
}
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index 501a1dd..b568f31 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -697,7 +697,7 @@
&storage_index);
}
- if (resolved_method->GetDeclaringClass()->IsAssignableFrom(referrer_class.Get())) {
+ if (referrer_class.Get()->IsSubClass(resolved_method->GetDeclaringClass())) {
// If the referrer class is the declaring class or a subclass
// of the declaring class, no class initialization is needed
// before the static method call.
diff --git a/test/511-clinit-interface/expected.txt b/test/511-clinit-interface/expected.txt
deleted file mode 100644
index ccaf6f8..0000000
--- a/test/511-clinit-interface/expected.txt
+++ /dev/null
@@ -1 +0,0 @@
-Enter
diff --git a/test/511-clinit-interface/info.txt b/test/511-clinit-interface/info.txt
deleted file mode 100644
index 1351b29..0000000
--- a/test/511-clinit-interface/info.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Test that compilers don't crash when having to compile
-an interface method.
diff --git a/test/511-clinit-interface/smali/BogusInterface.smali b/test/511-clinit-interface/smali/BogusInterface.smali
deleted file mode 100644
index 619df24..0000000
--- a/test/511-clinit-interface/smali/BogusInterface.smali
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-.class public abstract interface LBogusInterface;
-
-.super Ljava/lang/Object;
-
-.method public static <clinit>()V
- .registers 2
- invoke-static {}, LMain;->method()V
- return-void
-.end method
diff --git a/test/511-clinit-interface/src/Main.java b/test/511-clinit-interface/src/Main.java
deleted file mode 100644
index c4d0c66..0000000
--- a/test/511-clinit-interface/src/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.lang.reflect.Method;
-
-public class Main {
- public static void main(String[] args) throws Exception {
- // Workaround for b/18051191.
- System.out.println("Enter");
- Class<?> c = Class.forName("BogusInterface");
- }
-
- public static void method() {
- }
-}