www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - interface of super class not implemented

reply Ant <duitoolkit yahoo.ca> writes:
I still have this problem from 2 months ago.

I realize I have to reproduce this on a small example,
but I can't do it (I'll keep trying).

This might be an error on my code but I can't see that either.

class GC (for graphic context)
extends class ObjectG 
that implements interface OGTK.
class ObjectG contains the methods gtk (public).

GC and ObjectG are in different packages.


workaround:
past the missing method to all the offending classes
(start with the higher level classes as subclasses will 
inherit the method - as they all should on the first place)

this is a real but even if only a bad compiler message (I doubt that)
it should be on your bug list as people will crash into it when
more complex project are being created.

Ant

################################################


I have 1400 lines like:

ddi/GC.d(61): class GC 1interface function OGTK.gtk is not implemented
ddi/GC.d(61): class GC 1interface function OGTK.gtk is not implemented
ddi/GC.d(61): class GC 1interface function OGTK.gtk is not implemented
ddi/Screen.d(66): class Screen 1interface function OGTK.gtk is not implemented
ddi/Screen.d(66): class Screen 1interface function OGTK.gtk is not implemented
ddi/Screen.d(66): class Screen 1interface function OGTK.gtk is not implemented
ddi/Visual.d(59): class Visual 1interface function OGTK.gtk is not implemented
ddi/Visual.d(59): class Visual 1interface function OGTK.gtk is not implemented
ddi/Visual.d(59): class Visual 1interface function OGTK.gtk is not implemented
dui/AccelGroup.d(59): class AccelGroup 1interface function OGTK.gtk is not
implemented

none of those classes declares to implement the interface
or is missing the method (as far as I can tell, you see 1400 lines...)

just adding or removing "private import ddi.Pixbuf;"
to class ddi.Value body makes the compiler produce or not those 1400
errors.
(it's not a typo it one thousand and four hundred lines)
Sep 15 2004
next sibling parent reply J C Calvarese <jcc7 cox.net> writes:
Ant wrote:
 I still have this problem from 2 months ago.
 
 I realize I have to reproduce this on a small example,
 but I can't do it (I'll keep trying).

If you post a complete set of code that produces the error, I'll take a stab at cutting it down this weekend. If it's big it might be best to either upload it to a website or e-mail it to me.
 
 This might be an error on my code but I can't see that either.
 
 class GC (for graphic context)
 extends class ObjectG 
 that implements interface OGTK.
 class ObjectG contains the methods gtk (public).
 
 GC and ObjectG are in different packages.
 
 
 workaround:
 past the missing method to all the offending classes
 (start with the higher level classes as subclasses will 
 inherit the method - as they all should on the first place)
 
 this is a real but even if only a bad compiler message (I doubt that)
 it should be on your bug list as people will crash into it when
 more complex project are being created.
 
 Ant
 
 ################################################
 
 
 I have 1400 lines like:
 
 ddi/GC.d(61): class GC 1interface function OGTK.gtk is not implemented
 ddi/GC.d(61): class GC 1interface function OGTK.gtk is not implemented
 ddi/GC.d(61): class GC 1interface function OGTK.gtk is not implemented
 ddi/Screen.d(66): class Screen 1interface function OGTK.gtk is not implemented
 ddi/Screen.d(66): class Screen 1interface function OGTK.gtk is not implemented
 ddi/Screen.d(66): class Screen 1interface function OGTK.gtk is not implemented
 ddi/Visual.d(59): class Visual 1interface function OGTK.gtk is not implemented
 ddi/Visual.d(59): class Visual 1interface function OGTK.gtk is not implemented
 ddi/Visual.d(59): class Visual 1interface function OGTK.gtk is not implemented
 dui/AccelGroup.d(59): class AccelGroup 1interface function OGTK.gtk is not
 implemented
 
 none of those classes declares to implement the interface
 or is missing the method (as far as I can tell, you see 1400 lines...)
 
 just adding or removing "private import ddi.Pixbuf;"
 to class ddi.Value body makes the compiler produce or not those 1400
 errors.
 (it's not a typo it one thousand and four hundred lines)

-- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Sep 15 2004
parent Ant <duitoolkit yahoo.ca> writes:
On Wed, 15 Sep 2004 23:41:30 -0500, J C Calvarese wrote:

 Ant wrote:
 I still have this problem from 2 months ago.
 
 I realize I have to reproduce this on a small example,
 but I can't do it (I'll keep trying).

