blob: f9513577a3f28f76ebe2a13c8d46571a60a44369 [file] [log] [blame]
Sebastien Hertz964c5c22017-05-23 15:22:23 +02001// Copyright (c) 2017, 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
Sebastien Hertzca758652017-06-16 18:18:04 +02005public class DebugInterfaceMethod {
Sebastien Hertz964c5c22017-05-23 15:22:23 +02006
Sebastien Hertz681eb292018-04-10 17:30:28 +02007 static class DefaultImpl implements InterfaceWithDefaultAndStaticMethods {
Sebastien Hertz964c5c22017-05-23 15:22:23 +02008 }
9
Sebastien Hertz681eb292018-04-10 17:30:28 +020010 static class OverrideImpl implements InterfaceWithDefaultAndStaticMethods {
Sebastien Hertz964c5c22017-05-23 15:22:23 +020011
12 @Override
13 public void doSomething(String msg) {
14 String newMsg = "OVERRIDE" + msg;
15 System.out.println(newMsg);
16 }
17 }
18
Sebastien Hertz681eb292018-04-10 17:30:28 +020019 private static void testDefaultMethod(InterfaceWithDefaultAndStaticMethods i) {
Sebastien Hertz964c5c22017-05-23 15:22:23 +020020 i.doSomething("Test");
21 }
22
Sebastien Hertzca758652017-06-16 18:18:04 +020023 private static void testStaticMethod() {
Sebastien Hertz681eb292018-04-10 17:30:28 +020024 InterfaceWithDefaultAndStaticMethods.printString("I'm a static method in interface");
Sebastien Hertzca758652017-06-16 18:18:04 +020025 }
26
Sebastien Hertz964c5c22017-05-23 15:22:23 +020027 public static void main(String[] args) {
28 testDefaultMethod(new DefaultImpl());
29 testDefaultMethod(new OverrideImpl());
Sebastien Hertzca758652017-06-16 18:18:04 +020030 testStaticMethod();
Sebastien Hertz964c5c22017-05-23 15:22:23 +020031 }
32
33}