summaryrefslogtreecommitdiffstats
path: root/test/040-miranda
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-10-31 18:12:30 -0700
committerAndreas Gampe <agampe@google.com>2014-11-03 10:22:23 -0800
commit2b0fa5ba4a8f07ee243452003bf93418d30e9448 (patch)
tree3fb41e59c663ad861ea65c6032f875cf4bf406b7 /test/040-miranda
parent9a41fb1616df7e966e58cabc2abc1b5d90c9e14f (diff)
downloadart-2b0fa5ba4a8f07ee243452003bf93418d30e9448.tar.gz
art-2b0fa5ba4a8f07ee243452003bf93418d30e9448.tar.bz2
art-2b0fa5ba4a8f07ee243452003bf93418d30e9448.zip
ART: Add miranda checking
Add a test for resolution of miranda methods across dex-files. See CL 112688 and b/18193682 for the code change. Fix the test script to support no-verify again. Weaken the dex cache check to a check whether the found method is a miranda method. This will penalize miranda methods, as they will always have to be resolved by name, but does not require the multi-step load of the method's dex cache. Bug: 18193682 Change-Id: I1dae2a9ec0985dc8625acd7dd5686a5d3cdc8888
Diffstat (limited to 'test/040-miranda')
-rw-r--r--test/040-miranda/src/Main.java4
-rw-r--r--test/040-miranda/src/MirandaAbstract.java2
-rw-r--r--test/040-miranda/src/MirandaClass.java3
-rw-r--r--test/040-miranda/src/MirandaClass2.java16
4 files changed, 20 insertions, 5 deletions
diff --git a/test/040-miranda/src/Main.java b/test/040-miranda/src/Main.java
index ff5eba0a17..65f4fb4c4a 100644
--- a/test/040-miranda/src/Main.java
+++ b/test/040-miranda/src/Main.java
@@ -42,8 +42,8 @@ public class Main {
System.out.println("Test getting miranda method via reflection:");
try {
- Class mirandaClass = Class.forName("MirandaAbstract");
- Method mirandaMethod = mirandaClass.getDeclaredMethod("inInterface", (Class[]) null);
+ Class<?> mirandaClass = Class.forName("MirandaAbstract");
+ Method mirandaMethod = mirandaClass.getDeclaredMethod("inInterface");
System.out.println(" did not expect to find miranda method");
} catch (NoSuchMethodException nsme) {
System.out.println(" caught expected NoSuchMethodException");
diff --git a/test/040-miranda/src/MirandaAbstract.java b/test/040-miranda/src/MirandaAbstract.java
index 309ecca764..c8cfa3465d 100644
--- a/test/040-miranda/src/MirandaAbstract.java
+++ b/test/040-miranda/src/MirandaAbstract.java
@@ -21,6 +21,8 @@ public abstract class MirandaAbstract implements MirandaInterface, MirandaInterf
{
protected MirandaAbstract() { }
+ // These will be miranda methods, as the interfaces define them, but they are not
+ // implemented in this abstract class:
//public abstract boolean inInterface();
//public abstract int inInterface2();
diff --git a/test/040-miranda/src/MirandaClass.java b/test/040-miranda/src/MirandaClass.java
index 0d942f0c98..4160992710 100644
--- a/test/040-miranda/src/MirandaClass.java
+++ b/test/040-miranda/src/MirandaClass.java
@@ -22,17 +22,14 @@ public class MirandaClass extends MirandaAbstract {
public MirandaClass() {}
public boolean inInterface() {
- //System.out.println(" MirandaClass inInterface");
return true;
}
public int inInterface2() {
- //System.out.println(" MirandaClass inInterface2");
return 27;
}
public boolean inAbstract() {
- //System.out.println(" MirandaClass inAbstract");
return false;
}
}
diff --git a/test/040-miranda/src/MirandaClass2.java b/test/040-miranda/src/MirandaClass2.java
index e9bdf2b9ad..143eb371e6 100644
--- a/test/040-miranda/src/MirandaClass2.java
+++ b/test/040-miranda/src/MirandaClass2.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2006 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 MirandaClass2 extends MirandaAbstract {
public boolean inInterface() {
return true;