blob: bd8548e372ae475ea26b03f87906d82b7093b98c [file] [log] [blame]
Nicolas Geoffray83c8e272017-01-31 14:36:37 +00001/*
2 * Copyright (C) 2017 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.Constructor;
18import java.lang.reflect.Method;
19
20public class Main {
21 static final String DEX_FILE = System.getenv("DEX_LOCATION") + "/636-wrong-static-access-ex.jar";
22
23 public static void main(String[] args) throws Exception {
24 System.loadLibrary(args[0]);
25 Class<?> pathClassLoader = Class.forName("dalvik.system.PathClassLoader");
26 if (pathClassLoader == null) {
27 throw new AssertionError("Couldn't find path class loader class");
28 }
29 Constructor<?> constructor =
30 pathClassLoader.getDeclaredConstructor(String.class, ClassLoader.class);
31 ClassLoader loader = (ClassLoader) constructor.newInstance(
32 DEX_FILE, ClassLoader.getSystemClassLoader());
33 Class<?> foo = loader.loadClass("Foo");
34 Method doTest = foo.getDeclaredMethod("doTest");
35 doTest.invoke(null);
36 }
37
38 public static native void ensureJitCompiled(Class<?> cls, String methodName);
39}