Christoffer Quist Adamsen | 10c8a16 | 2018-06-11 09:53:03 +0200 | [diff] [blame] | 1 | // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file |
| 2 | // for details. All rights reserved. Use of this source code is governed by a |
| 3 | // BSD-style license that can be found in the LICENSE file. |
| 4 | |
| 5 | package classmerging; |
| 6 | |
| 7 | public class ConflictingInterfaceSignaturesTest { |
| 8 | |
| 9 | public static void main(String[] args) { |
| 10 | A a = new InterfaceImpl(); |
| 11 | a.foo(); |
| 12 | |
| 13 | B b = new InterfaceImpl(); |
| 14 | b.foo(); |
Christoffer Quist Adamsen | bfdbe60 | 2019-10-18 12:03:31 +0200 | [diff] [blame] | 15 | |
| 16 | // Ensure that the instantiations are not dead code eliminated. |
| 17 | escape(a); |
| 18 | escape(b); |
| 19 | } |
| 20 | |
| 21 | @NeverInline |
| 22 | static void escape(Object o) { |
| 23 | if (System.currentTimeMillis() < 0) { |
| 24 | System.out.println(o); |
| 25 | } |
Christoffer Quist Adamsen | 10c8a16 | 2018-06-11 09:53:03 +0200 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | public interface A { |
| 29 | void foo(); |
| 30 | } |
| 31 | |
| 32 | public interface B { |
| 33 | void foo(); |
| 34 | } |
| 35 | |
| 36 | public static final class InterfaceImpl implements A, B { |
| 37 | |
| 38 | @Override |
| 39 | public void foo() { |
| 40 | System.out.println("In foo on InterfaceImpl"); |
| 41 | } |
| 42 | } |
| 43 | } |