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 import other.InaccessibleClass;
18 
19 public class Main {
main(String[] args)20     public static void main(String[] args) {
21         try {
22             testNoInline();
23         } catch (IllegalAccessError e) {
24             // expected
25         }
26         testInline();
27     }
28 
29     /// CHECK-START: void Main.testNoInline() inliner (before)
30     /// CHECK: InvokeStaticOrDirect method_name:Main.$opt$noinline$testNoInline
31 
32     /// CHECK-START: void Main.testNoInline() inliner (after)
33     /// CHECK: InvokeStaticOrDirect method_name:Main.$opt$noinline$testNoInline
testNoInline()34     public static void testNoInline() {
35         $opt$noinline$testNoInline();
36     }
37 
38     /// CHECK-START: void Main.testInline() inliner (before)
39     /// CHECK: InvokeStaticOrDirect method_name:Main.$opt$inline$testInline
40 
41     /// CHECK-START: void Main.testInline() inliner (after)
42     /// CHECK-NOT: InvokeStaticOrDirect
testInline()43     public static void testInline() {
44         $opt$inline$testInline();
45     }
46 
$opt$noinline$testNoInline()47     public static boolean $opt$noinline$testNoInline() {
48         try {
49             return null instanceof InaccessibleClass;
50         } catch (IllegalAccessError e) {
51             // expected
52         }
53         return false;
54     }
55 
$opt$inline$testInline()56     public static boolean $opt$inline$testInline() {
57         return null instanceof Main;
58     }
59 }
60