diff options
| author | 2017-06-21 18:58:22 +0000 | |
|---|---|---|
| committer | 2017-06-21 18:58:23 +0000 | |
| commit | b96ed2c271a56fb8be0c8f30231710095e66a201 (patch) | |
| tree | 38727efb2657a5292bab738be77bd68617b6cc0e /test/138-duplicate-classes-check/src-art/Main.java | |
| parent | 2603bcd380ee782f475798a1d17d6780dfbcf73e (diff) | |
| parent | 1c843e9caf5a5e3b73275fc4845d4bdbc8f3a03a (diff) | |
Merge "test: enable javac/dx to import libcore on the bootclasspath"
Diffstat (limited to 'test/138-duplicate-classes-check/src-art/Main.java')
| -rw-r--r-- | test/138-duplicate-classes-check/src-art/Main.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/138-duplicate-classes-check/src-art/Main.java b/test/138-duplicate-classes-check/src-art/Main.java new file mode 100644 index 0000000000..b32f0bcc46 --- /dev/null +++ b/test/138-duplicate-classes-check/src-art/Main.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import dalvik.system.DexClassLoader; +import java.io.File; +import java.lang.reflect.Method; + +/** + * Structural hazard test. + */ +public class Main { + public static void main(String[] args) { + new Main().run(); + } + + private void run() { + System.out.println(new A().i); + + // Now run the class from the -ex file. + + String dexPath = System.getenv("DEX_LOCATION") + "/138-duplicate-classes-check-ex.jar"; + String optimizedDirectory = System.getenv("DEX_LOCATION"); + String librarySearchPath = null; + DexClassLoader loader = new DexClassLoader(dexPath, optimizedDirectory, librarySearchPath, + getClass().getClassLoader()); + + try { + Class<?> testEx = loader.loadClass("TestEx"); + Method test = testEx.getDeclaredMethod("test"); + test.invoke(null); + } catch (Exception exc) { + exc.printStackTrace(System.out); + } + } +} |