GNOME Bugzilla – Bug 656204
Vala does not take into account order of interfaces
Last modified: 2018-05-22 14:07:41 UTC
If the Iterable requires Traversable such code would fail: internal class Gee.ReadOnlyCollection<G> : Object, Iterable<G>, Traversable<G>, Collection<G> { As: GLib-GObject-WARNING **: cannot add interface type `GeeIterable' to type `GeeReadOnlyCollection' which does not conform to prerequisite `GeeTraversable' FAIL Fixes: 1. Require correct order 2. Impose correct order internally
Created attachment 196171 [details] [review] codegen: Add implemented interfaces with the right dependant order Fixes bug 656204.
Is there some reason this patch was never applied? I just ran into this exact same issue myself.
Review of attachment 196171 [details] [review]: The patch does not guarantee that other interfaces will be added. It needs some work in order to ONLY reorder interfaces, but NOT adding new interfaces.
I hit this as well :-(
Created attachment 285862 [details] [review] 0001: gee: Allow to sort lists
Created attachment 285863 [details] [review] 0002: Fix interface registration order
Created attachment 285864 [details] [review] 0003: Do not allow to implement the same interface multiple times
interface_registrer_order_cmp will cause problems as if a and b are not related then interface_registrer_order_cmp(a, b) = interface_registrer_order_cmp(b, a) = -1. Most sort implementations may produce garbage in such cases.
(In reply to comment #8) > interface_registrer_order_cmp will cause problems as if a and b are not related > then interface_registrer_order_cmp(a, b) = interface_registrer_order_cmp(b, a) > = -1. Most sort implementations may produce garbage in such cases. Good catch. This is not an issue in our case but as good citizen, we should change the comparator anyway. Going to replace the patch asap.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/222.