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 681420 - warning (vala 0.17.x): access to static class members through an instance variable
warning (vala 0.17.x): access to static class members through an instance var...
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: general
git master
Other Linux
: Normal major
: Unset
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2012-08-07 23:52 UTC by Travis Reitter
Modified: 2012-08-15 22:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix eds backend (5.49 KB, patch)
2012-08-08 17:53 UTC, Erick Perez Castellanos
accepted-commit_now Details | Review
Patch to fix key-file backend (2.61 KB, patch)
2012-08-08 17:53 UTC, Erick Perez Castellanos
accepted-commit_now Details | Review
Patch to fix telepathy backend (6.75 KB, patch)
2012-08-08 17:54 UTC, Erick Perez Castellanos
accepted-commit_now Details | Review
Patch to fix folks itself (11.13 KB, patch)
2012-08-08 17:54 UTC, Erick Perez Castellanos
accepted-commit_now Details | Review
Patch to fix tests (29.22 KB, patch)
2012-08-08 17:55 UTC, Erick Perez Castellanos
accepted-commit_now Details | Review
Patch to fix tests (4.49 KB, patch)
2012-08-08 17:55 UTC, Erick Perez Castellanos
accepted-commit_now Details | Review
Fix the libsocialweb backend (2.58 KB, patch)
2012-08-13 16:53 UTC, Travis Reitter
accepted-commit_now Details | Review
tracker backend fixes (42.95 KB, patch)
2012-08-13 19:43 UTC, Erick Perez Castellanos
accepted-commit_now Details | Review
huge patch to fix the tests of the tracker backend (42.95 KB, patch)
2012-08-13 19:45 UTC, Erick Perez Castellanos
rejected Details | Review
tracker backend fixes (22.18 KB, patch)
2012-08-14 12:08 UTC, Erick Perez Castellanos
accepted-commit_now Details | Review
Fix libsocialweb tests (4.02 KB, patch)
2012-08-15 00:42 UTC, Travis Reitter
accepted-commit_now Details | Review

Description Travis Reitter 2012-08-07 23:52:46 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.
Comment 1 Erick Perez Castellanos 2012-08-08 12:24:40 UTC
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
Comment 2 Erick Perez Castellanos 2012-08-08 17:53:11 UTC
Created attachment 220711 [details] [review]
Patch to fix eds backend
Comment 3 Erick Perez Castellanos 2012-08-08 17:53:41 UTC
Created attachment 220712 [details] [review]
Patch to fix key-file backend
Comment 4 Erick Perez Castellanos 2012-08-08 17:54:06 UTC
Created attachment 220713 [details] [review]
Patch to fix telepathy backend
Comment 5 Erick Perez Castellanos 2012-08-08 17:54:37 UTC
Created attachment 220714 [details] [review]
Patch to fix folks itself
Comment 6 Erick Perez Castellanos 2012-08-08 17:55:03 UTC
Created attachment 220715 [details] [review]
Patch to fix tests
Comment 7 Erick Perez Castellanos 2012-08-08 17:55:56 UTC
Created attachment 220716 [details] [review]
Patch to fix tests
Comment 8 Philip Withnall 2012-08-08 22:10:28 UTC
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.
Comment 9 Philip Withnall 2012-08-08 22:11:05 UTC
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.
Comment 10 Philip Withnall 2012-08-08 22:12:45 UTC
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.
Comment 11 Philip Withnall 2012-08-08 22:14:09 UTC
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.
Comment 12 Philip Withnall 2012-08-08 22:16:43 UTC
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.
Comment 13 Philip Withnall 2012-08-08 22:17:24 UTC
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).
Comment 14 Erick Perez Castellanos 2012-08-09 19:00:54 UTC
Pushed to master. Commits 3687505..316c0be
Comment 15 Travis Reitter 2012-08-13 16:53:00 UTC
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.
Comment 16 Travis Reitter 2012-08-13 16:53:33 UTC
Created attachment 221037 [details] [review]
Fix the libsocialweb backend
Comment 17 Travis Reitter 2012-08-13 16:54:03 UTC
(I don't have time just now to fix the many instances of this issue in the Tracker backend).
Comment 18 Philip Withnall 2012-08-13 19:36:43 UTC
Review of attachment 221037 [details] [review]:

Looks good to me.
Comment 19 Erick Perez Castellanos 2012-08-13 19:43:26 UTC
Created attachment 221052 [details] [review]
tracker backend fixes
Comment 20 Erick Perez Castellanos 2012-08-13 19:45:26 UTC
Created attachment 221053 [details] [review]
huge patch to fix the tests of the tracker backend
Comment 21 Philip Withnall 2012-08-13 20:28:16 UTC
Review of attachment 221052 [details] [review]:

Great! Please commit to master.
Comment 22 Philip Withnall 2012-08-13 20:29:55 UTC
Review of attachment 221053 [details] [review]:

Looks like a duplicate of attachment #221052 [details]. Did you upload the wrong patch?
Comment 23 Erick Perez Castellanos 2012-08-14 12:08:39 UTC
Created attachment 221131 [details] [review]
tracker backend fixes

As it turns out, I uploaded the same file twice, my bad
Comment 24 Philip Withnall 2012-08-14 17:31:17 UTC
Review of attachment 221131 [details] [review]:

Looks good to me. Please commit to master. Thanks!
Comment 25 Erick Perez Castellanos 2012-08-14 17:48:09 UTC
Pushed tracker fixes
Comment 26 Travis Reitter 2012-08-15 00:42:09 UTC
Sorry, I caught a few more issues. The following patch should finally do it, I think.
Comment 27 Travis Reitter 2012-08-15 00:42:39 UTC
Created attachment 221211 [details] [review]
Fix libsocialweb tests
Comment 28 Philip Withnall 2012-08-15 06:30:51 UTC
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.)
Comment 29 Travis Reitter 2012-08-15 22:06:06 UTC
(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(-)