[Kde-java] QtJava api via Dynamic Proxies progress - part 1

Tom Tromey tromey at redhat.com
Thu Aug 21 10:42:31 CEST 2003


>>>>> "Gert-Jan" == Gert-Jan van der Heiden <g.j.vanderheiden at 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());
  }
}


More information about the Kde-java mailing list