• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 shaking2;
5 
6 public class Shaking {
callInterfaceMethod(Interface object)7   public static void callInterfaceMethod(Interface object) {
8     object.interfaceMethod4();
9     object.interfaceMethod5(1, 2, 3, 4, 5, 6, 7, 8);
10   }
11 
callAsSuperClassAndInterface(SuperClass object)12   public static void callAsSuperClassAndInterface(SuperClass object) {
13     object.interfaceMethod();
14     object.interfaceMethod2();
15     object.interfaceMethod3();
16     object.virtualMethod();
17     object.virtualMethod2(1, 2, 3, 4, 5, 6, 7, 8);
18     object.accessFields();
19     callInterfaceMethod(object);
20   }
21 
accessStaticFields()22   public static void accessStaticFields() {
23     System.out.println("StaticFields::used: " + StaticFields.used);
24     System.out.println("StaitcFields::read" +
25         " " + StaticFields.readInt +
26         " " + StaticFields.readBoolean+
27         " " + StaticFields.readByte +
28         " " + StaticFields.readChar +
29         " " + StaticFields.readObject +
30         " " + StaticFields.readShort +
31         " " + StaticFields.readDouble);
32     StaticFields.writeInt = 1;
33     StaticFields.writeBoolean = true;
34     StaticFields.writeByte = 2;
35     StaticFields.writeChar = 3;
36     StaticFields.writeObject = new Object();
37     StaticFields.writeShort = 3;
38     StaticFields.writeDouble = 3.3;
39   }
40 
main(String[] args)41   public static void main(String[] args) {
42     accessStaticFields();
43     SuperClass.staticMethod();
44     SuperClass.staticMethod2(1, 2, 3, 4, 5, 6, 7, 8);
45     SubClass1 instance1 = new SubClass1(1);
46     callAsSuperClassAndInterface(instance1);
47     instance1.virtualMethod3();
48     instance1.virtualMethod4(1, 2, 3, 4, 5, 6, 7, 8);
49     callAsSuperClassAndInterface(new SubClass1(1, 2, 3, 4, 5, 6, 7, 8));
50     SubClass2 instance2 = new SubClass2(2);
51     callAsSuperClassAndInterface(instance2);
52     instance2.virtualMethod3();
53     instance2.virtualMethod4(1, 2, 3, 4, 5, 6, 7, 8);
54   }
55 }
56