If you post a complete set of code that produces the error, I'll take a stab at cutting it down this weekend. If it's big it might be best to either upload it to a website or e-mail it to me.

replied by email. Ant
Sep 15 2004
prev sibling next sibling parent reply Derek Parnell <derek psych.ward> writes:
On Thu, 16 Sep 2004 00:17:05 -0400, Ant wrote:

 I still have this problem from 2 months ago.
 
 I realize I have to reproduce this on a small example,
 but I can't do it (I'll keep trying).
 
 This might be an error on my code but I can't see that either.
 
 class GC (for graphic context)
 extends class ObjectG 
 that implements interface OGTK.
 class ObjectG contains the methods gtk (public).
 
 GC and ObjectG are in different packages.
 
 workaround:
 past the missing method to all the offending classes
 (start with the higher level classes as subclasses will 
 inherit the method - as they all should on the first place)
 
 this is a real but even if only a bad compiler message (I doubt that)
 it should be on your bug list as people will crash into it when
 more complex project are being created.
 
 Ant
 
 ################################################
 
 I have 1400 lines like:
 
 ddi/GC.d(61): class GC 1interface function OGTK.gtk is not implemented
 ddi/GC.d(61): class GC 1interface function OGTK.gtk is not implemented
 ddi/GC.d(61): class GC 1interface function OGTK.gtk is not implemented
 ddi/Screen.d(66): class Screen 1interface function OGTK.gtk is not implemented
 ddi/Screen.d(66): class Screen 1interface function OGTK.gtk is not implemented
 ddi/Screen.d(66): class Screen 1interface function OGTK.gtk is not implemented
 ddi/Visual.d(59): class Visual 1interface function OGTK.gtk is not implemented
 ddi/Visual.d(59): class Visual 1interface function OGTK.gtk is not implemented
 ddi/Visual.d(59): class Visual 1interface function OGTK.gtk is not implemented
 dui/AccelGroup.d(59): class AccelGroup 1interface function OGTK.gtk is not
 implemented
 
 none of those classes declares to implement the interface
 or is missing the method (as far as I can tell, you see 1400 lines...)
 
 just adding or removing "private import ddi.Pixbuf;"
 to class ddi.Value body makes the compiler produce or not those 1400
 errors.
 (it's not a typo it one thousand and four hundred lines)

I can get the same error if I have ... # class GC: ObjectG, OGTK and do not define gtk() inside the definition of GC. Are you saying that in your definition of GC it does *not* mention OGTK? If I remove the reference to OGTK, or define gtk(), then the error message goes away. From the D docs ... " A reimplemented interface must implement all the interface functions, it does not inherit them from a super class: interface D { int foo(); } class A : D { int foo() { return 1; } } class B : A, D { }// error, no foo() for interface D " -- Derek Melbourne, Australia 16/Sep/04 3:39:51 PM
Sep 15 2004
parent Ant <Ant_member pathlink.com> writes:
In article <cib9c9$25kc$1 digitaldaemon.com>, Derek Parnell says...
On Thu, 16 Sep 2004 00:17:05 -0400, Ant wrote:

 I still have this problem from 2 months ago.

I can get the same error if I have ... # class GC: ObjectG, OGTK

but the definition is like: (package dui) interface OGKT { void* gtk();} (package dui) class ObjectG : OGTK { void* gtk(){return gtkO;} } (package ddi) class GC : ObjetG { ... } and the errors show up if I do "import ddi.Pixbuf;" on class ddi.Value either at module or class level. this is DUI and basically ObjectG is the base class for every thing.
and do not define gtk() inside the definition of GC. Are you saying that in
your definition of GC it does *not* mention OGTK?

yep, no mention to OGTK except on ObjectG.
If I remove the reference to OGTK, or define gtk(), then the error message
goes away.

I can't reproduce this in a small example either.
From the D docs ...
"
A reimplemented interface must implement all the interface functions, it
does not inherit them from a super class: 

we all know that, I mean, all but the compiler ;) Ant
Sep 16 2004
prev sibling next sibling parent Ant <duitoolkit yahoo.ca> writes:
On Thu, 16 Sep 2004 00:17:05 -0400, Ant wrote:

 I still have this problem from 2 months ago.

