[Kde-java] Re: polish( )

David Goodenough david.goodenough at btconnect.com
Wed Oct 13 16:47:33 CEST 2004


On Wednesday 13 October 2004 14:59, Richard Dale wrote:
> On Wednesday 13 October 2004 13:53, David Goodenough wrote:
> > On Wednesday 13 October 2004 11:00, David Goodenough wrote:
> > <snip.>
> >
> > > > Yes, please try building the KDE_3_3_BRANCH and see if you have the
> > > > same problem. I hope you don't mind me cc'ing this to the kde-java
> > > > list.. The project really needs someone other than myself to be able
> > > > to sort out problems like this.
> > > >
> > > > -- Richard
> > >
> > > OK, I downloaded and compiled the qt/kdejava bits of kdebindings
> > > _BRANCH and it seems to compile and link cleanly on my machine.  I
> > > smell tool version problems.
>
> The annoying thing is I can compile the version in the HEAD branch, using
> the same automake/autoconf. I've tried making clean, rerunning configure
> and 'make -f Makefile.cvs' etc, and still can't get it to link.
>
> > > The sequence I used to download and compile was:-
> > >
> > > #!/bin/bash
> > > set -x
> > >
> > > export CVSROOT=:pserver:anonymous at anoncvs.kde.org:/home/kde
> > > cvs login
> > > cvs co -l -r KDE_3_3_BRANCH kdebindings
> > > cvs co -r KDE_3_3_BRANCH kdebindings/qtjava
> > > cvs co -r KDE_3_3_BRANCH kdebindings/kdejava
> > > cvs co -r KDE_3_3_BRANCH kde-common
> > > cvs co -r KDE_3_3_BRANCH kdebindings/dcopc
> > > cd kdebindings
> > > ln -s ../kde-common/admin ./admin
> > > make -f Makefile.cvs
> > > /configure
> > > make
>
> It seems it's just me who can't get it to build - whether it works or not
> is the other issue..
>
> > > I am running Debian Sid, last updated about a week ago.
> > >
> > > I did notice a few warnings wizzing past on the console, and there
> > > may have been a few I missed when doing other things.  I will repeat
> > > the excercise redirecting output and see if I can track those down, but
> > > they were only warnings (otherwise the make would have stopped).  But I
> > > never quite trust compilers to be entirely honest about the level of
> > > errors, so I will look to see if I can produce patches to get rid of
> > > them too.
>
> OK thanks - considering how much code is generated, there are reasonably
> few of them.
>
> > > Regards
> > >
> > > David
> >
> > Having redone the compile and extracted the warnings, here is the list
> > grouped by type of problem:-
> >
> > Firstly, cast from pointer to integer of different size.
> >
> > QWidget.cpp: In function `jlong
> > Java_org_kde_qt_QWidget_paintDevice(JNIEnv*, _jobject*)':
> > QWidget.cpp:2728: warning: cast from pointer to integer of different size
> > qtjava.cpp: In function `_jclass*
> >    Java_org_kde_qt_qtjava_classFromQtMetaData(JNIEnv*, _jclass*,
> > _jclass*, _jstring*, long long int)':
> > qtjava.cpp:42: warning: cast to pointer from integer of different size
> > qtjava.cpp: In function `void Java_org_kde_qt_qtjava_setQt(JNIEnv*,
> > _jclass*, _jobject*, long long int)':
> > qtjava.cpp:100: warning: cast to pointer from integer of different size
> > qtjava.cpp: In function `jlong Java_org_kde_qt_qtjava_getQt(JNIEnv*,
> > _jclass*, _jobject*)':
> > qtjava.cpp:108: warning: cast from pointer to integer of different size
> > qtjava.cpp: In function `jlong
> > Java_org_kde_qt_qtjava_newJavaSignal(JNIEnv*, _jclass*)':
> > qtjava.cpp:116: warning: cast from pointer to integer of different size
> > qtjava.cpp: In function `jlong
> > Java_org_kde_qt_qtjava_newJavaSlot(JNIEnv*, _jclass*, _jobject*,
> > _jstring*)':
> > qtjava.cpp:132: warning: cast from pointer to integer of different size
> > QPixmap.cpp: In function `jlong
> > Java_org_kde_qt_QPixmap_paintDevice(JNIEnv*, _jobject*)':
> > QPixmap.cpp:761: warning: cast from pointer to integer of different size
> > QPaintDevice.cpp: In function `jlong
> >    Java_org_kde_qt_QPaintDevice_paintDevice(JNIEnv*, _jobject*)':
> > QPaintDevice.cpp:137: warning: cast from pointer to integer of different
> > size QMimeSource.cpp: In function `jlong
> >    Java_org_kde_qt_QMimeSource_mimeSource(JNIEnv*, _jobject*)':
> > QMimeSource.cpp:51: warning: cast from pointer to integer of different
> > size QHostAddress.cpp: In function `void
> >    Java_org_kde_qt_QHostAddress_newQHostAddress__S(JNIEnv*, _jobject*,
> > short int)':
> > QHostAddress.cpp:123: warning: cast to pointer from integer of different
> > size QHostAddress.cpp: In function `void
> >    Java_org_kde_qt_QHostAddress_setAddress__S(JNIEnv*, _jobject*, short
> > int)': QHostAddress.cpp:154: warning: cast to pointer from integer of
> > different size QDropEvent.cpp: In function `jlong
> >    Java_org_kde_qt_QDropEvent_mimeSource(JNIEnv*, _jobject*)':
> > QDropEvent.cpp:197: warning: cast from pointer to integer of different
> > size QtSupport.cpp: In static member function `static bool
> >    QtSupport::eventFilterDelegate(QObject*, const char*, QObject*,
> > QEvent*)': QtSupport.cpp:158: warning: cast from pointer to integer of
> > different size QtSupport.cpp:159: warning: cast from pointer to integer
> > of different size QtSupport.cpp:161: warning: cast from pointer to
> > integer of different size QtSupport.cpp: In static member function
> > `static bool QtSupport::eventDelegate(QObject*, const char*, void*, const
> > char*)': QtSupport.cpp:200: warning: cast from pointer to integer of
> > different size QtSupport.cpp:201: warning: cast from pointer to integer
> > of different size QtSupport.cpp: In static member function `static bool
> >    QtSupport::voidDelegate(void*, const char*, const char*)':
> > QtSupport.cpp:235: warning: cast from pointer to integer of different
> > size QtSupport.cpp: In static member function `static bool
> >    QtSupport::booleanDelegate(QObject*, const char*)':
> > QtSupport.cpp:268: warning: cast from pointer to integer of different
> > size QtSupport.cpp: In static member function `static void*
> >    QtSupport::getQt(JNIEnv*, _jobject*)':
> > QtSupport.cpp:419: warning: cast to pointer from integer of different
> > size QtSupport.cpp: In static member function `static void
> > QtSupport::setQt(JNIEnv*,
> >    _jobject*, void*)':
> > QtSupport.cpp:428: warning: cast from pointer to integer of different
> > size QtSupport.cpp: In static member function `static void
> >    QtSupport::setObjectForQtKey(JNIEnv*, _jobject*, void*)':
> > QtSupport.cpp:449: warning: cast from pointer to integer of different
> > size QtSupport.cpp: In static member function `static _jobject*
> >    QtSupport::objectForQtKey(JNIEnv*, void*, const char*, bool)':
> > QtSupport.cpp:477: warning: cast from pointer to integer of different
> > size QtSupport.cpp: In static member function `static void
> >    QtSupport::qtKeyDeleted(void*)':
> > QtSupport.cpp:505: warning: cast from pointer to integer of different
> > size QtSupport.cpp: In static member function `static JavaSignal*
> >    QtSupport::signalForSender(JNIEnv*, void*, _jstring*)':
> > QtSupport.cpp:601: warning: cast from pointer to integer of different
> > size QtSupport.cpp:601: warning: cast to pointer from integer of
> > different size QtSupport.cpp: In static member function `static JavaSlot*
> >    QtSupport::slotForReceiver(JNIEnv*, _jobject*, _jstring*)':
> > QtSupport.cpp:618: warning: cast from pointer to integer of different
> > size QtSupport.cpp:618: warning: cast to pointer from integer of
> > different size QtSupport.cpp: In static member function `static
> > QPaintDevice*
> >    QtSupport::paintDevice(JNIEnv*, _jobject*)':
> > QtSupport.cpp:636: warning: cast to pointer from integer of different
> > size QtSupport.cpp: In static member function `static QMimeSource*
> >    QtSupport::mimeSource(JNIEnv*, _jobject*)':
> > QtSupport.cpp:652: warning: cast to pointer from integer of different
> > size KMD5.cpp: In function `void
> > Java_org_kde_koala_KMD5_update__S(JNIEnv*, _jobject*, short int)':
> > KMD5.cpp:158: warning: cast to pointer from integer of different size
> > KMD5.cpp: In function `void Java_org_kde_koala_KMD5_update__SI(JNIEnv*,
> >    _jobject*, short int, int)':
> > KMD5.cpp:165: warning: cast to pointer from integer of different size
> > KShred.cpp: In function `jboolean
> >    Java_org_kde_koala_KShred_fillpattern(JNIEnv*, _jobject*, short int,
> > int)': KShred.cpp:93: warning: cast to pointer from integer of different
> > size
>
> I've tried to get rid of as many warnings as possible, but I suppose these
> were the ones I gave up on.
>
> > Now some almost certainly benign unused parameters or variables.
> >
> > QPopupMenu.cpp: In function `jint
> >
> > Java_org_kde_qt_QPopupMenu_insertItem__Lorg_kde_qt_QIconSet_2Ljava_lang_S
> >tr ing_2Lorg_kde_qt_QObject_2Ljava_lang_String_2 (JNIEnv*,
> >    _jobject*, _jobject*, _jstring*, _jobject*, _jstring*)':
> > QPopupMenu.cpp:1455: warning: unused variable `QString*_qstring_text'
> > QMenuData.cpp: In function `jint
> >
> > Java_org_kde_qt_QMenuData_insertItem__Lorg_kde_qt_QIconSet_2Ljava_lang_St
> >ri ng_2Lorg_kde_qt_QObject_2Ljava_lang_String_2 (JNIEnv*,
> >    _jobject*, _jobject*, _jstring*, _jobject*, _jstring*)':
> > QMenuData.cpp:713: warning: unused variable `QString*_qstring_text'
> > QMenuBar.cpp: In function `jint
> >
> > Java_org_kde_qt_QMenuBar_insertItem__Lorg_kde_qt_QIconSet_2Ljava_lang_Str
> >in g_2Lorg_kde_qt_QObject_2Ljava_lang_String_2 (JNIEnv*,
> >    _jobject*, _jobject*, _jstring*, _jobject*, _jstring*)':
> > QMenuBar.cpp:1338: warning: unused variable `QString*_qstring_text'
> > KMainWindow.cpp: In function `_jobject*
> >    Java_org_kde_koala_KMainWindow_memberList(JNIEnv*, _jobject*)':
> > KMainWindow.cpp:1605: warning: unused parameter `_jobject*obj'
>
> That's a hand crafted special case, because the method doesn't exist in the
> original C++ api. It could use a line like '(void) obj;' to suppress the
> warning.
>
> JNIEXPORT jobject JNICALL
> Java_org_kde_koala_KMainWindow_memberList(JNIEnv* env, jobject obj)
> {
>         return (jobject) KDESupport::arrayWithKMainWindowList(env,
> KMainWindow::memberList);
> }
>
> > Comparisons between signed and unsigned ints:-
> >
> > QPointArray.cpp: In function `jboolean
> >    Java_org_kde_qt_QPointArray_putPoints__II_3S(JNIEnv*, _jobject*, int,
> > int, _jshortArray*)':
> > QPointArray.cpp:229: warning: comparison between signed and unsigned
> > integer expressions
>
> This is some handcrafted 'special casing' and so it could be fixed.
>
> > Casts between integers of different sizes:
> >
> > QHostAddress.cpp: In function `void
> >    Java_org_kde_qt_QHostAddress_newQHostAddress__S(JNIEnv*, _jobject*,
> > short int)':
> > QHostAddress.cpp:123: warning: cast to pointer from integer of different
> > size QHostAddress.cpp: In function `void
> >    Java_org_kde_qt_QHostAddress_setAddress__S(JNIEnv*, _jobject*, short
> > int)': QHostAddress.cpp:154: warning: cast to pointer from integer of
> > different size QDropEvent.cpp: In function `jlong
> >    Java_org_kde_qt_QDropEvent_mimeSource(JNIEnv*, _jobject*)':
> > QDropEvent.cpp:197: warning: cast from pointer to integer of different
> > size QDragObject.cpp: In function `jlong
> >    Java_org_kde_qt_QDragObject_mimeSource(JNIEnv*, _jobject*)':
> > QDragObject.cpp:170: warning: cast from pointer to integer of different
> > size
>
> Methods like this get generated when a class has multiple inheritance, to
> allow you to alway cast correctly to all the parents. So it's going from an
> address to a JNI jlong which is 64 bits, so it will always be big enough.
>
> JNIEXPORT jlong JNICALL
> Java_org_kde_qt_QDragObject_mimeSource(JNIEnv* env, jobject obj)
> {
>         return (jlong) (QMimeSource*) (QDragObject*) QtSupport::getQt(env,
> obj);
> }
>
> I think with the other warnings the destination is always at least as large
> as the source.
>
> > Odds and sods:-
> >
> > QJpUnicodeConv.cpp:8: warning: `class QJpUnicodeConvJBridge' has virtual
> >    functions but non-virtual destructor
> > QImage.cpp: In function `_jobject*
> > Java_org_kde_qt_QImage_jumpTable(JNIEnv*, _jobject*)':
> > QImage.cpp:341: warning: control reaches end of non-void function
> > KFileTreeViewToolTip.cpp:10: warning: `class KFileTreeViewToolTipJBridge'
> > has virtual functions but non-virtual destructor
>
> I this is a problem in the C++ code for the Qt class itself - it doesn't
> have a destructor virtual or not. So if you subclass it, you get that
> warning.
>
> > Deprecations:-
> >
> > KProgressDialog.cpp: In function `jboolean
> >    Java_org_kde_koala_KProgressDialog_allowCancel(JNIEnv*, _jobject*)':
> > KProgressDialog.cpp:441: warning: `allowCancel' is deprecated (declared
> > at /usr/include/kde/kprogress.h:262)
> > KProgressDialog.cpp: In function `_jstring*
> >    Java_org_kde_koala_KProgressDialog_buttonText(JNIEnv*, _jobject*)':
> > KProgressDialog.cpp:463: warning: `buttonText' is deprecated (declared at
> >    /usr/include/kde/kprogress.h:341)
> > KProgressDialog.cpp: In function `_jstring*
> >    Java_org_kde_koala_KProgressDialog_labelText(JNIEnv*, _jobject*)':
> > KProgressDialog.cpp:502: warning: `labelText' is deprecated (declared at
> >    /usr/include/kde/kprogress.h:239)
> > KProgressDialog.cpp: In function `jint
> >    Java_org_kde_koala_KProgressDialog_minimumDuration(JNIEnv*,
> > _jobject*)': KProgressDialog.cpp:516: warning: `minimumDuration' is
> > deprecated (declared at /usr/include/kde/kprogress.h:359)
> >
> > Now of course many of these will be benign, or just unfortunate
> > consequences of differing conventions.  But the odds and sods, in
> > particular the middle one, look worth investigating, and many of the
> > others could start to be problems with 64bit architectures and the like,
> > so I guess they need working through as well.
> >
> > As for the deprecations, I am not sure what the kde-java policy is on
> > such things?
>
> It should omit generating any code for depracated methods. I've had a look
> at the kprogress.h header, and saw this:
>
>         // ### Remove this KDE 4.0
>         int  minimumDuration() KDE_DEPRECATED;
>
>         /**
>          * Returns the wait duration in milliseconds
>          */
>         int  minimumDuration() const;
>
> So it wouldn't generate anything for the non-const minimumDuration. Here is
> the code generated:
>
> JNIEXPORT jint JNICALL
> Java_org_kde_koala_KProgressDialog_minimumDuration(JNIEnv* env, jobject
> obj) {
>  jint xret = (jint) ((KProgressDialog*) QtSupport::getQt(env,
> obj))->minimumDuration();
>  return xret;
> }
>
> I can't see how you can flag that method call to tell the C++ compiler
> you're calling the const version of the method.
>
> I'd be interested if you try out the TextEdit example that had the QAction
> slot problem and see if it loops and crashes for you as well as me.
> -- Richard
I will give it a go.  Please see my other note as there is at least one thing
that the compiler should have flagged as an error in QImage.cpp.

David


More information about the Kde-java mailing list