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 // Simple class that holds a static int for testing that class unloading works
18 // and re-runs the class initializer.
19 public class IntHolder {
20     private static int value = 1;
21 
setValue(int newValue)22     public static void setValue(int newValue) {
23         value = newValue;
24     }
25 
getValue()26     public static int getValue() {
27         return value;
28     }
29 
runGC()30     public static void runGC() {
31         Runtime.getRuntime().gc();
32     }
33 
loadLibrary(String name)34     public static void loadLibrary(String name) {
35         System.loadLibrary(name);
36     }
37 
waitForCompilation()38     public static native void waitForCompilation();
39 
generateStackTrace()40     public static Throwable generateStackTrace() {
41       return new Exception("test");
42     }
43 }
44