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

Gert-Jan van der Heiden g.j.vanderheiden at genimen.com
Thu Aug 21 14:41:12 CEST 2003


On Thursday 21 August 2003 10:36, Richard Dale wrote:
> On Thursday 21 August 2003 08:05, Gert-Jan van der Heiden wrote:
> > On Wednesday 20 August 2003 05:36, Richard Dale wrote:
> > > I've got kalyptus correctly auto-generating the QtJava sources so that
> > > they compile without error, all 60000 lines! So there shouldn't be any
> > > need to put the autogenerated code in the cvs anymore, it can be
> > > generated on demand.
> >
> > That is good news
> >
> > > Here are the build instructions from the README file, to try it out:
> > >
> > > A Java SMOKE adaptor based on Dynamic Proxies
> > >
> > > * Copy kalyptusCxxToJava.pm and kalyptusDataDict.pm to
> > > ...
> >
> > Can this be done based on the latest stable KDE release (3.1.3) ? I see
> > no reason why it shouldn't. I'm going to try it.
>
> I've only used the Qt headers, it should work with any version of Qt 3.x -
> I haven't considered KDE code generation yet. It still doesn't do a lot, so
> I don't want to oversell it - more it proves that the idea of using Proxies
> will work. It should take about a couple of weeks to redo the QtJava
> runtime to work with SMOKE. It will be ready for KDE 3.2 I think.

Yes, I saw SmokeInvocation. Guess the translation from Java to C++ is missing 
too? And of course the "callbacks" (slots / signals and virtual methods).


> I'll check any changes into the HEAD branch, and I assume KDE 3.1.3 is
> based on the KDE_3_1_BRANCH so any fixes for the old style java bindings
> could go in there. I didn't even realise there was a KDE 3.1.3 release - I
> hope the bindings for that built ok.

Well, I just compiled kalyptus with kdebindings-3.1.3 (and current CVS 
version). That went ok, using JDK 1.4.2.  

I tried to compile and run it with GCJ, that didn't went so well... 

$ gcj --version
gcj (GCC) 3.3 20030226 (prerelease) (SuSE Linux)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcj qt/Doit.java qt/QFont.java qt/SmokeInvocation.java \
   qt/QtSupport.java qt/Qt.java  -o doit --main=qt.Doit
$ ./doit

java.lang.InternalError: Unexpected: 
java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Proxy$ClassFactory.generate(java.lang.ClassLoader) 
(/usr/lib/libgcj.so.4.0.0)
   at java.lang.reflect.Proxy.getProxyClass(java.lang.ClassLoader, 
java.lang.Class[]) (/usr/lib/libgcj.so.4.0.0)
   at java.lang.reflect.Proxy.newProxyInstance(java.lang.ClassLoader, 
java.lang.Class[], java.lang.reflect.InvocationHandler) 
(/usr/lib/libgcj.so.4.0.0)
   at qt.QFont.<clinit>() (Unknown Source)
   at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.4.0.0)
   at _Jv_AllocObjectNoFinalizer (/usr/lib/libgcj.so.4.0.0)
   at _Jv_AllocObject (/usr/lib/libgcj.so.4.0.0)
   at qt.Doit.main(java.lang.String[]) (Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
   at _Jv_CallAnyMethodA(java.lang.Object, java.lang.Class, _Jv_Method, 
boolean, java.lang.Class[], jvalue, jvalue) (/usr/lib/libgcj.so.4.0.0)
   at _Jv_CallAnyMethodA(java.lang.Object, java.lang.Class, _Jv_Method, 
boolean, java.lang.Class[], java.lang.Object[]) (/usr/lib/libgcj.so.4.0.0)
   at java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) 
(/usr/lib/libgcj.so.4.0.0)
   at java.lang.reflect.Proxy$ClassFactory.generate(java.lang.ClassLoader) 
(/usr/lib/libgcj.so.4.0.0)
   ...7 more
Caused by: java.lang.IncompatibleClassChangeError: $Proxy0
   at _Jv_ClassReader.checkImplements(java.lang.Class, java.lang.Class) 
(/usr/lib/libgcj.so.4.0.0)
   at _Jv_ClassReader.handleInterface(int, int) (/usr/lib/libgcj.so.4.0.0)
   at _Jv_ClassReader.parse() (/usr/lib/libgcj.so.4.0.0)
   at _Jv_DefineClass(java.lang.Class, byte[], int, int) 
(/usr/lib/libgcj.so.4.0.0)
   at java.lang.ClassLoader.defineClass0(java.lang.String, byte[], int, int, 
java.security.ProtectionDomain) (/usr/lib/libgcj.so.4.0.0)
   at java.lang.ClassLoader.defineClass(java.lang.String, byte[], int, int, 
java.security.ProtectionDomain) (/usr/lib/libgcj.so.4.0.0)
   at java.lang.ClassLoader.defineClass(java.lang.String, byte[], int, int) 
(/usr/lib/libgcj.so.4.0.0)
   at java.lang.VMClassLoader.defineClass(java.lang.ClassLoader, 
java.lang.String, byte[], int, int) (/usr/lib/libgcj.so.4.0.0)
   at _Jv_CallAnyMethodA(java.lang.Object, java.lang.Class, _Jv_Method, 
boolean, java.lang.Class[], jvalue, jvalue) (/usr/lib/libgcj.so.4.0.0)
   ...10 more

I changed the classloader statement as Marco Ladermann stated, no change.

Then I declared QFontProtectedInterface  public 
(protected interfaceProtected QFontProtectedInterface to
public interfaceProtected QFontProtectedInterface ) .

This familiar output appeared:

$ ./doit
SmokeInvocation()
SmokeInvocation(obj)
SmokeInvocation.invoke: public abstract void 
qt.QFont$QFontProtectedInterface.newQFont()
SmokeInvocation.invoke: public abstract void 
qt.QFont$QFontPublicInterface.setPointSize(int)
SmokeInvocation.invoke: public abstract java.lang.String 
qt.QFont$QFontPublicInterface.substitute(java.lang.String)


Though my compiler isn't a official release, I 3.3 is released in may, and 
early this month (8 aug) 3.3.1 is released.

GJ




More information about the Kde-java mailing list