After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 667668 - Can't create a generic interface implemented by non generic using GLib.Valuie
Can't create a generic interface implemented by non generic using GLib.Valuie
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Objects
0.14.x
Other Linux
: High major
: ---
Assigned To: Vala maintainers
Vala maintainers
rejects-valid
: 596549 (view as bug list)
Depends on:
Blocks: 589521
 
 
Reported: 2012-01-11 00:46 UTC by Daniel Espinosa
Modified: 2012-01-24 13:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allow specialization of generic properties (2.67 KB, patch)
2012-01-11 17:17 UTC, Luca Bruno
rejected Details | Review

Description Daniel Espinosa 2012-01-11 00:46:36 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/
Comment 1 Luca Bruno 2012-01-11 09:30:18 UTC
It must be public Value? @value not public G @value.
Comment 2 Daniel Espinosa 2012-01-11 15:08:19 UTC
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?.
Comment 3 Luca Bruno 2012-01-11 17:17:58 UTC
Created attachment 205033 [details] [review]
Allow specialization of generic properties

Fixes bug 667668.
Comment 4 Daniel Espinosa 2012-01-12 01:11:28 UTC
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.
Comment 5 Daniel Espinosa 2012-01-18 17:45:50 UTC
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.
Comment 6 Luca Bruno 2012-01-18 17:47:49 UTC
Review of attachment 205033 [details] [review]:

It must be reviewed by the project leader, neither me nor you :-) Thanks for testing.
Comment 7 Luca Bruno 2012-01-18 18:03:33 UTC
Duplicate bug 596549 . Not merging due to different patches.
Comment 8 Daniel Espinosa 2012-01-18 19:02:50 UTC
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.
Comment 9 Luca Bruno 2012-01-24 10:16:52 UTC
Review of attachment 205033 [details] [review]:

Has to be rewritten by creating a Property.compatible similar to Method.compatible
Comment 10 Luca Bruno 2012-01-24 10:17:45 UTC
*** Bug 596549 has been marked as a duplicate of this bug. ***
Comment 11 Luca Bruno 2012-01-24 13:48:58 UTC
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.