diff options
author | 2017-08-01 09:54:49 -0700 | |
---|---|---|
committer | 2017-08-02 14:58:10 -0700 | |
commit | afb664701734c6edbea07431382ee33f1677d42b (patch) | |
tree | bd67954a08efb59e7bee75dfe46d1230abe4443b /test/162-method-resolution/src/Main.java | |
parent | 7f14c2ec37c70010d99cab6806d85018df56c555 (diff) |
Fix verifier checks on interface methods.
We were disallowing interfaces in the IsInheritedMethod even though
the function can be called with them. This could cause some failing
DCHECKS if the verifier cannot find methods in some situations.
We also fixed a small issue in the verifier where we allowed
non-public java.lang.Object methods to be considered valid for
interface dispatch.
Test: ./test.py --host -j50
Test: Compile an app with bad bytecodes (See bug)
Bug: 64158483
Bug: 64274113
Change-Id: Ia79f25be0001efc4069a411a0b34476bd0871803
Diffstat (limited to 'test/162-method-resolution/src/Main.java')
-rw-r--r-- | test/162-method-resolution/src/Main.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/162-method-resolution/src/Main.java b/test/162-method-resolution/src/Main.java index fa95aa755c..864c87850b 100644 --- a/test/162-method-resolution/src/Main.java +++ b/test/162-method-resolution/src/Main.java @@ -36,6 +36,7 @@ public class Main { test7(); test8(); test9(); + test10(); // TODO: How to test that interface method resolution returns the unique // maximally-specific non-abstract superinterface method if there is one? @@ -376,6 +377,31 @@ public class Main { invokeUserTest("Test9User2"); } + /* + * Test10 + * ----- + * Tested function: + * public class Test10Base implements Test10Interface { } + * public interface Test10Interface { } + * Tested invokes: + * invoke-interface Test10Interface.clone()Ljava/lang/Object; from Test10Caller in first dex + * TODO b/64274113 This should throw a NSME (JLS 13.4.12) but actually throws an ICCE. + * expected: Throws NoSuchMethodError (JLS 13.4.12) + * actual: Throws IncompatibleClassChangeError + * + * This test is simulating compiling Test10Interface with "public Object clone()" method, along + * with every other class. Then we delete "clone" from Test10Interface only, which under JLS + * 13.4.12 is expected to be binary incompatible and throw a NoSuchMethodError. + * + * Files: + * jasmin/Test10Base.j - implements Test10Interface + * jasmin/Test10Interface.java - defines empty interface + * jasmin/Test10User.j - invokeinterface Test10Interface.clone()Ljava/lang/Object; + */ + private static void test10() throws Exception { + invokeUserTest("Test10User"); + } + private static void invokeUserTest(String userName) throws Exception { System.out.println("Calling " + userName + ".test():"); try { |