GNOME Bugzilla – Bug 720159
move type definitions for GSimpleAction to header files
Last modified: 2013-12-11 03:44:34 UTC
I'm trying to subclass GSimpleAction in Vala, and getting an error at gcc-time. If test.vala contains: public class Test : SimpleAction {} public void main() { Test t = new Test(); (void)t; } Here's the result of trying to compile it: $ valac --save-temps --pkg gio-2.0 test.vala /home/chaz/Desktop/test.c:23:16: error: field ‘parent_instance’ has incomplete type GSimpleAction parent_instance; ^ /home/chaz/Desktop/test.c:28:2: error: unknown type name ‘GSimpleActionClass’ GSimpleActionClass parent_class; ^ error: cc exited with status 256 Compilation failed: 1 error(s), 0 warning(s) The resulting .c file appears to be correct; the problem is that the proper definitions aren't in gsimpleaction.h (or giotypes.h, not sure which) to enable something to subclass GSimpleAction in the usual way. I'd argue that it's worthy of being able to subclass: I want "the obvious simple implementation of the GAction interface", but with a bit of added behavior in the code I'm working on. It'd be a pain to have to re-implement most of GAction myself, just to make a few tweaks.
I don't think GSimpleAction is meant to be subclassed
Yeah, that's what desrt said on IRC, too. We should probably add a final keyword or some kind of annotation to vala (bug #669541), but I think this bug can be closed… taking care of #669541 should resolve this as well from Vala's POV since hopefully we'll be able to detect these cases automatically.
*** This bug has been marked as a duplicate of bug 669541 ***