blob: 1e782ae7474e97c663eeebdad8be32fc6ac1845f [file] [log] [blame]
Mads Ager418d1ca2017-05-22 09:35:49 +02001// Copyright (c) 2016, 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 memberrebinding;
5
6import memberrebinding.subpackage.PublicClass;
7import memberrebindinglib.AnIndependentInterface;
8
Stephan Herhutfd8a4de2017-06-09 11:06:49 +02009public class Memberrebinding {
Mads Ager418d1ca2017-05-22 09:35:49 +020010
11 public static void main(String[] args) {
12 ClassAtBottomOfChain bottomInstance = new ClassAtBottomOfChain();
13 bottomInstance.superCallsProperlyPropagate();
14 bottomInstance.methodThatCallsSuperCallsProperlyPropagateTwo();
15 bottomInstance.methodThatShadowsPrivate();
16 bottomInstance.ensureAllCalled();
17 System.out.println(bottomInstance.superField);
18 ClassExtendsLibraryClass classExtendsLibraryClass = new ClassExtendsLibraryClass();
19 classExtendsLibraryClass.methodThatAddsHelloWorld();
20 classExtendsLibraryClass.methodThatAddsHelloWorldUsingAddAll();
21 System.out.println(classExtendsLibraryClass.get(0));
22 System.out.println(classExtendsLibraryClass.get(1));
23 System.out.println(classExtendsLibraryClass.get(2));
24 PublicClass instance = new PublicClass();
25 instance.aMethod();
Stephan Herhut2da874a2017-05-31 13:07:56 +020026 PublicClass.aStaticMethod();
Mads Ager418d1ca2017-05-22 09:35:49 +020027 ClassExtendsOtherLibraryClass classExtendsOther = new ClassExtendsOtherLibraryClass();
28 System.out.println(classExtendsOther.aMethodThatReturnsOne());
29 System.out.println(classExtendsOther.aMethodThatReturnsTwo());
30 System.out.println(classExtendsOther.aMethodThatReturnsThree());
31 System.out.println(classExtendsOther.aMethodThatReturnsFour());
Christoffer Quist Adamsen0fb0f522019-09-03 16:16:02 +020032 AnIndependentInterface iface =
33 System.currentTimeMillis() >= 0
34 ? new ClassExtendsOtherLibraryClass()
35 : new OtherClassExtendsOtherLibraryClass();
Mads Ager418d1ca2017-05-22 09:35:49 +020036 System.out.println(iface.aMethodThatReturnsTwo());
Christoffer Quist Adamsen0fb0f522019-09-03 16:16:02 +020037 SuperClassOfClassExtendsOtherLibraryClass superClass =
38 System.currentTimeMillis() >= 0
39 ? new ClassExtendsOtherLibraryClass()
40 : new OtherClassExtendsOtherLibraryClass();
Mads Ager418d1ca2017-05-22 09:35:49 +020041 System.out.println(superClass.aMethodThatReturnsTrue());
42 System.out.println(superClass.aMethodThatReturnsFalse());
43 }
44}