This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: [Kde-java] QtJava api via Dynamic Proxies progress - part 1
- From: Tom Tromey <tromey at redhat dot com>
- To: Gert-Jan van der Heiden <g dot j dot vanderheiden at genimen dot com>
- Cc: kde-java at kde dot org, java at gcc dot gnu dot org
- Date: 21 Aug 2003 09:42:31 -0600
- Subject: Re: [Kde-java] QtJava api via Dynamic Proxies progress - part 1
- References: <200308071727.10586.Richard_Dale@tipitina.demon.co.uk><200308211324.54543.Richard_Dale@tipitina.demon.co.uk><1061470014.18755.8.camel@elsschot><200308211558.45247.g.j.vanderheiden@genimen.com>
- Reply-to: tromey at redhat dot com
>>>>> "Gert-Jan" == Gert-Jan van der Heiden <g.j.vanderheiden@genimen.com> writes:
Gert-Jan> I attatched a small example (It's only 953 bytes, I hope
Gert-Jan> that's no problem for the mailinglists). I stripped a lot of
Gert-Jan> code, it compiles without external libs. It consists of 3
Gert-Jan> Java files now: Doit.java (main method), QFont.java (creates
Gert-Jan> the proxy), SmokeInvocation.java (implements
Gert-Jan> InvocationHandler).
Thanks, this helped a lot.
The appended is a small test showing what goes wrong.
This works with the bytecode interpreter because URLClassLoader
defines the package for classes it defines. However, compiled classes
don't have a Package defined for them, causing the package code in
Proxy to fail.
The simplest fix may be to change Proxy to compute the package name
itself, from the class name, rather than to go through the Package.
This won't fix the appended, but there's no guarantee that
getPackage() will return a non-null result.
I'm still looking at this, though. Maybe I'll fix the vm class
loader instead.
Tom
package qt;
public class foo
{
public interface z { };
public static void main(String[] args)
{
System.out.println(z.class.getPackage().getName());
}
}