diff options
-rw-r--r-- | test/044-proxy/expected.txt | 1 | ||||
-rw-r--r-- | test/044-proxy/src/FloatSelect.java | 43 | ||||
-rw-r--r-- | test/044-proxy/src/Main.java | 1 |
3 files changed, 45 insertions, 0 deletions
diff --git a/test/044-proxy/expected.txt b/test/044-proxy/expected.txt index 105d9296f7..bcce019457 100644 --- a/test/044-proxy/expected.txt +++ b/test/044-proxy/expected.txt @@ -92,3 +92,4 @@ Invoking foo using I1 type: 1 Invocation of public abstract java.lang.String NarrowingTest$I2.foo() Got expected exception Proxy narrowed invocation return type passed +5.8 diff --git a/test/044-proxy/src/FloatSelect.java b/test/044-proxy/src/FloatSelect.java new file mode 100644 index 0000000000..febe697818 --- /dev/null +++ b/test/044-proxy/src/FloatSelect.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2014 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.*; + +/** + * Test java.lang.reflect.Proxy + */ +public class FloatSelect { + + public interface FloatSelectI { + public float method(float a, float b); + } + + static class FloatSelectIInvoke1 implements InvocationHandler { + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + return args[1]; + } + } + + public static void main(String[] args) { + FloatSelectI proxyObject = (FloatSelectI) Proxy.newProxyInstance( + FloatSelectI.class.getClassLoader(), + new Class[] { FloatSelectI.class }, + new FloatSelectIInvoke1()); + + float floatResult = proxyObject.method(2.1f, 5.8f); + System.out.println(floatResult); + } +} diff --git a/test/044-proxy/src/Main.java b/test/044-proxy/src/Main.java index 078569f121..9580871432 100644 --- a/test/044-proxy/src/Main.java +++ b/test/044-proxy/src/Main.java @@ -27,5 +27,6 @@ public class Main { Clash4.main(null); WrappedThrow.main(null); NarrowingTest.main(null); + FloatSelect.main(null); } } |