blob: f237c2e57236c22c48c71bf1dd3f03070ba244f2 [file] [log] [blame]
Christoffer Quist Adamsen8c921222018-07-11 13:33:56 +02001// 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
5package classmerging;
6
7public class NestedDefaultInterfaceMethodsTest {
8
9 public static void main(String[] args) {
Christoffer Quist Adamsenbfdbe602019-10-18 12:03:31 +020010 C obj = new C();
11 obj.m();
12
13 // Ensure that the instantiations are not dead code eliminated.
14 escape(obj);
15 }
16
17 @NeverInline
18 static void escape(Object o) {
19 if (System.currentTimeMillis() < 0) {
20 System.out.println(o);
21 }
Christoffer Quist Adamsen8c921222018-07-11 13:33:56 +020022 }
23
24 public interface A {
25
26 default void m() {
27 System.out.println("In A.m()");
28 }
29 }
30
31 public interface B extends A {
32
33 @Override
34 default void m() {
35 System.out.println("In B.m()");
36 A.super.m();
37 }
38 }
39
40 public static class C implements B {
41
42 @Override
43 public void m() {
44 System.out.println("In C.m()");
45 B.super.m();
46 }
47 }
48}