OSDN Git Service

2007-04-03 Andrew Haley <aph@redhat.com>
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Apr 2007 10:59:45 +0000 (10:59 +0000)
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Apr 2007 10:59:45 +0000 (10:59 +0000)
        * testsuite/libjava.lang/ProxyTest.java: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123466 138bc75d-0d04-0410-961f-82ee72b054a4

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 9602e29..09b7e07 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;