blob: 1af30ba878fb5fd0651dda4966aca3d11184d59a [file] [log] [blame]
Andreas Gampe3c252f02016-10-27 18:25:17 -07001/*
2 * Copyright (C) 2016 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
17import java.lang.reflect.Method;
18import java.util.Arrays;
19
20public class Main {
21 public static void main(String[] args) throws Exception {
22 System.loadLibrary(args[1]);
23
24 doTest();
25 }
26
27 public static void doTest() throws Exception {
28 testMethod("java.lang.Object", "toString");
29 testMethod("java.lang.String", "charAt", int.class);
30 testMethod("java.lang.Math", "sqrt", double.class);
31 testMethod("java.util.List", "add", Object.class);
32 }
33
34 private static void testMethod(String className, String methodName, Class<?>... types)
35 throws Exception {
36 Class<?> base = Class.forName(className);
37 Method m = base.getDeclaredMethod(methodName, types);
38 String[] result = getMethodName(m);
39 System.out.println(Arrays.toString(result));
40 }
41
42 private static native String[] getMethodName(Method m);
43}