bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22890] all Java Proxy classes do not handle arguments pro


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22890] all Java Proxy classes do not handle arguments properly
Date: 16 Oct 2005 01:27:35 -0000

If I create a Proxy instance for an interface where the called methods has
arguments the actual values (instances) are missing in the argument-array of
InvocationHandler.invoke(). However the length of the array matches what I
would expect.

Here is a small test that demonstrates the problem:
import java.beans.EventHandler;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.lang.reflect.Proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class EHTest3 implements InvocationHandler {

    public static void main(String args[]) throws Exception {
        new EHTest3();
    }

    EHTest3() throws Exception {

        ActionListener al = (ActionListener)
            Proxy.newProxyInstance(ActionListener.class.getClassLoader(),
             new Class[] { ActionListener.class }, this);

        al.actionPerformed(new ActionEvent(this, 0, "GNU yourself!"));
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws
Throwable {
        System.out.println("invoke: " + method);
        System.out.println("args.length: " + args.length);
        System.out.println("args[0]: " + args[0]);

        return null;
    }

}

On JamVM 1.2.5 this will say:
invoke: public abstract void
java.awt.event.ActionListener.actionPerformed(java.awt.event.A ctionEvent)
args.length: 1
args[0]: null

But args[0] should be the ActionEvent not null. 

I am using the pure Java solution for Proxy class generation .


------- Comment #1 from from-classpath at savannah dot gnu dot org  2005-03-09 
06:05 -------
Forget about this bug. The Proxy class generator is correct it was the
ActionEvent's toString() method which it inherits from AWTEvent. It was coded
to return null when a source object is not a Component or MenuComponent. I
fixed AWTEvent already.

And hey: Thanks to this we have a nice testcase for the Proxy in mauve now :)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22890





reply via email to

[Prev in Thread] Current Thread [Next in Thread]