...
 workaround:
 past the missing method to all the offending classes
 (start with the higher level classes as subclasses will 
 inherit the method - as they all should on the first place)

the workaround doesn't work: after that workaround all DUI applications will segfault. gdb will trace it to a method that is never called (on the source, obviously the executable calls it). Again, this might be some bug on my code that manifests it self on special circuntances - very, very special ... so, undo the work around and don't import Pixbuf on Value. things work again! (how can that be my code?) Lets summarize it: (this is DUI, linux, dmd 0.101) 1 - adding import ddi.Pixbuf to ddi.Value - fails to compile on other classes with interface not implmented, but interface is implmented on the parent class and not mentioned on the subclasses 2 - add the 'missing' methods to the classes - compiles but produces bogus code and segfaults 3 - remove import ddi.Pixbuf but leave the unnecessary methods that override the interface implementation on the super - compiles and runs 4 - back to the original code (no import and no override on interface implementations) - compiles and runs Ant
Sep 16 2004
prev sibling parent Ant <duitoolkit yahoo.ca> writes:
Here are 2 quick gdb sessions, one with the buggy code
the other with the same (source) code but correct executable.
My idea was to eliminate the possibility of this being
a but introduced by my code, not the compiler or linker.
I think this proves it.

the conclusion first:

the (modified) source for the widget constructor:

	this(GtkObject* gtkObject)
	{
		super(gtkObject);
		this.gtkWidget = cast(GtkWidget*)gtkObject;
		show();
	}


on he good version
call   *0x164(%edx) calls show() _D3dui6Widget6Widget4showFZv
as it should:

on the bad version 
call   *0xd0(%edx) calls addOnMotionNotify
that is not in the widget constructor source code.

This, seems to me, demonstrates that the problem was generated
by the compiler or the linker, not the programer.
and that eliminates the first doubt we could have about this bug.
(we had this doubt because the bug wasn't yet reproduced
on a small simple example)

now to create a simple example that reproduces the problem. :(

Ant

#######################

$ gdb ./HelloWorld
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) run
Starting program: /home/ruimt/devel/D/DUI/HelloWorld 
[New Thread 16384 (LWP 778)]
Widget.this(GtkWidget) 

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 778)]
0x000003e8 in ?? ()
(gdb) bt
#0  0x000003e8 in ?? ()
#1  0x0807048b in _D3dui6Widget6Widget20translateCoordinatesFC3dui6Widget6WidgetC3dui6W
dget6WidgetiiPiPiZb ()
#2  0x0807048b in _D3dui6Widget6Widget20translateCoordinatesFC3dui6Widget6WidgetC3dui6W
dget6WidgetiiPiPiZb ()
#3  0x0806fa7d in _D3dui6Widget6Widget6resizeFZv ()
#4  0x08070de7 in _D5event12EventHandler58EventHandler_C3dui6Widget6WidgetC5event5Event11EventMotion12EventHandler11opAddAssignFDFC3dui6Widget6WidgetC5event5Ev
nt11EventMotionZbZv ()
#5  0x0806e868 in _D3dui6Widget6Widget17addOnMotionNotifyFDFC3dui6Widget6WidgetC5event5Ev
nt11EventMotionZbZv ()
#6  0x0806e705 in _D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObject
C3dui6Widget6Widget ()
#7  0x0806f3a7 in _D3dui6Widget6Widget5_ctorFPS3def5Types9GtkWidget
C3dui6Widget6Widget ()
#8  0x0806c9c1 in _D3dui9Container9Container5_ctorFPS3def5Types9GtkWidgetZC3dui
Container9Container ()
#9  0x0806c949 in _D3dui3Bin3Bin5_ctorFPS3def5Types9GtkWidgetZC3dui3Bin3Bin ()
#10 0x08071f0d in _D3dui6Window6Window5_ctorFPS3def5Types9GtkWidget
C3dui6Window6Window ()
#11 0x08071f74 in _D3dui6Window6Window5_ctorFZC3dui6Window6Window ()
#12 0x08072066 in _D3dui6Window6Window5_ctorFC4dool6String6String
C3dui6Window6Window ()
---Type <return> to continue, or q <return> to quit---
#13 0x0806dc2d in _D3dui10MainWindow10MainWindow5_ctorFC4dool6String6StringZC3dui10Ma
nWindow10MainWindow ()
#14 0x0806dc07 in _D3dui10MainWindow10MainWindow5_ctorFAaZC3dui10Ma
nWindow10MainWindow ()
#15 0x0806c8ab in _D2hw10HelloWorld10HelloWorld5_ctorFZC2hw10He
loWorld10HelloWorld ()
#16 0x0806c92b in _Dmain ()
#17 0x080792e0 in main ()


