blob: 2609e0f0275fc7a31807e9fc8ff106c3ef6fcc7a [file] [log] [blame]
Nicolas Geoffray8ccc3f52014-03-19 10:34:11 +00001/*
2 * Copyright (C) 2014 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// Note that $opt$ is a marker for the optimizing compiler to ensure
18// it does compile the method.
19
20public class Main {
21 public static void main(String[] args) {
22 Error error = null;
23 try {
24 $opt$TestInvokeStatic();
25 } catch (Error e) {
26 error = e;
27 }
28 System.out.println(error);
29 }
30
31 public static void $opt$TestInvokeStatic() {
32 printStaticMethod();
33 forceGCStaticMethod();
34 throwStaticMethod();
35 }
36
37 public static void printStaticMethod() {
38 System.out.println("In static method");
39 }
40
41 public static void forceGCStaticMethod() {
42 Runtime.getRuntime().gc();
43 Runtime.getRuntime().gc();
44 Runtime.getRuntime().gc();
45 Runtime.getRuntime().gc();
46 Runtime.getRuntime().gc();
47 Runtime.getRuntime().gc();
48 System.out.println("Forced GC");
49 }
50
51 public static void throwStaticMethod() {
52 throw new Error("Error");
53 }
54}