diff options
author | Andreas Gampe <agampe@google.com> | 2014-06-02 11:23:43 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-06-02 11:23:43 -0700 |
commit | 96849cec52b598b22e0a9e62d5ec37f39f9b9af5 (patch) | |
tree | 41b5602480b0227c548a6546b7027e88c9208b45 | |
parent | e4283be97047a26d3476acd3863dcc386498be17 (diff) | |
download | art-96849cec52b598b22e0a9e62d5ec37f39f9b9af5.zip art-96849cec52b598b22e0a9e62d5ec37f39f9b9af5.tar.gz art-96849cec52b598b22e0a9e62d5ec37f39f9b9af5.tar.bz2 |
ART: Add another proxy test
Change-Id: Ie5beda276a40067b7246001720cc5eea2fa7585a
-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 105d929..bcce019 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 0000000..febe697 --- /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 078569f..9580871 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); } } |