diff options
Diffstat (limited to 'test/162-method-resolution/src')
-rw-r--r-- | test/162-method-resolution/src/Main.java | 26 | ||||
-rw-r--r-- | test/162-method-resolution/src/Test10Interface.java | 18 |
2 files changed, 44 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 { diff --git a/test/162-method-resolution/src/Test10Interface.java b/test/162-method-resolution/src/Test10Interface.java new file mode 100644 index 0000000000..3c75ea59be --- /dev/null +++ b/test/162-method-resolution/src/Test10Interface.java @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2017 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. + */ + +public interface Test10Interface { } + |