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 768380 - libjson-glib-1.0: Mark serializable.find_property as nullable
libjson-glib-1.0: Mark serializable.find_property as nullable
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings
0.32.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2016-07-04 15:14 UTC by Guillaume Poirier-Morency
Modified: 2016-07-21 14:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch adding nullable metadata to 'Serializable.find_property' (1.83 KB, patch)
2016-07-04 15:14 UTC, Guillaume Poirier-Morency
none Details | Review
Patch missing out parameter on 'Serializable.default_deserialize_property' (2.28 KB, patch)
2016-07-04 15:40 UTC, Guillaume Poirier-Morency
none Details | Review
Squashed the two previously proposed patches (2.71 KB, patch)
2016-07-04 18:50 UTC, Guillaume Poirier-Morency
committed Details | Review

Description Guillaume Poirier-Morency 2016-07-04 15:14:04 UTC
Created attachment 330852 [details] [review]
Patch adding nullable metadata to 'Serializable.find_property'

As stated in the documentation: 

> the ParamSpec for the property or null if no property was found
Comment 1 Al Thomas 2016-07-04 15:29:43 UTC
Review of attachment 330852 [details] [review]:

Would it be better if the GObject Introspection annotation for json_serializable_find_property in https://github.com/ebassi/json-glib/blob/master/json-glib/json-serializable.c was changed from 

 * Return value: (transfer none): the #GParamSpec for the property

to

 * Return value: (transfer none) (nullable): the #GParamSpec for the property

Otherwise patch looks fine, although extra white space before .deserialize_property.value could be removed to maintain alignment.
Comment 2 Guillaume Poirier-Morency 2016-07-04 15:39:12 UTC
(In reply to Al Thomas from comment #1)
> Review of attachment 330852 [details] [review] [review]:
> 
> Would it be better if the GObject Introspection annotation for
> json_serializable_find_property in
> https://github.com/ebassi/json-glib/blob/master/json-glib/json-serializable.
> c was changed from 
> 
>  * Return value: (transfer none): the #GParamSpec for the property
> 
> to
> 
>  * Return value: (transfer none) (nullable): the #GParamSpec for the property
> 
> Otherwise patch looks fine, although extra white space before
> .deserialize_property.value could be removed to maintain alignment.

Sure, but that would require an upstream fix and two releases (us and them) since Vala ships the binding.

I might have other fixes too for that metadata file, so I'll include them here as well.
Comment 3 Guillaume Poirier-Morency 2016-07-04 15:40:06 UTC
Created attachment 330853 [details] [review]
Patch missing out parameter on 'Serializable.default_deserialize_property'
Comment 4 Al Thomas 2016-07-04 15:55:56 UTC
Review of attachment 330852 [details] [review]:

Updated patch submitted
Comment 5 Al Thomas 2016-07-04 16:05:04 UTC
Review of attachment 330853 [details] [review]:

The annotation for json_serializable_default_deserialize_property:

 * @value: a pointer to an uninitialized #GValue

So an out parameter is right.
Unfortunately this patch loses
-		public abstract unowned GLib.ParamSpec find_property (string name);
+		public abstract unowned GLib.ParamSpec? find_property (string name);
from the previous patch, although 
+	.find_property nullable
is included in the new patch.
Comment 6 Guillaume Poirier-Morency 2016-07-04 16:07:06 UTC
(In reply to Al Thomas from comment #5)
> Review of attachment 330853 [details] [review] [review]:
> 
> The annotation for json_serializable_default_deserialize_property:
> 
>  * @value: a pointer to an uninitialized #GValue
> 
> So an out parameter is right.
> Unfortunately this patch loses
> -		public abstract unowned GLib.ParamSpec find_property (string name);
> +		public abstract unowned GLib.ParamSpec? find_property (string name);
> from the previous patch, although 
> +	.find_property nullable
> is included in the new patch.

I'll squash them and propose a single patch instead.
Comment 7 Guillaume Poirier-Morency 2016-07-04 18:50:12 UTC
Created attachment 330863 [details] [review]
Squashed the two previously proposed patches
Comment 8 Al Thomas 2016-07-04 19:14:23 UTC
Review of attachment 330863 [details] [review]:

Looks good. Comments above have been addressed.