GNOME Bugzilla – Bug 681420
warning (vala 0.17.x): access to static class members through an instance variable
Last modified: 2012-08-15 22:06:06 UTC
The newer (0.17.x, I presume) versions of valac issue these warnings (auto-upgraded to errors) when building Folks: ================= VALAC libfolks_la_vala.stamp phone-details.vala:99.16-99.35: warning: Access to static member `Folks.PhoneFieldDetails._drop_extension' with an instance reference var n1 = this._drop_extension (this.get_normalised ()); ^^^^^^^^^^^^^^^^^^^^ phone-details.vala:153.29-153.49: warning: Access to static member `Folks.PhoneFieldDetails._extension_chars' with an instance reference else if (digit in this._extension_chars || ^^^^^^^^^^^^^^^^^^^^^ phone-details.vala:154.24-154.41: warning: Access to static member `Folks.PhoneFieldDetails._valid_digits' with an instance reference digit in this._valid_digits) ^^^^^^^^^^^^^^^^^^ phone-details.vala:159.29-159.51: warning: Access to static member `Folks.PhoneFieldDetails._common_delimiters' with an instance reference else if (digit in this._common_delimiters) ^^^^^^^^^^^^^^^^^^^^^^^ phone-details.vala:100.16-100.35: warning: Access to static member `Folks.PhoneFieldDetails._drop_extension' with an instance reference var n2 = this._drop_extension (that_fd.get_normalised ()); ^^^^^^^^^^^^^^^^^^^^ backend-store.vala:459.15-459.44: warning: Access to static member `Folks.BackendStore.KEY_FILE_GROUP_ALL_OTHERS' with an instance reference this.KEY_FILE_GROUP_ALL_OTHERS, "enabled"); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ backend-store.vala:495.19-495.48: warning: Access to static member `Folks.BackendStore.KEY_FILE_GROUP_ALL_OTHERS' with an instance reference this.KEY_FILE_GROUP_ALL_OTHERS); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ backend-store.vala:322.17-322.35: warning: Access to static member `Folks.BackendStore._get_file_info' with an instance reference yield this._get_file_info (file, out is_file, out is_dir); ^^^^^^^^^^^^^^^^^^^ backend-store.vala:444.11-444.42: warning: implicit .begin is deprecated individual-aggregator.vala:747.40-747.62: warning: Access to static member `Folks.IndividualAggregator._QUIESCENT_TIMEOUT' with an instance reference Timeout.add_seconds (this._QUIESCENT_TIMEOUT, ^^^^^^^^^^^^^^^^^^^^^^^ individual-aggregator.vala:830.40-830.62: warning: Access to static member `Folks.IndividualAggregator._QUIESCENT_TIMEOUT' with an instance reference Timeout.add_seconds (this._QUIESCENT_TIMEOUT, ^^^^^^^^^^^^^^^^^^^^^^^ potential-match.vala:325.41-325.56: warning: Access to static member `Folks.PotentialMatch._SEPARATORS' with an instance reference email_split_a[0].split_set (this._SEPARATORS); ^^^^^^^^^^^^^^^^ potential-match.vala:357.49-357.64: warning: Access to static member `Folks.PotentialMatch._SEPARATORS' with an instance reference email_split_b[0].split_set (this._SEPARATORS); ^^^^^^^^^^^^^^^^ potential-match.vala:490.59-490.78: warning: Access to static member `Folks.PotentialMatch._DIST_THRESHOLD' with an instance reference return (this._jaro_dist (a_stripped, b_stripped) >= this._DIST_THRESHOLD); ^^^^^^^^^^^^^^^^^^^^ potential-match.vala:473.28-473.47: warning: Access to static member `Folks.PotentialMatch._DIST_THRESHOLD' with an instance reference return (jaro_dist >= this._DIST_THRESHOLD); ^^^^^^^^^^^^^^^^^^^^ potential-match.vala:259.25-259.44: warning: Access to static member `Folks.PotentialMatch._DIST_THRESHOLD' with an instance reference if (similarity >= this._DIST_THRESHOLD) ^^^^^^^^^^^^^^^^^^^^ individual-aggregator.vala:1855.31-1855.58: warning: Access to static member `Folks.IndividualAggregator._FOLKS_GSETTINGS_SCHEMA' with an instance reference "%s %s".printf (this._FOLKS_GSETTINGS_SCHEMA, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ individual-aggregator.vala:1856.19-1856.48: warning: Access to static member `Folks.IndividualAggregator._PRIMARY_STORE_CONFIG_KEY' with an instance reference this._PRIMARY_STORE_CONFIG_KEY)); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ individual-aggregator.vala:2189.31-2189.58: warning: Access to static member `Folks.IndividualAggregator._FOLKS_GSETTINGS_SCHEMA' with an instance reference "%s %s".printf (this._FOLKS_GSETTINGS_SCHEMA, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ individual-aggregator.vala:2190.19-2190.48: warning: Access to static member `Folks.IndividualAggregator._PRIMARY_STORE_CONFIG_KEY' with an instance reference this._PRIMARY_STORE_CONFIG_KEY)); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ individual-aggregator.vala:331.40-331.67: warning: Access to static member `Folks.IndividualAggregator._FOLKS_GSETTINGS_SCHEMA' with an instance reference var settings = new Settings (this._FOLKS_GSETTINGS_SCHEMA); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ individual-aggregator.vala:332.42-332.71: warning: Access to static member `Folks.IndividualAggregator._PRIMARY_STORE_CONFIG_KEY' with an instance reference var val = settings.get_string (this._PRIMARY_STORE_CONFIG_KEY); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ object-cache.vala:220.25-220.42: warning: Access to static member `Folks.ObjectCache._HEADER_WIDTH' with an instance reference if (data.length < this._HEADER_WIDTH) ^^^^^^^^^^^^^^^^^^ object-cache.vala:233.30-233.54: warning: Access to static member `Folks.ObjectCache._FILE_FORMAT_VERSION' with an instance reference if (wrapper_version != this._FILE_FORMAT_VERSION) ^^^^^^^^^^^^^^^^^^^^^^^^^ object-cache.vala:238.15-238.39: warning: Access to static member `Folks.ObjectCache._FILE_FORMAT_VERSION' with an instance reference this._FILE_FORMAT_VERSION); ^^^^^^^^^^^^^^^^^^^^^^^^^ object-cache.vala:244.43-244.60: warning: Access to static member `Folks.ObjectCache._HEADER_WIDTH' with an instance reference unowned uint8[] variant_data = data[this._HEADER_WIDTH:data.length]; ^^^^^^^^^^^^^^^^^^ object-cache.vala:255.15-255.39: warning: Access to static member `Folks.ObjectCache._FILE_FORMAT_VERSION' with an instance reference this._FILE_FORMAT_VERSION); ^^^^^^^^^^^^^^^^^^^^^^^^^ object-cache.vala:349.29-349.53: warning: Access to static member `Folks.ObjectCache._FILE_FORMAT_VERSION' with an instance reference var wrapper_version = this._FILE_FORMAT_VERSION; ^^^^^^^^^^^^^^^^^^^^^^^^^ object-cache.vala:364.32-364.49: warning: Access to static member `Folks.ObjectCache._HEADER_WIDTH' with an instance reference uint8[] data = new uint8[this._HEADER_WIDTH + variant.get_size ()]; ^^^^^^^^^^^^^^^^^^ object-cache.vala:367.27-367.44: warning: Access to static member `Folks.ObjectCache._HEADER_WIDTH' with an instance reference variant.store (data[this._HEADER_WIDTH:data.length]); ^^^^^^^^^^^^^^^^^^ Compilation failed: 0 error(s), 30 warning(s) make[2]: *** [libfolks_la_vala.stamp] Error 1 ====================== So, the trivial fix is to just use the class member directly for each of these cases. Thanks to erick2red on IRC for pointing this out.
Here is the important data: [ erick@archbox ~ ]$ valac --version Vala 0.17.4.9-7a746 [ erick@archbox ~ ]$ jhbuild info vala Name: vala Module Set: gnome-suites-core-deps-3.6 Type: autogen Install version: 7a74684157a0a50eca1f9c777f66bad87ef7411a Install date: 2012-08-07 10:34:12 Git Module: gnome:/vala Git Branch: master Tree-ID: 7a74684157a0a50eca1f9c777f66bad87ef7411a Sourcedir: /home/erick/Sources/stock/vala Requires: glib Required by: deja-dup, folks, libosinfo, spice-gtk, baobab, libgee-0.6, colord-gtk, shotwell, rygel, tracker, gnome-games, evolution-data-server, cheese, libvirt-glib, libgee, gnome-contacts, NetworkManager, gnome-boxes, dconf, telepathy-glib, simple-scan, vinagre, gtk-vnc, caribou
Created attachment 220711 [details] [review] Patch to fix eds backend
Created attachment 220712 [details] [review] Patch to fix key-file backend
Created attachment 220713 [details] [review] Patch to fix telepathy backend
Created attachment 220714 [details] [review] Patch to fix folks itself
Created attachment 220715 [details] [review] Patch to fix tests
Created attachment 220716 [details] [review] Patch to fix tests
Review of attachment 220711 [details] [review]: Looks good to me. Please push to master, but make sure to mention the bug URI in the commit message.
Review of attachment 220712 [details] [review]: Looks good to me. Please push to master, but make sure to mention the bug URI in the commit message.
Review of attachment 220713 [details] [review]: Looks good to me, as long as you’re confident that the ‘.begin()’ changes won’t cause problems with older Vala versions. Please push to master, but make sure to mention the bug URI in the commit message.
Review of attachment 220714 [details] [review]: Looks good to me. Please push to master, but make sure to mention the bug URI in the commit message.
Review of attachment 220715 [details] [review]: Looks good to me. Please push to master, but make sure to mention the bug URI in the commit message.
Review of attachment 220716 [details] [review]: Looks good to me. Please push to master, but make sure to mention the bug URI in the commit message (and probably also squash this into the previous commit).
Pushed to master. Commits 3687505..316c0be
Unfortunately, we missed many instances. The libsocialweb and Tracker backends still need work in these areas. Please re-build with --enable-libsocialweb-backend and --enable-tracker-backend to see the issues.
Created attachment 221037 [details] [review] Fix the libsocialweb backend
(I don't have time just now to fix the many instances of this issue in the Tracker backend).
Review of attachment 221037 [details] [review]: Looks good to me.
Created attachment 221052 [details] [review] tracker backend fixes
Created attachment 221053 [details] [review] huge patch to fix the tests of the tracker backend
Review of attachment 221052 [details] [review]: Great! Please commit to master.
Review of attachment 221053 [details] [review]: Looks like a duplicate of attachment #221052 [details]. Did you upload the wrong patch?
Created attachment 221131 [details] [review] tracker backend fixes As it turns out, I uploaded the same file twice, my bad
Review of attachment 221131 [details] [review]: Looks good to me. Please commit to master. Thanks!
Pushed tracker fixes
Sorry, I caught a few more issues. The following patch should finally do it, I think.
Created attachment 221211 [details] [review] Fix libsocialweb tests
Review of attachment 221211 [details] [review]: Looks good to me, with the modification below. ::: tests/libsocialweb/dummy-lsw.vala @@ +75,3 @@ LibsocialwebTest.ContactView view = (LibsocialwebTest.ContactView)v; + view.Start.begin(); Missing a space before the ‘()’. (The line was before, but we might as well take the opportunity to fix it.)
(In reply to comment #28) > Review of attachment 221211 [details] [review]: > > Looks good to me, with the modification below. > > ::: tests/libsocialweb/dummy-lsw.vala > @@ +75,3 @@ > LibsocialwebTest.ContactView view > = (LibsocialwebTest.ContactView)v; > + view.Start.begin(); > > Missing a space before the ‘()’. (The line was before, but we might as well > take the opportunity to fix it.) Thanks, pushed: commit 5e13a92835143dfc1a9d1ada4ae0f347a85e260d Author: Travis Reitter <travis.reitter@collabora.co.uk> Date: Tue Aug 14 17:40:16 2012 -0700 Note fixes for bgo#681420 in NEWS. Closes: https://bugzilla.gnome.org/show_bug.cgi?id=681420 NEWS | 2 ++ 1 file changed, 2 insertions(+) commit b3ebf1e39c94fed4b4a1f0f2a00a72be7ccbe773 Author: Travis Reitter <travis.reitter@collabora.co.uk> Date: Tue Aug 14 17:37:39 2012 -0700 Access static class members through class; use explicit .begin() This covers the libsocialweb backend tests. Helps: https://bugzilla.gnome.org/show_bug.cgi?id=681420 tests/lib/libsocialweb/backend.vala | 2 +- tests/libsocialweb/aggregation.vala | 8 ++++---- tests/libsocialweb/dummy-lsw.vala | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)