(not nullable) annotation does not appear in introspection data
Context: https://github.com/gtk-rs/gir/issues/655
(not nullable)
was introduced as part of https://bugzilla.gnome.org/show_bug.cgi?id=729660 a while ago. Unfortunately it does not appear in the introspection data at all, which makes it rather useless for us.
For Rust (and I guess for all languages that have strict nullability requirements) what would be needed is to reliably know if a return value can be nullable or not.
The (nullable)
annotation is not useful for us as putting the annotation there or not makes no difference safety-wise: you always have to assume that return value is nullable as the annotation might've simply been forgotten. And getting a NULL
value that is not expected results in an error, so the safe choice is to assume nullability.
If (not nullable)
would end up as nullable="0"
in the XML file (i.e. the opposite of nullable="1"
from (nullable)
), or even as a new attribute (not-nullable="1"
?) for backwards compat with broken bindings that don't look at the value of the attribute but only its existence, we could make use of that annotation.
This was already brought up before (https://bugzilla.gnome.org/show_bug.cgi?id=729660#c22) but no action was taken.