ProxyTest.java
Andrew Haley
aph@redhat.com
Tue Apr 3 10:58:00 GMT 2007
2007-04-03 Andrew Haley <aph@redhat.com>
* testsuite/libjava.lang/ProxyTest.java: New test.
Index: testsuite/libjava.lang/ProxyTest.java
===================================================================
--- testsuite/libjava.lang/ProxyTest.java (revision 0)
+++ testsuite/libjava.lang/ProxyTest.java (revision 0)
@@ -0,0 +1,37 @@
+import java.lang.reflect.*;
+
+interface Twas
+{
+ Object brillig();
+}
+
+interface Slithy
+{
+ void toves(int gyre);
+}
+
+public class ProxyTest
+{
+ static class MyInvocationHandler implements InvocationHandler
+ {
+ public Object invoke(Object proxy, Method method, Object[] args)
+ {
+ System.out.println (method.getDeclaringClass());
+ System.out.println (args == null
+ ? args
+ : args.getClass().getName());
+ return this;
+ }
+ }
+
+ public static void main(String[] argv)
+ throws InstantiationException, IllegalAccessException
+ {
+ Twas wabe
+ = (Twas)Proxy.newProxyInstance(ProxyTest.class.getClassLoader(),
+ new Class[] { Slithy.class, Twas.class },
+ new MyInvocationHandler());
+ wabe.brillig();
+ ((Slithy)wabe).toves(2);
+ }
+}
Index: testsuite/libjava.lang/ProxyTest.out
===================================================================
--- testsuite/libjava.lang/ProxyTest.out (revision 0)
+++ testsuite/libjava.lang/ProxyTest.out (revision 0)
@@ -0,0 +1,4 @@
+interface Twas
+null
+interface Slithy
+[Ljava.lang.Object;
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903
More information about the Java-patches
mailing list