######## bad version
(gdb) disas
Dump of assembler code for function
_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3dui6Widget6Widget:
0x0806e6e0 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3d
i6Widget6Widget+0>:   push   %ebp
0x0806e6e1 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3d
i6Widget6Widget+1>:   mov    %esp,%ebp
0x0806e6e3 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3d
i6Widget6Widget+3>:   sub    $0x4,%esp
0x0806e6e6 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3d
i6Widget6Widget+6>:   push   %ebx
0x0806e6e7 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3d
i6Widget6Widget+7>:   mov    %eax,0xfffffffc(%ebp)
0x0806e6ea <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+10>:  pushl  0x8(%ebp)
0x0806e6ed <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+13>:  call   0x806d288
<_D3dui9DUIObject9DUIObject5_ctorFPS3def5Types9GtkObjectZC3dui9DUIObject9DUIObject>
0x0806e6f2 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+18>:  mov    0x8(%ebp),%eax
0x0806e6f5 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+21>:  mov    0xfffffffc(%ebp),%ecx
0x0806e6f8 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+24>:  mov    %eax,0x78(%ecx)
---Type <return> to continue, or q <return> to quit---
0x0806e6fb <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+27>:  mov    %ecx,%eax
0x0806e6fd <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+29>:  mov    (%eax),%edx
0x0806e6ff <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+31>:  call   *0xd0(%edx)
0x0806e705 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+37>:  mov    0xfffffffc(%ebp),%ebx
0x0806e708 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+40>:  mov    0xfffffffc(%ebp),%eax
0x0806e70b <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+43>:  call   0x8079254 <_D9invariant12_d_invariantFC6ObjectZv>
0x0806e710 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+48>:  mov    %ebx,%eax
0x0806e712 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+50>:  pop    %ebx
0x0806e713 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+51>:  leave  
0x0806e714 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+52>:  ret    $0x4
0x0806e717 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+55>:  nop    
End of assembler dump.


######### good version
(gdb) disas
Dump of assembler code for function
_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3dui6Widget6Widget:
0x0806e6ec <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3d
i6Widget6Widget+0>:   push   %ebp
0x0806e6ed <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3d
i6Widget6Widget+1>:   mov    %esp,%ebp
0x0806e6ef <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3d
i6Widget6Widget+3>:   sub    $0x4,%esp
0x0806e6f2 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3d
i6Widget6Widget+6>:   push   %ebx
0x0806e6f3 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3d
i6Widget6Widget+7>:   mov    %eax,0xfffffffc(%ebp)
0x0806e6f6 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+10>:  pushl  0x8(%ebp)
0x0806e6f9 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+13>:  call   0x806d290
<_D3dui9DUIObject9DUIObject5_ctorFPS3def5Types9GtkObjectZC3dui9DUIObject9DUIObject>
0x0806e6fe <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+18>:  mov    0x8(%ebp),%eax
0x0806e701 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+21>:  mov    0xfffffffc(%ebp),%ecx
0x0806e704 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+24>:  mov    %eax,0x84(%ecx)
---Type <return> to continue, or q <return> to quit---
0x0806e70a <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+30>:  mov    %ecx,%eax
0x0806e70c <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+32>:  mov    (%eax),%edx
0x0806e70e <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+34>:  call   *0x164(%edx)
0x0806e714 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+40>:  mov    0xfffffffc(%ebp),%ebx
0x0806e717 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+43>:  mov    0xfffffffc(%ebp),%eax
0x0806e71a <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+46>:  call   0x80792d8 <_D9invariant12_d_invariantFC6ObjectZv>
0x0806e71f <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+51>:  mov    %ebx,%eax
0x0806e721 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+53>:  pop    %ebx
0x0806e722 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+54>:  leave  
0x0806e723 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+55>:  ret    $0x4
0x0806e726 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+58>:  nop    
0x0806e727 <_D3dui6Widget6Widget5_ctorFPS3def5Types9GtkObjectZC3du
6Widget6Widget+59>:  nop    
End of assembler dump.

#####
Sep 17 2004