GNOME Bugzilla – Bug 553569
Interfaces won't work with inherited properties
Last modified: 2008-09-26 20:15:58 UTC
pvanhoof@tinc:/tmp/vtest$ /opt/vala/bin/valac thing.vala implementer.vala interface.vala --pkg=gee-1.0 implementer.c: In function ‘implementer_interface_interface_init’: implementer.c:44: error: ‘implementer_real_get_keywords’ undeclared (first use in this function) implementer.c:44: error: (Each undeclared identifier is reported only once implementer.c:44: error: for each function it appears in.) error: cc exited with status 256 Compilation failed: 1 error(s), 0 warning(s) pvanhoof@tinc:/tmp/vtest$ /opt/vala/bin/valac -C thing.vala implementer.vala interface.vala --pkg=gee-1.0 pvanhoof@tinc:/tmp/vtest$ cat implementer.c #include "implementer.h" #include <gee/collection.h> enum { IMPLEMENTER_DUMMY_PROPERTY }; static gpointer implementer_parent_class = NULL; static InterfaceIface* implementer_interface_parent_iface = NULL; void implementer_add_keyword (Implementer* self, const char* keyword) { g_return_if_fail (IS_IMPLEMENTER (self)); g_return_if_fail (keyword != NULL); gee_collection_add (GEE_COLLECTION (interface_get_keywords (INTERFACE (self))), keyword); } void implementer_remove_keyword (Implementer* self, const char* keyword) { g_return_if_fail (IS_IMPLEMENTER (self)); g_return_if_fail (keyword != NULL); gee_collection_remove (GEE_COLLECTION (interface_get_keywords (INTERFACE (self))), keyword); } Implementer* implementer_new (void) { Implementer * self; self = g_object_newv (TYPE_IMPLEMENTER, 0, NULL); return self; } static void implementer_class_init (ImplementerClass * klass) { implementer_parent_class = g_type_class_peek_parent (klass); } static void implementer_interface_interface_init (InterfaceIface * iface) { implementer_interface_parent_iface = g_type_interface_peek_parent (iface); iface->get_keywords = implementer_real_get_keywords; } static void implementer_instance_init (Implementer * self) { } GType implementer_get_type (void) { static GType implementer_type_id = 0; if (implementer_type_id == 0) { static const GTypeInfo g_define_type_info = { sizeof (ImplementerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) implementer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Implementer), 0, (GInstanceInitFunc) implementer_instance_init }; static const GInterfaceInfo interface_info = { (GInterfaceInitFunc) implementer_interface_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; implementer_type_id = g_type_register_static (TYPE_THING, "Implementer", &g_define_type_info, 0); g_type_add_interface_static (implementer_type_id, TYPE_INTERFACE, &interface_info); } return implementer_type_id; } pvanhoof@tinc:/tmp/vtest$ cat *vala public class Implementer : Thing, Interface { public void add_keyword (string keyword) { this.keywords.add (keyword); } public void remove_keyword (string keyword) { this.keywords.remove (keyword); } } public interface Interface { public abstract Gee.ArrayList<string> keywords { get; } } public class Thing : GLib.Object { private Gee.ArrayList<string> mkeywords = null; public Gee.ArrayList<string> keywords { get { if (mkeywords == null) mkeywords = new Gee.ArrayList<string> (GLib.str_equal); return mkeywords; } } static void main (string [] args) { } } pvanhoof@tinc:/tmp/vtest$
Created attachment 119292 [details] The .vala files
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of 548895 ***