diff options
author | Jeff Hao <jeffhao@google.com> | 2013-11-20 18:11:39 -0800 |
---|---|---|
committer | Jeff Hao <jeffhao@google.com> | 2013-11-21 16:51:26 -0800 |
commit | 201803fb1acd15b9daae51d816e1b08aededdc41 (patch) | |
tree | efd0abb6d93c4b7658dd70835e5e83fb4e03998f /test/040-miranda | |
parent | 9fc983e946a0d90f75e8f9f78f28f8b78a8ee9ea (diff) | |
download | art-201803fb1acd15b9daae51d816e1b08aededdc41.tar.gz art-201803fb1acd15b9daae51d816e1b08aededdc41.tar.bz2 art-201803fb1acd15b9daae51d816e1b08aededdc41.zip |
Search for miranda methods in virtual methods instead of interface.
Also added tests that get miranda methods via reflection and jni.
Miranda methods can't be found via reflection, and have the interface
class as their declaring class when found via jni.
Bug: 11736932
Change-Id: I92b4fdf31be64269898ed2686a28dfb6008b213a
Diffstat (limited to 'test/040-miranda')
-rw-r--r-- | test/040-miranda/expected.txt | 2 | ||||
-rw-r--r-- | test/040-miranda/src/Main.java | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/test/040-miranda/expected.txt b/test/040-miranda/expected.txt index e22bbd974c..011be2af86 100644 --- a/test/040-miranda/expected.txt +++ b/test/040-miranda/expected.txt @@ -10,3 +10,5 @@ MirandaAbstract / MirandaClass2: inInterface: true inInterface2: 28 inAbstract: true +Test getting miranda method via reflection: + caught expected NoSuchMethodException diff --git a/test/040-miranda/src/Main.java b/test/040-miranda/src/Main.java index 1fd8287ba0..ff5eba0a17 100644 --- a/test/040-miranda/src/Main.java +++ b/test/040-miranda/src/Main.java @@ -14,6 +14,8 @@ * limitations under the License. */ +import java.lang.reflect.Method; + /** * Miranda testing. */ @@ -37,5 +39,16 @@ public class Main { System.out.println(" inInterface: " + mira2.inInterface()); System.out.println(" inInterface2: " + mira2.inInterface2()); System.out.println(" inAbstract: " + mira2.inAbstract()); + + System.out.println("Test getting miranda method via reflection:"); + try { + Class mirandaClass = Class.forName("MirandaAbstract"); + Method mirandaMethod = mirandaClass.getDeclaredMethod("inInterface", (Class[]) null); + System.out.println(" did not expect to find miranda method"); + } catch (NoSuchMethodException nsme) { + System.out.println(" caught expected NoSuchMethodException"); + } catch (Exception e) { + System.out.println(" caught unexpected exception " + e); + } } } |