ProxyTest.java: New test.
authorAndrew Haley <aph@redhat.com>
Tue, 3 Apr 2007 10:59:45 +0000 (10:59 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Tue, 3 Apr 2007 10:59:45 +0000 (10:59 +0000)
2007-04-03  Andrew Haley  <aph@redhat.com>

        * testsuite/libjava.lang/ProxyTest.java: New test.

From-SVN: r123466

libjava/ChangeLog
libjava/testsuite/libjava.lang/ProxyTest.jar [new file with mode: 0644]
libjava/testsuite/libjava.lang/ProxyTest.java [new file with mode: 0644]
libjava/testsuite/libjava.lang/ProxyTest.out [new file with mode: 0644]

index 9602e296f1d157b0c040bea86c3ab243efcce2c9..09b7e07183e6ffe8cbcd7860741d4c3f597c4c69 100644 (file)
@@ -1,3 +1,7 @@
+2007-04-03  Andrew Haley  <aph@redhat.com>
+
+       * testsuite/libjava.lang/ProxyTest.java: New test.
+
 2007-04-02  Tom Tromey  <tromey@redhat.com>
 
        http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=205157
diff --git a/libjava/testsuite/libjava.lang/ProxyTest.jar b/libjava/testsuite/libjava.lang/ProxyTest.jar
new file mode 100644 (file)
index 0000000..509054b
Binary files /dev/null and b/libjava/testsuite/libjava.lang/ProxyTest.jar differ
diff --git a/libjava/testsuite/libjava.lang/ProxyTest.java b/libjava/testsuite/libjava.lang/ProxyTest.java
new file mode 100644 (file)
index 0000000..46689b4
--- /dev/null
@@ -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);
+  }
+}
diff --git a/libjava/testsuite/libjava.lang/ProxyTest.out b/libjava/testsuite/libjava.lang/ProxyTest.out
new file mode 100644 (file)
index 0000000..e81ce60
--- /dev/null
@@ -0,0 +1,4 @@
+interface Twas
+null
+interface Slithy
+[Ljava.lang.Object;