blob: 7dfcf8de70fceb44bdc5609df0318b18405c2ba1 [file] [log] [blame]
Stephan Herhut3600c132017-11-07 12:05:30 +01001// 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.
4package shaking;
5
6public class SubClassOne implements InterfaceWithDefault, OtherInterfaceWithDefault {
7
8 @Override
9 public void foo() {
10 System.out.println("Method foo from SubClassOne");
11 makeSubClassTwoLive().foo();
12 asOtherInterface().bar();
13 }
14
15 private OtherInterface asOtherInterface() {
16 return new SubClassTwo();
17 }
18
19 @Override
20 public void bar() {
21 System.out.println("Method bar from SubClassOne");
22 }
23
24 private InterfaceWithDefault makeSubClassTwoLive() {
25 // Once we see this method, SubClassTwo will be live. This should also make the default method
26 // in the interface live, as SubClassTwo does not override it.
27 return new SubClassTwo();
28 }
29}