GNOME Bugzilla – Bug 667668
Can't create a generic interface implemented by non generic using GLib.Valuie
Last modified: 2012-01-24 13:48:58 UTC
I have created a generic interface: public interface DbField<G> : Object { public abstract G @value { get; set; } public abstract string name { get; set; } } Then I'm trying to implement it, with no sucess, by: public class Field : Object, DbField<Value?> { private Value? val; private string _name; // DbField Interface public G @value { get { return val; } set { val = value; } } public string name { get { return _name; } set { _name = value; } } } Error messages are: Field.vala:32.3-32.22: error: Type and/or accessors of overriding property `GdaData.Field.value' do not match overridden property `GdaData.DbField.value'. public Value? @value { I've tried to use Value instead of Value? but doesn't work. Full code at: http://git.gnome.org/browse/libgda/
It must be public Value? @value not public G @value.
Sorry its my fault. I compiled with public Value? @value { but compiler doesn't like too. The error message is the one in Comment 0. As you see compiler says not that the property declaration doesn't match with @value as Value?.
Created attachment 205033 [details] [review] Allow specialization of generic properties Fixes bug 667668.
I've tested on my local repository, changing G with Value?, make check and runs with no problems. I consider attachment 205033 [details] [review] fixes this bug. I'm waiting for your commit to Vala master. Thanks a lot.
Review of attachment 205033 [details] [review]: In my local repository I patched Vala master with these and it works correctly. Now I can implement my interface using a boxed GLib.Value (GLib.Value?) and work as spected, passing all Unit Tests. For a more complete test, may be use Value? instead string a G in implementor class Bar.
Review of attachment 205033 [details] [review]: It must be reviewed by the project leader, neither me nor you :-) Thanks for testing.
Duplicate bug 596549 . Not merging due to different patches.
Libgda resent additions as Vala extensions, depends on this bug. I would like to depend on 0.14.x not 0.16, could this backported to 0.14 when fix is approved? If this is too complex or not convenient I'll depend on 0.16.
Review of attachment 205033 [details] [review]: Has to be rewritten by creating a Property.compatible similar to Method.compatible
*** Bug 596549 has been marked as a duplicate of this bug. ***
commit 556a22f808de35dbdfd510c287de1f5f3806f60a Author: Luca Bruno <lucabru@src.gnome.org> Date: Tue Jan 24 14:29:44 2012 +0100 Allow specialization of generic properties Fixes bug 667668. This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.