diff options
author | 2017-01-31 18:02:05 +0000 | |
---|---|---|
committer | 2017-01-31 18:02:06 +0000 | |
commit | f2042db1b41cc21cc540c5ad7d353cbe1e3a32df (patch) | |
tree | b854753aa30b6b58e72920634e59f862995ab4dd /test/938-load-transform-bcp/src-ex/TestMain.java | |
parent | 8de998e34397128596cc166ebee0a856b74fc9c2 (diff) | |
parent | 7916f20d9251773a8543f7f15d76ce21110acf96 (diff) |
Merge "Enable redefining Bootclasspath classes"
Diffstat (limited to 'test/938-load-transform-bcp/src-ex/TestMain.java')
-rw-r--r-- | test/938-load-transform-bcp/src-ex/TestMain.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/938-load-transform-bcp/src-ex/TestMain.java b/test/938-load-transform-bcp/src-ex/TestMain.java new file mode 100644 index 0000000000..3757a0f778 --- /dev/null +++ b/test/938-load-transform-bcp/src-ex/TestMain.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2017 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 java.lang.reflect.Method; +import java.util.OptionalLong; +public class TestMain { + public static void runTest() { + // This should be our redefined OptionalLong. + OptionalLong ol = OptionalLong.of(123); + try { + // OptionalLong is a class that is unlikely to be used by the time this test starts. + Method foo = OptionalLong.class.getMethod("foo"); + System.out.println("ol.foo() -> '" + (String)foo.invoke(ol) + "'"); + System.out.println("ol.toString() -> '" + ol.toString() + "'"); + } catch (Exception e) { + System.out.println( + "Exception occured (did something load OptionalLong before this test method!: " + + e.toString()); + e.printStackTrace(); + } + } +} |