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 603491 - valac should warn if a private setter is being overridden
valac should warn if a private setter is being overridden
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Parser
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-12-01 15:09 UTC by Nikos Verschore
Modified: 2017-03-09 20:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Disallow private setters in overridable properties (1.01 KB, patch)
2014-08-23 14:13 UTC, Simon Werbeck
committed Details | Review

Description Nikos Verschore 2009-12-01 15:09:46 UTC
I'm made a basic and extended class. The basic class had a private setter that the extended class tried to override. This is an error from my side, but when I generate c-files, the valac compiler doesn't complain about this error.

[basic_class.vala]
using GLib;

public abstract class Basic_class : Object {
    public abstract string some_var { get; private set; }
}

[advanced_class.vala]
using GLib;

public class Extented_class : Basic_class {
    public override string some_var { get; private set; }
}


steps to reproduce:
- valac -C basic_class.vala advanced_class.vala
- gcc -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -c basic_class.c 
- gcc -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -c advanced_class.c

expected result:
- valac complains about overriding a private setter

actual result:
- gcc complains: advanced_class.c:74: warning: ‘basicclass_set_some_var’ used but never defined
Comment 1 Simon Werbeck 2014-08-23 14:13:19 UTC
Created attachment 284294 [details] [review]
Disallow private setters in overridable properties

Marking overridable accessors as private should be an error. The generated get/set functions are static and thus cannot be used from other translation units.
Comment 2 Rico Tzschichholz 2017-03-09 20:32:44 UTC
commit 616f94536eddb2735360f38ff29e40e3dc277fd1
Author: Simon Werbeck <simon.werbeck@gmail.com>
Date:   Thu Aug 14 21:47:44 2014 +0200

    vala: Disallow private accessors in overridable properties