1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 public class Main { 18 19 public static void main(String[] args) {} 20 public static int foo = 42; 21 22 /// CHECK-START: void Main.inlinedMethod() builder (after) 23 /// CHECK: ClinitCheck 24 25 /// CHECK-START: void Main.inlinedMethod() inliner (after) 26 /// CHECK: ClinitCheck 27 /// CHECK-NOT: ClinitCheck 28 /// CHECK-NOT: InvokeStaticOrDirect 29 public void inlinedMethod() { 30 SubSub.bar(); 31 } 32 } 33 34 class Sub extends Main { 35 /// CHECK-START: void Sub.invokeSuperClass() builder (after) 36 /// CHECK-NOT: ClinitCheck 37 public void invokeSuperClass() { 38 int a = Main.foo; 39 } 40 41 /// CHECK-START: void Sub.invokeItself() builder (after) 42 /// CHECK-NOT: ClinitCheck 43 public void invokeItself() { 44 int a = foo; 45 } 46 47 /// CHECK-START: void Sub.invokeSubClass() builder (after) 48 /// CHECK: ClinitCheck 49 public void invokeSubClass() { 50 int a = SubSub.foo; 51 } 52 53 public static int foo = 42; 54 } 55 56 class SubSub { 57 public static void bar() { 58 int a = Main.foo; 59 } 60 public static int foo = 42; 61 } 62