-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.3.0
-
generic
-
generic
Name: tb29552 Date: 01/27/2000
/*
java version "1.3beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O)
Java(TM) HotSpot Client VM (build 1.3beta-O, mixed mode)
If InvocationHandler is invoked by a proxy-call to a method with 0 arguments,
then the argument list of the invoke call is null, instead of an object array of
0(zero) length.
*/
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.lang.reflect.Method;
public class Main
{
public static void main(String[] args)
throws Exception
{
// Invocationhandler
InvocationHandler handler = new InvocationHandler()
{
public Object invoke(Object proxy,
Method method,
Object[] args)
throws Throwable
{
System.out.println("This, "+args+", should be a zero length array instead");
return null;
}
};
// Create proxy
Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(),
new Class[] { Foo.class },
handler);
// Call Foo
f.doSomething();
}
interface Foo
{
public void doSomething();
}
}
(Review ID: 100408)
======================================================================