Commit 83ff0d10 by Andrew Haley Committed by Andrew Haley

ProxyTest.java: New test.

2007-04-03  Andrew Haley  <aph@redhat.com>

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

From-SVN: r123466
parent 81e864cb
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
......
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);
}
}
interface Twas
null
interface Slithy
[Ljava.lang.Object;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment