Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 1 | // 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. |
| 4 | package memberrebinding; |
| 5 | |
| 6 | import memberrebinding.subpackage.PublicClass; |
| 7 | import memberrebindinglib.AnIndependentInterface; |
| 8 | |
Stephan Herhut | fd8a4de | 2017-06-09 11:06:49 +0200 | [diff] [blame] | 9 | public class Memberrebinding { |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 10 | |
| 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 Herhut | 2da874a | 2017-05-31 13:07:56 +0200 | [diff] [blame] | 26 | PublicClass.aStaticMethod(); |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 27 | 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 Adamsen | 0fb0f52 | 2019-09-03 16:16:02 +0200 | [diff] [blame] | 32 | AnIndependentInterface iface = |
| 33 | System.currentTimeMillis() >= 0 |
| 34 | ? new ClassExtendsOtherLibraryClass() |
| 35 | : new OtherClassExtendsOtherLibraryClass(); |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 36 | System.out.println(iface.aMethodThatReturnsTwo()); |
Christoffer Quist Adamsen | 0fb0f52 | 2019-09-03 16:16:02 +0200 | [diff] [blame] | 37 | SuperClassOfClassExtendsOtherLibraryClass superClass = |
| 38 | System.currentTimeMillis() >= 0 |
| 39 | ? new ClassExtendsOtherLibraryClass() |
| 40 | : new OtherClassExtendsOtherLibraryClass(); |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 41 | System.out.println(superClass.aMethodThatReturnsTrue()); |
| 42 | System.out.println(superClass.aMethodThatReturnsFalse()); |
| 43 | } |
| 44 | } |