1 /*
2  * Copyright (C) 2008 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 java.util.HashMap;
18 
19 /**
20  * Test java.lang.reflect.Proxy
21  */
22 public class Main {
main(String[] args)23     public static void main(String[] args) {
24         ReturnsAndArgPassing.main(null);
25         BasicTest.main(null);
26         Clash.main(null);
27         Clash2.main(null);
28         Clash3.main(null);
29         Clash4.main(null);
30         WrappedThrow.main(null);
31         NarrowingTest.main(null);
32         FloatSelect.main(null);
33         NativeProxy.main(args);
34         ConstructorProxy.main();
35         OOMEOnDispatch.main(args);
36         HotProxy.main(args);
37     }
38 
39     // The following code maps from the actual proxy class names (eg $Proxy2) to their test output
40     // names (eg $PROXY_CLASS_NAME1$). This is to avoid the flaky test failures due to potentially
41     // undeterministic proxy class naming.
42 
registerProxyClassName(String proxyClassName)43     public static void registerProxyClassName(String proxyClassName) {
44         proxyClassNameMap.put(proxyClassName,
45                               "$PROXY_CLASS_NAME" + (uniqueTestProxyClassNum++) + "$");
46     }
47 
replaceProxyClassNamesForOutput(String str)48     public static String replaceProxyClassNamesForOutput(String str) {
49         for (String key : proxyClassNameMap.keySet()) {
50             str = str.replace(key, proxyClassNameMap.get(key));
51         }
52         return str;
53     }
54 
55     private static final HashMap<String, String> proxyClassNameMap = new HashMap<String, String>();
56 
57     private static int uniqueTestProxyClassNum = 0;
58 
startJit()59     static native void startJit();
stopJit()60     static native void stopJit();
waitForCompilation()61     static native void waitForCompilation();
62 }
63